Has anyone wrapped the appropriate Foundation classes to replace
plistlib?
I've been working on replacing my plistlib calls in munki with their
Foundation equivalents, but I keep running into odd errors with type
conversions to/from Objective-C/Cocoa types. I'm sure I can work
through all this, but if someone has already done the work, I'd be
happy to use it...
I'm replacing
plistlib.readPlist
plistlib.readPlistFromString
plistlib.writePlist
plistlib.writePlistToString
-Greg
Maybe someone from the Python Mac SIG has? Has anyone asked there? If not,
it's probably worth it and if nothing else, someone might want to pitch in.
(Especially given that plistlib is included with Python.) It's a pretty
active list, and a lot of the main Mac Python developers are there.
http://mail.python.org/mailman/listinfo/pythonmac-sig
A lot of stuff there has been focused on Appscript, lately, from what I've
seen. I scan subjects when I can.
--
Jeremy
> I'm using Foundation to read an Info.plist from an Apple package, but
> then plistlib to write another plist. Foundation is returning a long
> integer for the 'IFPkgFlagInstalledSize' value, but plistlib barfs
> trying to write it back out.
> I'm sure this particular problem will go away once I convert the plist
> writing code to use Foundation instead of plistlib, but I'm worried
> that I'm going to run into all sorts of subtle errors down the line
> because the types Foundation is returning are not the same as the
> types plistlib is returning.
>
> I was hoping someone else had already gone down this path.
>
> -Greg
Is there any reason to not just use:
NSDictionary
.dictionaryWithDictionary_(mydict).writeToFile_atomically_(myfile, True)
to output a plist, as explained here: http://stackoverflow.com/questions/879212/serializing-a-python-object-to-xml-apple-plist/1261238#1261238
?
Clinton