james-cube / firefox-bookmarks-deduplicator

Tool for removing duplicate bookmarks and merge directories in firefox json bookmarks backup
MIT License
15 stars 3 forks source link

NoneType error #1

Closed ghost closed 6 years ago

ghost commented 6 years ago

It hangs a while and then there it is:

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/user/Desktop/firefox/firefox-bookmarks-deduplicator/firefox_bookmarks_deduplicator/__main__.py", line 4, in <module>
    deduplicator.main()
  File "firefox_bookmarks_deduplicator/deduplicator.py", line 23, in main
    deduplicate_and_merge_all(bookmarks_object)
  File "firefox_bookmarks_deduplicator/deduplicator.py", line 12, in deduplicate_and_merge_all
    deduplicate_and_merge(get_bookmarks_from_toolbar(bookmarks_object))
  File "firefox_bookmarks_deduplicator/deduplicator.py", line 18, in deduplicate_and_merge
    directory_merge(bookmarks)
  File "firefox_bookmarks_deduplicator/deduplicator_utils.py", line 49, in directory_merge
    for child in dir_to_merge.get("children"):
TypeError: 'NoneType' object is not iterable
james-cube commented 6 years ago

Looks like if you don't have any bookmarks of any specific type (for example zero bookmarks in Bookmarks Menu), the children element in json doesn't exist, thus None.

Should be fine now.

BTW I expect tool to fail in python 2.7, it was tested only on python 3.