jsvine / waybackpack

Download the entire Wayback Machine archive for a given URL.
MIT License
2.8k stars 189 forks source link

TypeError: a bytes-like object is required, not 'NoneType' on 5xx error #41

Closed xSke closed 3 years ago

xSke commented 3 years ago

Getting an error when downloading something and getting a server error (I think). Even with --ignore-errors it still attempts to write a None object to the file.

Traceback (most recent call last):
  File "C:\Users\Astrid\scoop\apps\python\current\Scripts\waybackpack-script.py", line 11, in <module>
    load_entry_point('waybackpack==0.3.6', 'console_scripts', 'waybackpack')()
  File "c:\users\astrid\scoop\apps\python\3.8.5\lib\site-packages\waybackpack\cli.py", line 104, in main
    pack.download_to(
  File "c:\users\astrid\scoop\apps\python\3.8.5\lib\site-packages\waybackpack\pack.py", line 91, in download_to
    f.write(content)
TypeError: a bytes-like object is required, not 'NoneType'

Adding if content: around the last with block in pack.py fixes this, but I'm not sure whether this is the correct solution or not.

jsvine commented 3 years ago

Thanks! Should be fixed now via commit above, and available in v0.3.7.