python plistlib file invaded by cocoa values?

前端 未结 3 1658
闹比i
闹比i 2021-01-06 18:17

I\'m using plistlib to create and update a simple plist file in OS X. A tester in Norway is getting an error from plistlib:

File \"../axeomatic2/normal/bui         


        
相关标签:
3条回答
  • 2021-01-06 18:38

    I had the similar problem before, after I try biplist, it's solved.

    0 讨论(0)
  • 2021-01-06 18:39

    Binary plist support has been added to plistlib since python 3.4. https://docs.python.org/3.4/library/plistlib.html

    0 讨论(0)
  • 2021-01-06 19:05

    There's actually two categories of plist format. One is actually simple XML file (which plistlib knows how to parse with expat), the other one is binary property list.

    Unfortunately they both share the same suffix .plist, and all the tools from Apple treat them transparently (e.g. you don't know if you are working with an XML plist or a binary plist, using tools like defaults)

    Like @northtree said, the biplist package is the right tool to read/write the binary plist file.

    UPDATE:

    You can also use plutil(1) that comes with OSX to convert any plist file back to XML format, and then processed by plistlib

    https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/plutil.1.html

    0 讨论(0)
提交回复
热议问题