Click here to Skip to main content
15,031,937 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
What does this error mean in python? Like what is actually happening?

What am I messing with because it seems greater than my current knowledge scope.

ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
Updated 2-Sep-20 23:05pm

Read to error message, it is first help.
An existing connection ...
Tells you that there was already an active connection at the place of error where you probably try to open a second one.
PythonHeadBanger 27-Nov-15 18:13pm
Thank you. Any ideas on common solutions to this error?

I'm learning the the Python Requests module to figure out how to solve the situation.
Patrice T 27-Nov-15 18:21pm
Common solution is obvious: Never try to open more than 1 connection.
Problem and solution are in your code.
PythonHeadBanger 27-Nov-15 18:28pm
If one is using a loop to open multiple websites... how might one slow it down such that only one connection is open at a time?
Patrice T 27-Nov-15 18:40pm
1 connection per server.
PythonHeadBanger 28-Nov-15 13:35pm
Any keywords I should google? Thank you!
Patrice T 28-Nov-15 15:52pm
start with the error message
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
PythonHeadBanger 28-Nov-15 17:07pm
lol this page is the fourth result!
What's actually happening is the server on the otherside of the request is closing the connection.

It's possible that the problem lies on the server side.

I've tried inserting
which kind of seems to help. I'd really rather not be inserting seconds into the run time though.

Final update and solution achieved. Given the possibility of a serverside malfunction or misbehavior I changed my IP address. My code compiles and runs as it did last week.[^]

FTP Socket Error Code 10054

Additionally, if you are encountering any FTP related issues, we strongly suggest that you test the transmission with other FTP clients. This is a good method in determining the root of the problem. Keep in mind that when you are having similar problematic behavior in multiple clients against the same server, it's more than likely a server problem
Connection reset by peer.
An existing connection was forcibly closed by the remote host. This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, the host or remote network interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the SO_LINGER option on the remote socket). This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress. Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.</pre>

I had a similar problem when I tried to connect to MongoDb Atlas via pymongo. There are 3 things you can do to solve this issue:

1. Install dnspython
2. Install checkdmarc 4.2.3
3. Go to you data base host, in my case it is MongoDB Atlas, and allow access to your database from anywhere. In the end, the IP on your host should look like this

I did all these steps and it is working for me. I hope this helps.
proxy configuration issue if you are trying this from inside a firewalled Corporate network.
It's a bug.[^]

The article says it's with SQL on Azure but if you look around the internet it's more than obvious that it's not just on Azure.

To work around this issue, use one of the following methods:
* Click Last record as soon as the table is opened in order to display all records in the linked table in the Datasheet View of Access.
* Do not select all records in the linked table to be displayed. Instead, select only a limited number of records.
Richard Deeming 18-Sep-18 13:03pm
Why would you think that a KB article about MS Access would be applicable to an already-solved question about Python?!
I had the same issue. Turns out I was connected to the VPN, due to which the ot was giving error.
Closed the VPN and downloaded the packages.

Happy Coding!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900