Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ValueError: No JSON object could be decoded #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
phikui opened this issue Sep 11, 2015 · 4 comments
Closed

ValueError: No JSON object could be decoded #63

phikui opened this issue Sep 11, 2015 · 4 comments
Assignees

Comments

@phikui
Copy link

phikui commented Sep 11, 2015

I get crashes every once in awhile with the newest version:

ERROR:root:main loop:
Traceback (most recent call last):
File "./telegram-bot.py", line 485, in main
exit = parse(bot)
File "./telegram-bot.py", line 516, in parse
for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10):
File "/usr/local/lib/python2.7/site-packages/telegram/bot.py", line 123, in decorator
result = func(self, _args, *_kwargs)
File "/usr/local/lib/python2.7/site-packages/telegram/bot.py", line 653, in getUpdates
result = request.post(url, data)
File "/usr/local/lib/python2.7/site-packages/telegram/utils/request.py", line 96, in post
message = _parse(error.read())
File "/usr/local/lib/python2.7/site-packages/telegram/utils/request.py", line 45, in _parse
data = json.loads(json_data.decode())
File "/usr/local/lib/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

@leandrotoledo
Copy link
Member

Uhm, this is probably the Bad Gateway error (HTTP 504), but because parse
expects a JSON it fails to decode the HTML.

I'll patch it up and bump this thread again once released.
Em 11/09/2015 2:35 PM, "phikui" [email protected] escreveu:

I get crashes every once in awhile with the newest version:

ERROR:root:main loop:
Traceback (most recent call last):
File "./telegram-bot.py", line 485, in main
exit = parse(bot)
File "./telegram-bot.py", line 516, in parse
for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10):
File "/usr/local/lib/python2.7/site-packages/telegram/bot.py", line 123,
in decorator
result = func(self, _args, *_kwargs)
File "/usr/local/lib/python2.7/site-packages/telegram/bot.py", line 653,
in getUpdates
result = request.post(url, data)
File "/usr/local/lib/python2.7/site-packages/telegram/utils/request.py",
line 96, in post
message =

_parse(error.read()) File
"/usr/local/lib/python2.7/site-packages/telegram/utils/request.py", line
45, in parse data = json.loads(json_data.decode()) File
"/usr/local/lib/python2.7/json/_init.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


Reply to this email directly or view it on GitHub
#63.

@leandrotoledo
Copy link
Member

@leandrotoledo But, to confirm, would you mind to add print (json_data) right after raise TelegramError on yours request.py?

@leandrotoledo
Copy link
Member

Not sure I mentioned my self, but it was for you @pkikui

@leandrotoledo leandrotoledo self-assigned this Sep 18, 2015
leandrotoledo added a commit that referenced this issue Sep 24, 2015
Handles HTTP Bad Gateway error (503) on request module #63
@leandrotoledo
Copy link
Member

Released on v2.8.5, please update to latest version.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants