python - ImportError: cannot import name MongoClient -


i installed , pymongo first time , had trouble. when running example basic python tutorial on mongodb website response:

traceback (most recent call last):   file "pymongo.py", line 1, in <module>     pymongo import mongoclient   file "/users/user/documents/tweepy scrapers/pymongo.py", line 1, in <module>     pymongo import mongoclient importerror: cannot import name mongoclient 

the code looks this:

from pymongo import mongoclient datetime import datetime  client = mongoclient() db = client.test  result = db.restaurants.insert_one(     {         "address": {             "street": "2 avenue",             "zipcode": "10075",             "building": "1480",             "coord": [-73.9557413, 40.7720266]         },         "borough": "manhattan",         "cuisine": "italian",         "grades": [             {                 "date": datetime.strptime("2014-10-01", "%y-%m-%d"),                 "grade": "a",                 "score": 11             },             {                 "date": datetime.strptime("2014-01-16", "%y-%m-%d"),                 "grade": "b",                 "score": 17             }         ],         "name": "vella",         "restaurant_id": "41704620"     } )  print result.inserted_id 

i'm running python 2.7 , pymongo 3.0.3


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -