Reputation: 5257
I have a Mongo server running on an Ubuntu box, and I am trying to connect to it with pymongo using the usual syntax:
from pymongo import Connection
c = Connection('db.example.com', 27017)
This works just fine on a recent-model Intel mac (OS 10.6). However, the same code on an older G5 tower (10.5) throws this error:
pymongo.errors.AutoReconnect: [Errno 54] Connection reset by peer
The mongo output on the server reports:
connection accepted from oldmac.example:57681 #3
bad recv() len: 973078528
end connection oldmac.example:57681
I know that I cannot run the mongodb server from the PPC Mac, but it seems odd that I wouldn't be able to connect to the remote database. Or is something else at fault?
Upvotes: 3
Views: 7079
Reputation: 41
I was facing the same issue with python3.8, i tried to upgrade and downgrade the pymongo but the result was same Connection reset by peer.
To overcome this problem uninstall the python3.8 and install python3.7 and it work fine. Now i am able to connect to the mongodb and able to perform query.
Upvotes: 0
Reputation: 8000
I was able to solve this same issue by using MongoClient
instead of the deprecated Connection
.
Warning DEPRECATED: Connection is deprecated. Please use MongoClient instead.
For more information, see the new MongoClient documentation for Python.
Upvotes: 0
Reputation: 4069
Looks like Mike Dirolf already answered your question in the MongoDB Google Group. But for people experiencing the same issue and find themselves on this page, the solution from Mike Dirolf:
Are you using the C extension? (try pymongo.has_c()). I wouldn't think that the C extension would even build on PPC but if it did that is almost certainly the reason this isn't working. You can install w/o C with
python setup.py install --no_ext
and then I'd expect things to work.-- Mike Dirolf
Upvotes: 2