为什么我会得到;xml.etree.ElementTree.ParseError:python中没有特殊符号的格式不正确(无效令牌)“;?
我试图从.plist文件中提取png文件,我得到了上面的错误 错误1:-为什么我会得到;xml.etree.ElementTree.ParseError:python中没有特殊符号的格式不正确(无效令牌)“;?,python,xml,xml-parsing,elementtree,texturepacker,Python,Xml,Xml Parsing,Elementtree,Texturepacker,我试图从.plist文件中提取png文件,我得到了上面的错误 错误1:- user@TH1588U:~/Downloads/Test/1$ python SpriteExtractor.py atlas_ID101.plist atlas_ID101.png Traceback (most recent call last): File "SpriteExtractor.py", line 10, in <module> pl = plistlib.readPli
user@TH1588U:~/Downloads/Test/1$ python SpriteExtractor.py atlas_ID101.plist atlas_ID101.png
Traceback (most recent call last):
File "SpriteExtractor.py", line 10, in <module>
pl = plistlib.readPlist(plistname)
File "/usr/lib/python2.7/plistlib.py", line 78, in readPlist
rootObject = p.parse(pathOrFile)
File "/usr/lib/python2.7/plistlib.py", line 406, in parse
parser.ParseFile(fileobj)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 2, column 101
user@TH1588U:~/Downloads/Test/1$python SpriteExtractor.py atlas_ID101.plist atlas_ID101.png
回溯(最近一次呼叫最后一次):
文件“SpriteExtractor.py”,第10行,在
pl=plistlib.readPlist(plistname)
readPlist中的文件“/usr/lib/python2.7/plistlib.py”,第78行
rootObject=p.parse(pathOrFile)
文件“/usr/lib/python2.7/plistlib.py”,第406行,在parse中
parser.ParseFile(fileobj)
xml.parsers.expat.expat错误:格式不正确(无效令牌):第2行第101列
错误2:-
user@TH1588U:~/Downloads/Test/1$ python unpack_plist.py
Traceback (most recent call last):
File "unpack_plist.py", line 59, in <module>
gen_png_from_plist( plist_filename, png_filename )
File "unpack_plist.py", line 23, in gen_png_from_plist
root = ElementTree.fromstring(open(plist_filename, 'r').read())
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML
parser.feed(text)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1642, in feed
self._raiseerror(v)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror
raise err
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 2, column 101
user@TH1588U:~/Downloads/Test/1$python unpack_plist.py
回溯(最近一次呼叫最后一次):
文件“unpack_plist.py”,第59行,在
gen_png_from_plist(plist_文件名,png_文件名)
文件“unpack_plist.py”,第23行,在_plist的gen_png_中
root=ElementTree.fromstring(打开(plist_文件名'r').read())
文件“/usr/lib/python2.7/xml/etree/ElementTree.py”,第1300行,xml格式
parser.feed(文本)
文件“/usr/lib/python2.7/xml/etree/ElementTree.py”,第1642行,在提要中
自我提升错误(v)
文件“/usr/lib/python2.7/xml/etree/ElementTree.py”,第1506行,存在错误
提出错误
xml.etree.ElementTree.ParseError:格式不正确(无效令牌):第2行第101列
您的plist文件中有错误。DOCTYPE声明(第2行)未正确终止。最后一个正斜杠必须删除。谢谢@mzjn它成功了