gilesknap / gphotos-sync

Google Photos and Albums backup with Google Photos Library API
Apache License 2.0
2.02k stars 165 forks source link

TypeError: object of type 'NoneType' has no len() #431

Closed bomeara closed 1 year ago

bomeara commented 1 year ago

I ran this once and it worked well; I had to cancel it before it was fully done, though. Now trying to continue it, I'm getting this error:

04-28 08:51:19 WARNING  gphotos-sync 3.1.2 2023-04-28 08:51:19.176213
04-28 08:51:19 ERROR
Process failed.
Traceback (most recent call last):
  File "/Users/bomeara/opt/miniconda3/lib/python3.9/site-packages/gphotos_sync/Main.py", line 506, in main
    self.setup(args, db_path)
  File "/Users/bomeara/opt/miniconda3/lib/python3.9/site-packages/gphotos_sync/Main.py", line 391, in setup
    self.google_photos_down = GooglePhotosDownload(
  File "/Users/bomeara/opt/miniconda3/lib/python3.9/site-packages/gphotos_sync/GooglePhotosDownload.py", line 79, in __init__
    self.bad_ids = BadIds(self._root_folder)
  File "/Users/bomeara/opt/miniconda3/lib/python3.9/site-packages/gphotos_sync/BadIds.py", line 25, in __init__
    self.load_ids()
  File "/Users/bomeara/opt/miniconda3/lib/python3.9/site-packages/gphotos_sync/BadIds.py", line 34, in load_ids
    log.debug("bad_ids file, loaded %d bad ids", len(self.items))
TypeError: object of type 'NoneType' has no len()
04-28 08:51:19 WARNING  Done.

I've tried the flush-index and rescan options, but same issue. I'm on OS X 13.2.1, with Python 3.9.12.

gilesknap commented 1 year ago

Hi @bomeara the code is supposed to be resilient to cancelling and restarting. But it looks like maybe you somehow got a corrupted bad ids file. See if there is a file called gphotos.bad_ids in your root folder and delete it if there is.

HTH

bomeara commented 1 year ago

Yes! Removing gphotos.bad_ids.yaml has seemed to fix it. Thank you for your help!