As the title says, i am trying to create a vm on opennebula with the python api. (this is my first time working with one and i have zero clue of anythings, so plz be not too hard with me)
#!/usr/bin/python3
import oca
client = oca.Client('username:passwd', 'ip:2633/RPC2')
oca.VirtualMachine.allocate(client, 'test')
#'test' is the name of the template i want to use
it gives me this error:
oca.exceptions.OpenNebulaException: [VirtualMachineAllocate] Error allocating a new virtual machine. Parse error: syntax error, unexpected $end, expecting EQUAL or EQUAL_EMPTY at line 1, columns 1:5
anyone an idea how to fix this?
thanks in advance.
ok.. i am stupid and have searched only after 4h trying in the right place --> the git repository and the 'issues' tab.
vm_templ = oca.VmTemplatePool(client)
vm_templ.info()
for templ in vm_templ:
if templ.name == "Ubuntu 14.04 - KVM":
templ.instantiate("oca-test")
that is a way you can create a vm of an existing template via python.
(the connection part is missing, but that is trivial).
i don't delete this question, perhaps somebody out there will have a hard time too with this.
Related
I have python code which keeps giving below error. To the surprise it keeps coming in one environment (QA) but does not happen in another (DEV) inspite of using exact same code and input file
"TypeError","evalue":"'list' object is not callable"
I have below lines related to python list in my code -
country_list = list(input_df.select('country').distinct().toPandas()['country'])
country_list = list(filter(None, country_list))
country_code = str(country_list).strip('[]')
Which looks fine to me and works in DEV environment without any issue. What could be the possible reason for this. Can this be something to with python versions?
Thanks in advance
I'm a Python beginner and am trying out JupyterLab. I tried a simple line of code but keep getting an error a NameError message: name 'val' is not defined. I'm using JupyterLab 2.1.3 on a localhost (Win 10 Enterprise). Any help?
In the picture, the [] beside your code cell indicates that the cell defining val = ... has not been executed. If you run the cell, [] would change to [2] based on your picture.
Simply put, run the cell above first before running the cell you are having error in now.
Or, you can simply combine them:
val = 4+2+4
val
Run this and it will give you what you want.
Thank you everyone for helping. I found out that my original line of code was written in Raw mode that's why it showed an error. Setting it to Code mode fixed it. Sorry I didn't capture the entire screen.
Like mentioned on this post, I would like to just import a skin weightmap (a .weightMap file) into a scene without having to open a dialogue box. Trying to reverse - engineer the script mentioned in the reply didn't get me anywhere.
When I do it manually thru maya's ui - the script history shows...
ImportSkinWeightMaps;
...as a command. But my searches on this keep leading me to the deformerWeights command.
Thing is, there is no example on the documentation as to how to correctly write the syntax. Writing the flags, the path thru trial and error with it didn't work out, plus additional searches keep giving me the hint that I need to use a .xml file for some reason? when all I want to do is import a .weightMap file.
I even ended up looking at weight importer scripts in highend3d.com in hopes at looking at what a proper importing syntax should look like.
All I need is the correct syntax (or command) for something like:
mel.eval("ImportSkinWeightMaps;")
or
cmds.deformerWeights (p = "path to my .weightMap file", im=True, )
or
from pymel.core import *
pymel.core.runtime.ImportSkinWeightMaps ( 'targetOject', 'path to .weightMap file' )
Any help would be greatly appreciated.
Thanks!
why not using some cmds.skinPercent ?
It is more reliable.
http://tech-artists.org/forum/showthread.php?5490-Faster-way-to-find-number-of-influences-Maya&p=27598#post27598
Issue: Error being thrown: tableausdk.Exceptions.TableauException: TableauException (40200): The system cannot find the path specified.
- OS::mkdir(CreateDirectory path="C:\PATH\Tableau-SDK\tdetmp2A0E0E5E")
I am attempting to to create a tableau extract from oracle data using python and the tableauSDK.
The code seems to run correctly if the extract already exists. (although the produced tde is unreadable)
According to the Tableau community I should be able to create an extract from any source data without the extract already existing...
Any idea on why this is occuring?
tde_path = r'C:\PATH\test.tde'
tde_file = Extract(path=tde_path) ## ERROR Thrown here
The reason now seems obvious...
The error had the answer :
OS::mkdir(CreateDirectory path="C:\PATH\Tableau-SDK\tdetmp2A0E0E5E")
To solve the issue :
The Directory C:\PATH\Tableau-SDK\ did not exist.
Created the Directory and the code ran without error.
I am trying to send a file between two mobile phones using Python language
for the phone that will send i used this code:
import socket,e32socket,appuifw
socket=e32socket.socket(e32socket.AF_BT,e32socket.SOCK_STREAM,e32socket.BTPROTO_RFCOMM,e32socket.OBEX)
device =e32socket.bt_obex_discover()
print device
address=device[0]
print address
channel=device[1][u'OBEX Object Push']
print channel
e32socket.bt_obex_send_file(address,channel,u"E:23.txt")
for the mobile that will receive i used this code
import socket,e32socket,appuifw
socket=e32socket.socket(e32socket.AF_BT,e32socket.SOCK_STREAM,e32socket.BTPROTO_RFCOMM,e32socket.OBEX)
e32socket.bt_obex_receive(socket, u"E:23.txt")
I savesd first code in .py in an moible then i excuted using python interpreter,, first the bluetooth discovery menu appeares then i selected a mobile that has the mac address which is in the first code,, the error in the last line in that code ""socket.error:(2,'No such file or directory') "" this the error which i found
Can someone help me to solve this problem?
For one, "E:23.txt" is not a valid path to a file. Always remember your slashes, they are very important! Thus, you would change it from:
e32socket.bt_obex_send_file(address,channel,u"E:23.txt")
to
e32socket.bt_obex_send_file(address,channel,u"E:\\23.txt")
Also, I am not quite familiar with bt_obex_receive, but you would want to fix that path as well.
Additionally, you are importing the appuifw module without using it. Unless you plan on adding code that uses it, importing it is very inefficient.