python plistlib file invaded by cocoa values?

前端 未结 3 1683
闹比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 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

提交回复
热议问题