gilesknap / gphotos-sync

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

Error when running gphotos-sync #449

Closed gregeeh closed 8 months ago

gregeeh commented 8 months ago

Hi all,

Getting the following error when running gphotos-sync:

(gphotos) greg@debian:~$ gphotos-sync ~/google --album Camera
10-15 13:53:57 WARNING  gphotos-sync 3.1.3 2023-10-15 13:53:57.228375
missing or bad secrets file: /home/greg/.config/gphotos-sync/client_secret.json
10-15 13:53:57 ERROR
Process failed.
Traceback (most recent call last):
  File "/home/greg/gphotos/lib/python3.11/site-packages/gphotos_sync/authorize.py", line 51, in __init__
    all_json = load(stream)
               ^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 293, in load
    return loads(fp.read(),
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 335, in loads
    raise JSONDecodeError("Unexpected UTF-8 BOM (decode using utf-8-sig)",
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/greg/gphotos/lib/python3.11/site-packages/gphotos_sync/Main.py", line 506, in main
    self.setup(args, db_path)
  File "/home/greg/gphotos/lib/python3.11/site-packages/gphotos_sync/Main.py", line 346, in setup
    self.auth = Authorize(
                ^^^^^^^^^^
  File "/home/greg/gphotos/lib/python3.11/site-packages/gphotos_sync/authorize.py", line 64, in __init__
    exit(1)
  File "<frozen _sitebuiltins>", line 26, in __call__
SystemExit: 1
10-15 13:53:57 WARNING  Done.
(gphotos) greg@debian:~$
(gphotos) greg@debian:~$
(gphotos) greg@debian:~$
(gphotos) greg@debian:~$ ls -la /home/greg/.config/gphotos-sync/
total 12
drwxr-xr-x  2 greg greg 4096 Oct 15 13:31 .
drwx------ 12 greg greg 4096 Oct 15 13:23 ..
-rw-r--r--  1 greg greg  470 Oct 15 13:31 client_secret.json
(gphotos) greg@debian:~$

Any ideas to the cause would be appreciated.

TIA

gilesknap commented 8 months ago

My guess is that your client_secret.json is not valid JSON for some reason. Take a look inside and see what it looks like (if you want to post it here for help debugging then please redact the secret keys in it.)

gregeeh commented 8 months ago

Thanks for your reply. You were correct, somehow client_secret.json was corrupt.

gilesknap commented 8 months ago

I guess you got past this.