[GH-ISSUE #425] about webvirtmgr modify vnc passwd question #318

Open
opened 2026-02-27 16:38:51 +03:00 by kerem · 0 comments
Owner

Originally created by @leftalon on GitHub (Sep 10, 2014).
Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/425

if python version is 2.6,modify vnc passwd 500 question,python2.7 not question
cause:
python2.6 module xml.etree.ElementTree.fromstring.find not support “[@”
python2.6:

from xml.etree import ElementTree
root = ElementTree.fromstring("

")
root.find("vnc")
root.find("slot")
print root.find("slot")
None
print root.find("@bus")
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib64/python2.6/xml/etree/ElementTree.py", line 330, in find
return ElementPath.find(self, path)
File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 186, in find
return _compile(path).find(element)
File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 176, in _compile
p = Path(path)
File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 88, in init
raise SyntaxError("unsupported path syntax (%s)" % op)
SyntaxError: unsupported path syntax (@)

python2.7 ok:

print root.find("[@bus]")
<Element 'address' at 0x7f45a83761d0>

Originally created by @leftalon on GitHub (Sep 10, 2014). Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/425 if python version is 2.6,modify vnc passwd 500 question,python2.7 not question cause: python2.6 module xml.etree.ElementTree.fromstring.find not support “[@” python2.6: > > > from xml.etree import ElementTree > > > root = ElementTree.fromstring(" <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>") > > > root.find("vnc") > > > root.find("slot") > > > print root.find("slot") > > > None > > > print root.find("@bus") > > > Traceback (most recent call last): > > > File "<stdin>", line 1, in <module> > > > File "/usr/lib64/python2.6/xml/etree/ElementTree.py", line 330, in find > > > return ElementPath.find(self, path) > > > File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 186, in find > > > return _compile(path).find(element) > > > File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 176, in _compile > > > p = Path(path) > > > File "/usr/lib64/python2.6/xml/etree/ElementPath.py", line 88, in __init__ > > > raise SyntaxError("unsupported path syntax (%s)" % op) > > > SyntaxError: unsupported path syntax (@) python2.7 ok: > > > print root.find("[@bus]") > > > <Element 'address' at 0x7f45a83761d0>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtmgr#318
No description provided.