Wednesday, 15 February 2012

xml parsing - Can not parse xml from sunprocess.Popen output in Python -



xml parsing - Can not parse xml from sunprocess.Popen output in Python -

i'm using library parse xml:

import xml.etree.celementtree xml

the xml input parser output of sunprocess.popen:

xmlfile = subprocess.popen(xml_command,shell=true,stdout=subprocess.pipe, executable="/bin/ksh").communicate()[0] root = xml.xml(xmlfile)

i error:

class="lang-none prettyprint-override">ioerror: [errno 36] file name long: ' <?xml version=\...'

however, when pass xml generated same command xml_command file, works fine:

root = xml.parse("/home/test.xml")

please help!

try this

from xml.etree.elementtree import fromstring root = fromstring(subprocess.check_output(['/bin/ksh']))

python xml-parsing subprocess xml.etree celementtree

No comments:

Post a Comment