KichangKim / DeepDanbooru

AI based multi-label girl image classification system, implemented by using TensorFlow.
MIT License
2.65k stars 260 forks source link

requests.exceptions.JSONDecodeError #80

Open mcilrain opened 1 year ago

mcilrain commented 1 year ago

I tried following the readme but got this error when doing the download-tags part after supplying username and API key (which isn't mentioned in the readme), occurs on both Linux (Python 3.9) and Windows (Python 3.8):

Start downloading tags ... (limit:10000, minimum_post_count:500)
general tags are downloading ...
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/deepdanbooru", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/deepdanbooru/__main__.py", line 42, in download_tags
    dd.commands.download_tags(
  File "/usr/local/lib/python3.9/site-packages/deepdanbooru/commands/download_tags.py", line 144, in download_tags
    tags = download_category_tags(
  File "/usr/local/lib/python3.9/site-packages/deepdanbooru/commands/download_tags.py", line 45, in download_category_tags
    response_json = response.json()
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
KichangKim commented 1 year ago

Danbooru's cloudfront changes its behaviour. I fixed it, try latest revision. Also changed README.md too.

Asmedeus998 commented 4 months ago

@KichangKim this error happen again do you have a fix for this?

KichangKim commented 4 months ago

The behaviour of danbooru's cloudfrount is changed. I fixed it. (ab90ef3b8d)