-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
streaming.py crash #18
Comments
You can somehow "catch all exception" and set self.running = True so that it won't stop. But I second it. I notice similar bug as well. (Not sure why httplib.IncompleteRead was raised). Python bug? |
This issue has been persistant for me as well with several apps that I've built using Tweepy. I've patched it in my latest one and been gracefully allowed to share it back - I've checked it in, and will submit a pull request if it's stable and doesn't reappear. If you'd like to see it, you can check out my edit: sclm/tweepy@8fbbc84ea1abf0f6273fc87f07f5d1bb6c5b6f99 |
Hi Scim, I look your patch, and I have a little concern about it. Once you catch a IncompleteRead, the next line become: What do you think? |
The following is my solution:
|
The concern I have with your solution is that it fails to report the issue, suppressing it completely. I only ever encountered the incomplete read, and from what I've been able to discern is occurs when trying to grab the data from a connection that Twitter has broken on their end or has timed out. I can't promise that's the root cause, but that has been consistent with everything I've seen. Consequently the goal of my code was to get it to drop out and reset the stream completely. Reconnecting to Twitter and hitting the error logic for those cases. I think a wise alteration would be to move the try....except block I added to be more inclusive, to the outside of the outer loop and convert the break to a pass. In this case it would prevent the entire application from failing, but that function would terminate and the _read function would handle it appropriately. |
Downloaded streamwatcher.py from tweepy-examples. Sometimes, after a day of running, it crashes with the following (I commented out lines 117->119 in stremaing.py to catch the exception):
Traceback (most recent call last):
File "webapps/siti/mex/scripts/mystreamwatcher.py", line 68, in
myfunc()
File "webapps/siti/mex/scripts/mystreamwatcher.py", line 63, in myfunc
stream.filter(followed)
File "/home/user/webapps/siti/mex/scripts/tweepy/streaming.py", line 195, in filter
self._start(async)
File "/home/user/webapps/siti/mex/scripts/tweepy/streaming.py", line 160, in _start
self._run()
File "/home/user/webapps/siti/mex/scripts/tweepy/streaming.py", line 111, in _run
self._read_loop(resp)
File "/home/user/webapps/siti/mex/scripts/tweepy/streaming.py", line 140, in _read_loop
c = resp.read(1)
File "/usr/local/lib/python2.6/httplib.py", line 517, in read
return self._read_chunked(amt)
File "/usr/local/lib/python2.6/httplib.py", line 563, in _read_chunked
raise IncompleteRead(value)
httplib.IncompleteRead
The text was updated successfully, but these errors were encountered: