fail to setup openstack dynamic inventory - python

I am trying to setup openstack dynamic inventory,when I am trying execute this command it's throwing me this error.
command: etc/ansible/hosts --list
Traceback (most recent call last):
File "/etc/ansible/hosts", line 263, in <module>
main()
File "/etc/ansible/hosts", line 249, in main
inventory = shade.inventory.OpenStackInventory(**inventory_args)
File "/usr/local/lib/python2.7/dist-packages/shade/inventory.py", line 35, in __init__
config_files=os_client_config.config.CONFIG_FILES + config_files)
File "/usr/local/lib/python2.7/dist-packages/os_client_config/config.py", line 221, in __init__
self.cloud_config['clouds'] = {}
TypeError: list indices must be integers, not str

Related

When I need Initialize a new site in ERPNext

when I write the command line in terminal
bench new-site site1.local
This Error Will shown
> Traceback (most recent call last):
File "/home/ubuntu/.local/bin/bench", line 8, in <module>
sys.exit(cli())
File "/home/ubuntu/bench/bench/cli.py", line 71, in cli
cmd_from_sys = get_cmd_from_sysargv()
File "/home/ubuntu/bench/bench/utils/__init__.py", line 554, in get_cmd_from_sysargv
if sys_argv.index(arg) == 0 and arg in Bench(".").apps:
File "/home/ubuntu/bench/bench/bench.py", line 67, in __init__
self.apps = BenchApps(self)
File "/home/ubuntu/bench/bench/bench.py", line 174, in __init__
self.initialize_apps()
File "/home/ubuntu/bench/bench/bench.py", line 281, in initialize_apps
self.apps.remove("frappe")
ValueError: list.remove(x): x not in list
Note I use EC2 On AWS Ubunto server
Can Any One Help With This Problem Please.
I tried to install many lib but no help with this problem

Python connection with Hive database in HDInsight

I am trying to create connection to Hive hosted in HDInsight cluster through my python script and getting below error-
Traceback (most recent call last):
File "ClassLoader.java", line 357, in java.lang.ClassLoader.loadClass
File "Launcher.java", line 349, in sun.misc.Launcher$AppClassLoader.loadClass
File "ClassLoader.java", line 424, in java.lang.ClassLoader.loadClass
File "URLClassLoader.java", line 382, in java.net.URLClassLoader.findClass
java.lang.ClassNotFoundException: java.lang.ClassNotFoundException: org.apache.thrift.transport.TTransportException
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "org.jpype.JPypeContext.java", line 330, in org.jpype.JPypeContext.callMethod
File "Method.java", line 498, in java.lang.reflect.Method.invoke
File "DelegatingMethodAccessorImpl.java", line 43, in sun.reflect.DelegatingMethodAccessorImpl.invoke
File "NativeMethodAccessorImpl.java", line 62, in sun.reflect.NativeMethodAccessorImpl.invoke
File "NativeMethodAccessorImpl.java", line -2, in sun.reflect.NativeMethodAccessorImpl.invoke0
File "DriverManager.java", line 247, in java.sql.DriverManager.getConnection
File "DriverManager.java", line 664, in java.sql.DriverManager.getConnection
File "HiveDriver.java", line 105, in org.apache.hive.jdbc.HiveDriver.connect
Exception: Java Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "s.py", line 5, in <module>
"/root/jdbc/hive-jdbc-1.2.1000.2.6.5.3009-43.jar")
File "/usr/local/lib64/python3.6/site-packages/jaydebeapi/__init__.py", line 412, in connect
jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
File "/usr/local/lib64/python3.6/site-packages/jaydebeapi/__init__.py", line 230, in _jdbc_connect_jpype
return jpype.java.sql.DriverManager.getConnection(url, *dargs)
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: org/apache/thrift/transport/TTransportException
My Script is -
import jaydebeapi
conn = jaydebeapi.connect("org.apache.hive.jdbc.HiveDriver",
"jdbc:hive2://10.20.30.40:10001/default;transportMode=http;ssl=false;httpPath=/hive2",
["username", "password"],
"/root/jdbc/hive-jdbc-1.2.1000.2.6.5.3009-43.jar")
I have exported CLASSPATH wil all jar files.
The error is java.lang.ClassNotFoundException: java.lang.ClassNotFoundException which specifies that the execution is not able to find the jar /root/jdbc/hive-jdbc-1.2.1000.2.6.5.3009-43.jar.I believe it's only placed in a host from where you are executing the code. I would suggest placing the jar file in the same directory structure in all the nodes in the cluster and have a check on permissions so that the user executing the job has access to that path.

