meeb / bandcampsync

Downloads your Bandcamp purchases automatically
BSD 3-Clause "New" or "Revised" License
144 stars 7 forks source link

Error accessing download format #22

Open jonch070 opened 2 days ago

jonch070 commented 2 days ago

Hello! i get a similar error no matter which format I try

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/bandcampsync/bandcamp.py", line 263, in get_download_file_url
    download_format = downloads[encoding]
                      ~~~~~~~~~^^^^^^^^^^
KeyError: 'flac'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/bin/bandcampsync", line 55, in <module>
    do_sync(cookies_path, cookies, dir_path, media_format, temp_dir, ign_patterns)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/bandcampsync/__init__.py", line 51, in do_sync
    initial_download_url = bandcamp.get_download_file_url(item, encoding=media_format)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/bandcampsync/bandcamp.py", line 265, in get_download_file_url
    encodings = download_format.keys()
                ^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'download_format' where it is not associated with a value
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/bandcampsync/bandcamp.py", line 263, in get_download_file_url
    download_format = downloads[encoding]
                      ~~~~~~~~~^^^^^^^^^^
KeyError: 'mp3-v0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/bin/bandcampsync", line 55, in <module>
    do_sync(cookies_path, cookies, dir_path, media_format, temp_dir, ign_patterns)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/bandcampsync/__init__.py", line 51, in do_sync
    initial_download_url = bandcamp.get_download_file_url(item, encoding=media_format)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/bandcampsync/bandcamp.py", line 265, in get_download_file_url
    encodings = download_format.keys()
meeb commented 2 days ago

I can patch that to have a slightly more sensible exception message, however it seems like it's not being able to connect to Bandcamp for a different reason. This error is likely related to that. Can you try running it in the supplied docker container? There have been quite a few other people experiencing issues running this directly on macOS lately.