ReadingListReader
ReadingListReader copied to clipboard
"not well-formed" ExpatError.
I think there's something wrong with my reading list? I'm running osx 10.8.2
ExpatError: 'not well-formed (invalid token): line 21398, column 18'
function init in readinglistlib.py at line 17 xml = plistlib.readPlist(pipe) function readPlist in plistlib.py at line 78 rootObject = p.parse(pathOrFile) function parse in plistlib.py at line 406 parser.ParseFile(fileobj) copy output Program exited with code #1 after 0.50 seconds.
Thanks for the report. At first glance, it appears the error is originating in the XML parser used by plistlib, part of the Python standard library I use to load the reading list - which is consistent with your thought that your reading list may be corrupted. Can you try running plutil ~/Library/Safari/Bookmarks.plist to check whether there are any errors in your bookmarks file? (It contains your reading list items.) It should repeat the path, followed by OK.
If plutil does not report any errors, I will dig into it deeper.
It seems okay: Any other thoughts?
plutil ~/Library/Safari/Bookmarks.plist /Users/jonchui/Library/Safari/Bookmarks.plist: OK
If you're willing to share the URLs of your current reading list items, I'll see if I can reproduce the error. Alternatively, any details you can provide to identify a specific sample link that triggers the error will help.
(The script calls plutil to convert the bookmarks file - a binary-formatted property list - to regular XML, which can then be read with Python's plistlib. My guess is that something isn't surviving this translation. Things to look for in the links or summary text include characters that may need to be escaped or text that resembles XML tags.)
I opened the binary plist in xcode & can also read them. So i wonder where the disconnect is. You've never seen this before right?
I don't mind sharing my reading list with you if you want to give it a try
That is my suggestion. Have you made any effort to identify which bookmark in your reading list triggers the bug? (For example, manually remove one item at a time and re-run the script until you find the culprit. That would help to pinpoint what is going wrong.)
Reading the binary plist in Xcode confirms what plutil's OK output confirms: that the binary plist is valid. My guess is that it is a subsequent step in the process that is failing - either converting the binary plist to XML format, or parsing that XML. Again, a specific sample link that causes the script to fail would help reproduce the problem and figure out a fix.
Is there any progress on this? Getting the same error and plutil ~/Library/Safari/Bookmarks.plist gives an OK.
Maybe it's something with UTF-8 characters in site titles? Or in the description?
I let it drop since I never ran into the bug myself and didn't receive any specific examples to test. Sorry!
I use Linux instead of OS X now so I am unlikely to do any more work on this. The code's all here, though, so hopefully someone can figure out fixes.
I got this error as well. The workaround is to open Bookmarks.plist in an editor and go to the location in the "invalid token" error line -- in your case "line 21398, column 18". Whatever text is there, delete it, then run the script again. Repeat until it stops erroring.