biplist fails to parse a .plist that plutil says is ok

Issue #11 closed
Former user created an issue

I have a plist file which is reported by plutil as ok (see image)

However, when I try to read it with biplist.readPlist I get the following error:

biplist.InvalidPlistException: XML or text declaration not at start of entity: line 2, column 0

Indeed if you open the file, the XML only starts on the second line... However, the plist is valid and is being used by the OS properly, so I think the library should be able to parse it too.

What do you think?

Comments (2)

  1. Andrew Wooster repo owner

    This error is coming from Python's built-in plistlib package for reading plists, which is what biplist falls back on when it detects the plist isn't a binary plist:

    >>> from plistlib import readPlist
    >>> readPlist("com.apple.BluetoothService.plist")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 78, in readPlist
        rootObject = p.parse(pathOrFile)
      File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 406, in parse
        parser.ParseFile(fileobj)
    xml.parsers.expat.ExpatError: XML or text declaration not at start of entity: line 2, column 0
    

    So, I'd suggest filing a ticket agains the built-in plistlib library.

  2. Log in to comment