On 05/02/2013 12:17 PM, leaboy@126 wrote:
Thinks, I just missing lxml.
When I installed lxml , it works well.
isn't it a dependency of the rpm?
-----邮件原件-----
发件人: Michael Pasternak [mailto:mpastern@redhat.com]
发送时间: 2013年5月2日 16:23
收件人: leaboy@126
抄送: engine-devel(a)ovirt.org
主题: Re: 答复: about ovirt-engine-sdk
On 05/02/2013 11:06 AM, leaboy@126 wrote:
> 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,
you should be installing sdk in some way, cause just fetching it from the
git,
wasn't make it available in python,
i suggest you installing official releases (unless you would like to develop
& contribute)
from pypi/easy_install.
>
> leaboy@leaboy:~/workspace/thtf-client$ python --version
> Python 2.7.3
> leaboy@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@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,
i just verified it on [1], not sure about embed linux, in any case to
make it work, lxml should be installed.
[1]
python 2.6.6
python-lxml-2.2.3-1
>
>
>
> -----邮件原件-----
> 发件人: Michael Pasternak [mailto:mpastern@redhat.com]
> 发送时间: 2013年5月2日 14:19
> 收件人: leaboy@126
> 抄送: engine-devel(a)ovirt.org
> 主题: Re: about ovirt-engine-sdk
>
>
> Hi,
>
> On 05/02/2013 05:53 AM, leaboy@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@percy-desktop:~/thtf-client$ python --version
>>
>> Python 2.6.5
>>
>> percy@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@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@leaboy:~/workspace/thtf-client$ python --version
>>
>> Python 2.7.3
>>
>> leaboy@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@internal',
'111111', None,
> None, '~/.spicec/ca.crt', None, True)
>>
>>>>>
>>
>
>