Closed stefanhdao closed 7 years ago
I just get this error
Traceback (most recent call last):
File "/opt/pycharm-com-eap/helpers/pydev/pydevd.py", line 1581, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/opt/pycharm-com-eap/helpers/pydev/pydevd.py", line 964, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/daniel/Dropbox/Code/Python/TesFBChat.py", line 19, in <module>
bot.listen()
File "/home/daniel/.local/lib/python2.7/site-packages/fbchat/client.py", line 544, in listen
sticky, pool = self._getSticky()
File "/home/daniel/.local/lib/python2.7/site-packages/fbchat/client.py", line 468, in _getSticky
j = get_json(r.text)
File "/home/daniel/.local/lib/python2.7/site-packages/fbchat/utils.py", line 18, in get_json
return json.loads(re.sub(r"^[^{]*", '', text, 1))
File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
I have the same issue
I'm getting a similar but slightly different error.
>>> c = fbchat.Client('EMAIL', 'PASSWORD')
Logging in...
login successful
>>> c.listen()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/fbchat/client.py", line 544, in listen
sticky, pool = self._getSticky()
File "/usr/local/lib/python3.5/dist-packages/fbchat/client.py", line 468, in _getSticky
j = get_json(r.text)
File "/usr/local/lib/python3.5/dist-packages/fbchat/utils.py", line 18, in get_json
return json.loads(re.sub(r"^[^{]*", '', text, 1))
File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/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)
Fix is written here : https://github.com/carpedm20/fbchat/pull/77
Thanks @Zulex, it seems to fix the bug. I hope it will be merged soon.
Getting the same error as @dstelzer , and @Zulex , the fix you specified does not help either.
Here's the detailed traceback:
JSONDecodeError Traceback (most recent call last)
<ipython-input-116-c759cb92fbd3> in <module>()
----> 1 bot.listen()
/Users/tshrjn/anaconda3/lib/python3.5/site-packages/fbchat/client.py in listen(self, markAlive)
542 # ex_type, ex, tb = sys.exc_info()
543 self.on_message_error(sys.exc_info(), m)
--> 544
545
546 def listen(self, markAlive=True):
/Users/tshrjn/anaconda3/lib/python3.5/site-packages/fbchat/client.py in _getSticky(self)
466 "msgs_recv": 0,
467 "channel": self.user_channel,
--> 468 "clientid": self.client_id
469 }
470
/Users/tshrjn/anaconda3/lib/python3.5/site-packages/fbchat/utils.py in get_json(text)
16
17 def get_json(text):
---> 18 return json.loads(re.sub(r"^[^{]*", '', text, 1))
19
20 def digit_to_char(digit):
/Users/tshrjn/anaconda3/lib/python3.5/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
317 parse_int is None and parse_float is None and
318 parse_constant is None and object_pairs_hook is None and not kw):
--> 319 return _default_decoder.decode(s)
320 if cls is None:
321 cls = JSONDecoder
/Users/tshrjn/anaconda3/lib/python3.5/json/decoder.py in decode(self, s, _w)
337
338 """
--> 339 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
340 end = _w(s, end).end()
341 if end != len(s):
/Users/tshrjn/anaconda3/lib/python3.5/json/decoder.py in raw_decode(self, s, idx)
355 obj, end = self.scan_once(s, idx)
356 except StopIteration as err:
--> 357 raise JSONDecodeError("Expecting value", s, err.value) from None
358 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I tried the fix, and it seemed to work all right. You just need to use the fork... and update to the branch where the fix is (the branch master is identical to the original branch). I hope this fix gets accepted!
HTH,
On 12/4/2016 10:41 AM, Tushar Jain wrote:
Getting the same error as @dstelzer https://github.com/dstelzer , and @Zulex https://github.com/Zulex , the fix you specified does not help either.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/carpedm20/fbchat/issues/72#issuecomment-264721882, or mute the thread https://github.com/notifications/unsubscribe-auth/AB_dog7jFBIj2Z6h5SMA4iEzFX5MaVvQks5rEwlHgaJpZM4Khbwm.
Merged #77
Getting the following error from the listen() function.
With the following lines,
I got this output