Exception JSONDecodeError
See original GitHub issueI get this error when I try to run the script:
Traceback (most recent call last):
File "main.py", line 232, in <module>
org_boards_data['me'] = requests.get(my_boards_url).json()
File "/usr/local/lib/python3.5/site-packages/requests/models.py", line 826, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/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)
- I have double checked that the environment variables are set.
- I have installed requests via “pip3 install requests”
- I’m running python 3.5.2 on Mac OS X El Capitan installed via homebrew (python3)
Any idea? thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
python - Handle JSON Decode Error when nothing returned
It means that you should catch exceptions instead of checking values for validity. ... JSONDecodeError print('Decoding JSON has failed').
Read more >Python JSONDecodeError Explanation and Solution | CK
A Python JSONDecodeError indicates there is an issue with the way in which your JSON data is formatted. For example, your JSON data...
Read more >json — JSON encoder and decoder — Python 3.11.1 ...
This can be used to raise an exception if invalid JSON numbers are encountered. ... is not a valid JSON document, a JSONDecodeError...
Read more >Python JSON tricks: how to deal with JSONDecodeError
Trick 1: You should use double quotes for keys and values, otherwise you will have the JSONDecodeError error: To solve this error, you...
Read more >Python json.JSONDecodeError() Examples - ProgramCreek.com
JSONDecodeError : logging.info( "Protocol message was ignored because it was not valid JSON.", ) except: logging.exception("Exception when handling protocol ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
Quickest way to debug it would be to add a print statement to display the my_board_url variable to check its value. It should be something like this: https://api.trello.com/1/members/me/boards?key=YOUR_KEY&token=YOUR_TOKEN Paste the URL in a web browser to see what you get. Could it be related to the environment variables being reset when restarting the shell?
Let me know if it helps!
I’ve had this happen intermittently, with a large board where sometimes the API fails with status 504 Gateway Timeout.
I’ve created https://github.com/jtpio/trello-full-backup/pull/37 which makes it a bit clearer what’s happening by raising an HTTPError instead of JSONDecodeError. (It was trying to JSON-decode the HTML error body.)