Hi, I'm trying to write a bookmark synchronizer from Firefox/Foxmarks to Safari. The Firefox side of things will be fairly easy and I thought the Safari side would be too. Right now I am simply attempting to read my Bookmarks.plist file using plistlib.py. Here is my attempt to read the file along with the traceback that I get...
------------------------------------------------------------------------------------------------------------------------------------------- In [1]: import plistlib In [2]: plistlib.Plist.fromFile('Bookmarks.plist') fileobj ---> <open file 'Bookmarks.plist', mode 'r' at 0x8e45d10> --------------------------------------------------------------------------- <class 'xml.parsers.expat.ExpatError'> Traceback (most recent call last) /home/william/williamFAT/utilities/mac_projs/<ipython console> in <module>() /usr/lib/python2.5/plistlib.py in fromFile(cls, pathOrFile) 339 def fromFile(cls, pathOrFile): 340 """Deprecated. Use the readPlist() function instead.""" --> 341 rootObject = readPlist(pathOrFile) 342 plist = cls() 343 plist.update(rootObject) /usr/lib/python2.5/plistlib.py in readPlist(pathOrFile) 75 didOpen = 1 76 p = PlistParser() ---> 77 rootObject = p.parse(pathOrFile) 78 if didOpen: 79 pathOrFile.close() /usr/lib/python2.5/plistlib.py in parse(self, fileobj) 401 parser.CharacterDataHandler = self.handleData 402 print 'fileobj --->',fileobj --> 403 parser.ParseFile(fileobj) 404 return self.root 405 <class 'xml.parsers.expat.ExpatError'>: not well-formed (invalid token): line 1, column 8 ------------------------------------------------------------------------------------------------------------------------------------------- Also, I can read other plist files fine such as SignaturesByAccount.plist and AddressBookMe.plist. I am trying to do this in Ubuntu with Python2.5. The xml version might also be useful... In [4]: xml.__version__ Out[4]: '0.8.4' Thanks, Bill
-- http://mail.python.org/mailman/listinfo/python-list