SafariBookmarkEditor
SafariBookmarkEditor copied to clipboard
Error with CLI Usage
I've got following error while running the module with CLI:
$ ./SafariBookmarkEditor.py
Traceback (most recent call last):
File "./SafariBookmarkEditor.py", line 243, in <module>
main()
File "./SafariBookmarkEditor.py", line 229, in main
bookmarks = SafariBookmarks()
File "./SafariBookmarkEditor.py", line 26, in __init__
self.read()
File "./SafariBookmarkEditor.py", line 97, in read
self.bookmarks = self.plist['Children'][1]['Children']
KeyError: 'Children'
What does this mean?
It looks like your bookmarks plist might be in a format that the script can't read.
Does your "~/Library/Safari/Bookmarks.plist" file exist? You can confirm by running an 'ls' on it.
ls ~/Library/Safari/Bookmarks.plist
If it exists try converting it to xml format (from binary) so that you can read it then cat-ing it from the console using the commands below.
plutil -convert xml1 ~/Library/Safari/Bookmarks.plist cat ~/Library/Safari/Bookmarks.plist
Yes it exists. I created a fresh user and it didn't work. Then I removed a bookmark manually and the issue was gone. Looks like the script cannot handle the default Bookmarks.plist. You can try it, when you remove the whole ~/Library/Safari folder, start and quit Safari and run the script.
Ya I encountered this issue before actually now that I'm remembering. We solved it by scripting Safari to be opened and closed in the new user's context before attempting to modify the bookmarks (basically the same way as the solution you described).
If you can figure out a more elegant solution feel free to submit a PR! Scripting opening and closing Safari (using a subprocess call for example) is what I would recommend as-is however.
On Mar 14, 2018 5:14 AM, "Anver Housseini" [email protected] wrote:
Yes it exists. I created a fresh user and it didn't work. Then I removed a bookmark manually and the issue was gone. Looks like the script cannot handle the default Bookmarks.plist. You can try it, when you remove the whole ~/Library/Safari folder, start and quit Safari and run the script.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/robperc/SafariBookmarkEditor/issues/1#issuecomment-373000007, or mute the thread https://github.com/notifications/unsubscribe-auth/AI9s4iXVGdah-aLQzL5Q0HZS9UKCn9oyks5teQl2gaJpZM4SoKEt .