6

pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 8] nodename nor servname provided, or not known

When I try to insert data into mongodb, the error appears.

mongodb service is already started.

I can't open 'localhost' only on Safari, can open it on Chrome.(can open '127.0.0.1' on both).

my hosts '127.0.0.1 localhost'

eason
  • 61
  • 1
  • 4

2 Answers2

1

This is a pymongo configuration error. Make sure dnspython module is installed:

pip install dnspython
ttfreeman
  • 4,164
  • 2
  • 21
  • 31
-1

I had to specify at the first argument in my connection string: "mongodb+srv":