On May 13, 2005, at 7:11 PM, [EMAIL PROTECTED] wrote: > Thanks, Florian, for the instructions on how to convert the new > binary plist files into something parseable. > > I'm wondering if it's going to be possible to bundle this sort of > functionality into plistlib. Since PyObjC is needed, I guess the > normal plistlib won't be able to do it. Maybe a special version of > plistlib could be bundled with PyObjC, just to handle this?
I'd rather not see plistlib change. It does the XML stuff properly, doing anything else doesn't really belong in the standard library. I would rather see plistlib move from plat-mac to the standard distribution than have it bring on optional PyObjC dependencies that work sometimes and not others. This is like when it used to have pyxml dependencies (that weren't implemented properly in the first place). I'll go ahead and add some stuff to PyObjCTools.Conversion before 1.3.5 to read and write plists from data and files, but it's not very hard to do this with just raw PyObjC. thePlist = NSDictionary.dictionaryWithContentsOfFile_(somePath) someDict.writeToFile_atomically_(somePath, True) There are already functions in PyObjCTools.Conversion to convert python data structures to/from the Objective-C counterparts (though as long as the outer thing is a NSDictionary, the write will still work, because all the property lists types are bridged). > Meanwhile, what's the best day to detect if a plist file is binary? > I guess I could just wrap the normal plistlib parsing in a try > block, catch the exception, and try again after converting from > binary, but that seems kludgy. Don't. Just load it. > Does anybody know why Apple chose to start using binary for plist > files? This seems mighty inconvenient. Was it for read/write > performance? Yes, it was for performance. -bob _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig