I\'m using:
I had the same problem with Pymongo 3.5 Turns out replacing localhost with 127.0.0.1 or corresponding ip address of your mongodb instance solves the problem.