ÕâÊÇÒ»·â MIME žñÊœµÄ¶à²¿·ÖÓÊŒþ¡£
------=_NextPart_000_000B_01CE4723.27810F40
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
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:
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)
>>
------=_NextPart_000_000B_01CE4723.27810F40
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"\6279\6CE8\6846\6587\672C Char";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:9.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.Char
{mso-style-name:"\6279\6CE8\6846\6587\672C Char";
mso-style-priority:99;
mso-style-link:\6279\6CE8\6846\6587\672C;}
.MsoChpDefault
{mso-style-type:export-only;}
/* Page Definitions */
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3DZH-CN link=3Dblue vlink=3Dpurple =
style=3D'text-justify-trim:punctuation'>
<div class=3DSection1>
<p class=3DMsoNormal><span
lang=3DEN-US>Hi,all<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
lang=3DEN-US>
How
can I use overt-engine-sdk in the python environment below =
python2.7,<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>For example, when I use it in =
python 2.6.5
like thus:<o:p></o:p></span></p>
<p class=3DMsoNormal><span
lang=3DEN-US><o:p> </o:p></span></p>
<p class=3DMsoNormal><span =
lang=3DEN-US>percy@percy-desktop:~/thtf-client$ python
--version<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>Python =
2.6.5<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
lang=3DEN-US>percy@percy-desktop:~/thtf-client$ =
python<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>Python 2.6.5 (r265:79063, =
Oct 1 2012,
22:04:36) <o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>[GCC 4.4.3] on =
linux2<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>Type "help",
"copyright", "credits" or "license"
for =
more
information.<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>>>> from
ovirtsdk.api =
import API<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>>>> from
ovirtsdk.xml =
import
params<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>>>> api =3D
API('http://192.168.1.181', 'admin@internal', '111111', None,
None, =
'~/.spicec/ca.crt',
None, None, True)<o:p></o:p></span></p>
<p class=3DMsoNormal><b><span lang=3DEN-US>Traceback (most recent call
=
last):<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span lang=3DEN-US> File =
"<stdin>",
line 1, in <module><o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span lang=3DEN-US> File =
"ovirtsdk/api.py",
line 107, in __init__<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span
lang=3DEN-US> =
url=3D'/api')<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span lang=3DEN-US> File
"ovirtsdk/infrastructure/proxy.py", line 129, in =
request<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span
lang=3DEN-US> =
last=3Dlast)<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span lang=3DEN-US> File
"ovirtsdk/infrastructure/proxy.py", line 171, in =
__doRequest<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span
lang=3DEN-US> return
params.parseString(response_body) if response_body is not None and
response_body is not '' \<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span lang=3DEN-US> File
"ovirtsdk/xml/params.py", line 21229, in =
parseString<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span
lang=3DEN-US>
rootObj.build(rootNode)<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span lang=3DEN-US> File
"ovirtsdk/xml/params.py", line 20304, in =
build<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span
lang=3DEN-US>
self.buildAttributes(node, node.attrib,
[])<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span lang=3DEN-US> File
"ovirtsdk/xml/params.py", line 20309, in =
buildAttributes<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span
lang=3DEN-US> super(API,
self).buildAttributes(node, attrs, =
already_processed)<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span lang=3DEN-US> File
"ovirtsdk/xml/params.py", line 4160, in =
buildAttributes<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span
lang=3DEN-US> value =3D
find_attr_value_('xsi:type',
node)<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span lang=3DEN-US> File =
"ovirtsdk/xml/params.py",
line 316, in find_attr_value_<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span
lang=3DEN-US> namespace =
=3D
node.nsmap.get(prefix)<o:p></o:p></span></b></p>
<p class=3DMsoNormal><b><span lang=3DEN-US>AttributeError: =
nsmap</span></b><span
lang=3DEN-US><o:p></o:p></span></p>
<p class=3DMsoNormal><span =
lang=3DEN-US>>>><o:p> </o:p></span></p>
<p class=3DMsoNormal><span
lang=3DEN-US><o:p> </o:p></span></p>
<p class=3DMsoNormal><span
lang=3DEN-US><o:p> </o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>But, when I use it in python =
2.7.3, it’s
ok<o:p></o:p></span></p>
<p class=3DMsoNormal><span
lang=3DEN-US><o:p> </o:p></span></p>
<p class=3DMsoNormal><span =
lang=3DEN-US>leaboy@leaboy:~/workspace/thtf-client$
python --version<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>Python =
2.7.3<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
lang=3DEN-US>leaboy@leaboy:~/workspace/thtf-client$
python<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>Python 2.7.3 (default, Aug
=
1 2012,
05:16:07) <o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>[GCC 4.6.3] on =
linux2<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>Type "help",
"copyright", "credits" or "license"
for =
more
information.<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>>>> from
ovirtsdk.api =
import API<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>>>> from
ovirtsdk.xml =
import
params<o:p></o:p></span></p>
<p class=3DMsoNormal><span lang=3DEN-US>>>> api =3D
API('http://192.168.1.181', 'admin@internal', '111111', None,
None,
'~/.spicec/ca.crt', None, True)<o:p></o:p></span></p>
<p class=3DMsoNormal><span =
lang=3DEN-US>>>><o:p> </o:p></span></p>
</div>
</body>
</html>
------=_NextPart_000_000B_01CE4723.27810F40--