urschrei / pyzotero

Pyzotero: a Python client for the Zotero API
https://pyzotero.readthedocs.org
Other
911 stars 100 forks source link

JSONDecodeError on EPUB Downloads #80

Closed MerlinB closed 6 years ago

MerlinB commented 6 years ago

General

Platform: Linux Python version: 3.6.5 Pyzotero version: 1.3.1

Problem description

I get an JSONDecodeError when using Zotero.file(). Curiously, this only seems to happen with epub files, pdf and mobi work fine.

Traceback (most recent call last):
  File "/home/merlin/Documents/scholarium.at/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/merlin/Documents/scholarium.at/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/merlin/Documents/scholarium.at/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/merlin/Documents/scholarium.at/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/merlin/Documents/scholarium.at/Produkte/views.py", line 343, in medien_runterladen
    medium = zot.file(getattr(obj, art))
  File "/home/merlin/Documents/scholarium.at/venv/lib/python3.6/site-packages/pyzotero/zotero.py", line 192, in wrapped_f
    return retrieved.json()
  File "/home/merlin/Documents/scholarium.at/venv/lib/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
urschrei commented 6 years ago

Oops. Fixed in 1.3.2, released on PyPI.