[Engine-devel] 答复: about ovirt-engine-sdk

leaboy@126 wlbleaboy at 126.com
Thu May 2 08:06:44 UTC 2013


The code I got in 2013-1-27 with git, I don't know which version I got, 
I didn't install it , I just use it like the example, 

 leaboy at leaboy:~/workspace/thtf-client$ python --version 
 Python 2.7.3 
 leaboy at leaboy:~/workspace/thtf-client$ python 
 Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
 [GCC 4.6.3] on linux2 
 Type "help", "copyright", "credits" or "license" for more information.
 
 >>> from ovirtsdk.api import API 
 >>> from ovirtsdk.xml import params 
 >>> api = API('http://192.168.1.181', 'admin at internal', '111111', None,
None, '~/.spicec/ca.crt', None, True) 
 >>>

I use it successful in ubuntu 12.04 without any other operation,
Just import the modules with python 2.7.3

But when I use it in other OS, such as ubuntu 11, or embed linux for ARM,
With python 2.6.*, It does't work,



-----邮件原件-----
发件人: Michael Pasternak [mailto:mpastern at redhat.com] 
发送时间: 2013年5月2日 14:19
收件人: leaboy at 126
抄送: engine-devel at ovirt.org
主题: Re: about ovirt-engine-sdk


Hi,

On 05/02/2013 05:53 AM, leaboy at 126 wrote:
> Hi,all
> 
> How can I use overt-engine-sdk in the python environment below python2.7,
> 
> For example, when I use it in python 2.6.5 like thus:

what sdk version you're using?
how did you installed it?
what version of lxml you have installed?

> 
>  
> 
> percy at percy-desktop:~/thtf-client$ python --version
> 
> Python 2.6.5
> 
> percy at percy-desktop:~/thtf-client$ python
> 
> Python 2.6.5 (r265:79063, Oct  1 2012, 22:04:36)
> 
> [GCC 4.4.3] on linux2
> 
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>> from ovirtsdk.api import API
> 
>>>> from ovirtsdk.xml import params
> 
>>>> api = API('http://192.168.1.181', 'admin at internal', '111111', None,
None, '~/.spicec/ca.crt', None, None, True)
> 
> *Traceback (most recent call last):*
> 
> *  File "<stdin>", line 1, in <module>*
> 
> *  File "ovirtsdk/api.py", line 107, in __init__*
> 
> *    url='/api')*
> 
> *  File "ovirtsdk/infrastructure/proxy.py", line 129, in request*
> 
> *    last=last)*
> 
> *  File "ovirtsdk/infrastructure/proxy.py", line 171, in __doRequest*
> 
> *    return params.parseString(response_body) if response_body is not None
and response_body is not '' \*
> 
> *  File "ovirtsdk/xml/params.py", line 21229, in parseString*
> 
> *    rootObj.build(rootNode)*
> 
> *  File "ovirtsdk/xml/params.py", line 20304, in build*
> 
> *    self.buildAttributes(node, node.attrib, [])*
> 
> *  File "ovirtsdk/xml/params.py", line 20309, in buildAttributes*
> 
> *    super(API, self).buildAttributes(node, attrs, already_processed)*
> 
> *  File "ovirtsdk/xml/params.py", line 4160, in buildAttributes*
> 
> *    value = find_attr_value_('xsi:type', node)*
> 
> *  File "ovirtsdk/xml/params.py", line 316, in find_attr_value_*
> 
> *    namespace = node.nsmap.get(prefix)*
> 
> *AttributeError: nsmap*
> 
>>>> 
> 
>  
> 
>  
> 
> But, when I use it in python 2.7.3, it’s ok
> 
>  
> 
> leaboy at leaboy:~/workspace/thtf-client$ python --version
> 
> Python 2.7.3
> 
> leaboy at leaboy:~/workspace/thtf-client$ python
> 
> Python 2.7.3 (default, Aug  1 2012, 05:16:07)
> 
> [GCC 4.6.3] on linux2
> 
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>> from ovirtsdk.api import API
> 
>>>> from ovirtsdk.xml import params
> 
>>>> api = API('http://192.168.1.181', 'admin at internal', '111111', None,
None, '~/.spicec/ca.crt', None, True)
> 
>>>> 
> 


-- 

Michael Pasternak
RedHat, ENG-Virtualization R&D





More information about the Devel mailing list