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
AttributeError: 'NoneType' object has no attribute 'strip' #698
Comments
Another one, Traceback (most recent call last):
File "engine/twitter.py", line 139, in <module>
stream.filter(track=['#blood',], languages=['en'])
File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 445, in filter
self._start(async)
File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 361, in _start
self._run()
File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 263, in _run
self._read_loop(resp)
File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 324, in _read_loop
self._data(next_status_obj)
File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 297, in _data
if self.listener.on_data(data) is False:
File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 50, in on_data
data = json.loads(raw_data)
File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer |
This patch fixes it for me.
|
I am getting this too. I hope you won't be against it @rxcomm if I add this as a pull request |
I'm also getting this. |
it's fixed in #694 , nobody is merging PR here |
If the stream is closed while reading, act as if it was closed before reading began. This resloves tweepy#576, resloves tweepy#698 and resolves tweepy#734. Similar to tweepy#694, tweepy#780.
In streaming.py at line# 313: when buf.read_line() is called, it may return NoneType and when applying strip() it will generate AttribiteError. Hence to fix this placing the line into try-except block.
Still affects me. Hoping a new version is posted to PyPI soon! |
I just got this error. Somebody please give somebody access to this repo so they can PR and also post to PyPI |
@Aaron1011 (as you closed the issue) can you clarify if the fix was applied/posted to PyPI? I've been running a data collection script since January and, checking the logs, its been hitting this issue pretty regularly. Not sure what the commonality is between the erroring tweets either. |
Hello @joshua-barber, Were you able to catch the error, at least? I'm thinking of a work around for my project wherein I will just catch this particular error and just restart the stream data collection. Not the nicest solution, but it'll work for me. Regards, Paul |
@patrick-brian-mooney @wuhland @joshua-barber @paldana |
i've been getting this error for a while.
The text was updated successfully, but these errors were encountered: