Forums

socket.error: [Errno 104] Connection reset by peer

Hello,

I am getting a socket.error: [Errno 104] Connection reset by peer message when running a python 2.7 script with Selenium. The script gets about half way through and consistently throws this error at the same point each time.

However, when running the identical script (minus the Virtual Display bit) locally it runs to completion without any errors on Mac and Windows.

Does anybody have any ideas why I would get this error on pythonanywhere or advice on how to cure it? It's a bit tricky to debug since it works perfectly on my local dev systems. I have tried restructuring the script, adding in sleep commands at various points etc but to no avail.

Thanks!

Is it when you try to load a URL in the browser? If it is, can you access the URL using wget or curl from a PythonAnywhere console?

Interesting, it seems wget pulls down an empty file for that particular page yet for other pages from the site I am interested in wget gets the full page contents.

The problematic url is loading fine in my Firefox browsers locally in Windows and OSX and through Selenium / Firefox locally as well. Any thoughts on why it's struggling when run through pythonanywhere?

In the meantime though, I suppose I can do that url manually until I find a workaround

That is strange. Nothing springs to mind -- unless they've for some reason decided to do something funny based on the IP address the request is coming from? That would be pretty weird, though, if it's only affecting one URL on the site.

Yes is odd but for the moment I have found another source for the data. Will let you know if I find a workaround / bump into the problem again

OK, thanks!