How to solve "KeyError: 'cpu'" error when trying to generate configFileName.xml with Gem5toMcpat?

Hello I am trying to generate configFileName.xml by using the following command in Gem5toMcpat parser which is installed on ubuntu 20
python Program.py stats.txt config.json ARM_A9_2GHz.xml
but it showed me this error
Traceback (most recent call last):
File "Program.py", line 964, in <module>
main()
File "Program.py", line 38, in main
countCores(sys.argv[2])
File "Program.py", line 70, in countCores
noCores = len(configfile["system"]["cpu"])
KeyError: 'cpu'

AttributeErrors when adding variables/constraints to Gurobi persistent

I am trying to modify a model by adding variables/constraints and re-solving the updated model, following the guide.
The problem is that both cases fail with attribute errors, for a variable:
Traceback (most recent call last):
File "seqdesign.py", line 98, in <module>
main()
File "seqdesign.py", line 71, in main
problem._solver.add_var(problem._model.McBernoulliTrials)
File "/home/edo/miniconda3/envs/spacers/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/persistent_solver.py", line 153, in add_var
self._add_var(var)
File "/home/edo/miniconda3/envs/spacers/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/gurobi_direct.py", line 208, in _add_var
vtype = self._gurobi_vtype_from_var(var)
File "/home/edo/miniconda3/envs/spacers/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/gurobi_direct.py", line 377, in _gurobi_vtype_from_var
if var.is_binary():
AttributeError: 'IndexedVar' object has no attribute 'is_binary'
And for a constraint:
Traceback (most recent call last):
File "seqdesign.py", line 98, in <module>
main()
File "seqdesign.py", line 71, in main
problem._solver.add_constraint(problem._model.McBernoulliTrialsSetPositive)
File "/home/edo/miniconda3/envs/spacers/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/persistent_solver.py", line 132, in add_constraint
self._add_constraint(con)
File "/home/edo/miniconda3/envs/spacers/lib/python3.7/site-packages/pyomo/solvers/plugins/solvers/gurobi_direct.py", line 272, in _add_constraint
if is_fixed(con.body):
AttributeError: 'IndexedConstraint' object has no attribute 'body'
Is the problem that I am using indexed variables and constraints? How to make this work without migrating all code from pyomo.environ to pyomo.core?
You cannot pass an IndexedVar or and IndexedConstraint into the add_var and add_constraint methods. You have to loop over the individual variables and constraints and add them one at a time:
for v in my_var.values():
solver.add_var(v)
for c in my_con.values():
solver.add_constraint(c)
Additionally, you can check if a variable or constraint is indexed with my_var.is_indexed() or my_con.is_indexed().

How to add chain id in pdb

By using biopython library, I would like to add chains ids in my pdb file.
I'm using
p = PDBParser()
structure=p.get_structure('mypdb',mypdb.pdb)
model=structure[0]
model.child_list=["A","B"]
But I got this error:
Traceback (most recent call last):
File "../../principal_axis_v3.py", line 319, in <module>
main()
File "../../principal_axis_v3.py", line 310, in main
protA=read_PDB(struct,ch1,s1,e1)
File "../../principal_axis_v3.py", line 104, in read_PDB
chain=model[ch]
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/PDB/Entity.py", line 38, in __getitem__
return self.child_dict[id]
KeyError: 'A'
I tried to changes the keys in th child.dict, butI got another error:
Traceback (most recent call last):
File "../../principal_axis_v3.py", line 319, in <module>
main()
File "../../principal_axis_v3.py", line 310, in main
protA=read_PDB(struct,ch1,s1,e1)
File "../../principal_axis_v3.py", line 102, in read_PDB
model.child_dict.keys=["A","B"]
AttributeError: 'dict' object attribute 'keys' is read-only
How can I add chains ids ?
Your error is that child_list is not a list with chain IDs, but of Chain objects (Bio.PDB.Chain.Chain). You have to create Chain objects and then add them to the structure. A lame example:
from Bio.PDB.Chain import Chain
my_chain = Chain("C")
model.add(my_chain)
Now you can access the model child_dict:
>>> model.child_dict
{'A': <Chain id=A>, 'C': <Chain id=C>}
>>> model.child_dict["C"]
<Chain id=C>

Categories

Resources