glenng910
Posts: 15
Joined: Mon Nov 19, 2018 12:59 am

Twython Incomplete Read HTTP Chunk Encoding Error

Mon Nov 19, 2018 1:07 am

I am trying to run a Twitter Stream using Python 3 and Twython on the Raspberry Pi 3. When I run it on the development machine (Windows 10 desktop) under Anaconda window. it runs fine. I receive the chunk encoding error once every few days. When I move it to the Pi, I get the error a few times every hour. I also see garbled messages on occasion. I am not sure how to handle the problem. I posted it on Stack Overflow a few days ago and no one replied. The link is here:

https://stackoverflow.com/questions/533 ... r-python-3

This code will usually trigger an on_error method if there is a problem, but in my case it does not. I had to enclose the stream in a try block to prevent it from crashing completely.

Code: Select all

  ## try to ignore http errors crashing the system
    while True:
       try:
            stream.statuses.filter(follow=users, language = 'en')        
 
        except:
            e = sys.exc_info()[0]  
            print('ERROR:',e ) 
            continue
I would welcome suggestions

DirkS
Posts: 10347
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Twython Incomplete Read HTTP Chunk Encoding Error

Mon Nov 19, 2018 8:45 am

glenng910 wrote:
Mon Nov 19, 2018 1:07 am
I would welcome suggestions
What kind of suggestions do you expect?
If you can't do anything about the error and it doesn't affect the outcome then just ignore it.

You can catch specific errors:

Code: Select all

try
    code that causes the error
except exceptioncode:
    pass
If you can't just ignore it then you could do something else instead of a 'pass'

glenng910
Posts: 15
Joined: Mon Nov 19, 2018 12:59 am

Re: Twython Incomplete Read HTTP Chunk Encoding Error

Mon Nov 19, 2018 9:51 am

I can ignore it on the PC, but not on the Raspberry Pi. On the PI, not only are the errors numerous, the info in the incoming stream is garbled- rendering the entire application useless.

smithy1155
Posts: 15
Joined: Wed Mar 23, 2016 12:42 pm

Re: Twython Incomplete Read HTTP Chunk Encoding Error

Sun Dec 02, 2018 1:00 pm

can i make a suggestion, have you thought that it could be emojis?. i've used Twython my self, and it always got an encoding error when an emoji was used

Return to “Python”