このライブラリを使用してxmlを解析しています:
import xml.etree.cElementTree as xml
パーサーへの xml 入力は、次の出力ですsubprocess.Popen
。
XMLFile = subprocess.Popen(xml_command,shell=True,stdout=subprocess.PIPE, executable="/bin/ksh").communicate()[0]
root = xml.XML(XMLFile)
次のエラーが表示されます。
IOError: [Errno 36] File name too long: ' <?xml version=\...'
ただし、同じコマンドから生成された xmlxml_command
をファイルとして渡すと、完全に正常に動作します。
root = xml.parse("/home/test.xml")