title: from pymongo.objectid import ObjectId ImportError: No module named objectid
body: <p>I made an python code that fetch tweets from Mongo collection called Tweets. I wan't to fetch only the object text and add an additional object called Sentiment.</p>
  
  <p>When i loop through the Tweets and parse the json object to a string i get the error :  </p>
  
  <p><strong>from pymongo.objectid import ObjectId ImportError: No module named objectid</strong> </p>
  
  <p>Therefor i use the following code</p>
  
  <pre><code>import pymongo
  import nltk
  import json
  from json import JSONEncoder
  from pymongo import MongoClient
  from pymongo.objectid import ObjectId
  
  #JSON Encoder
  class MongoEncoder(JSONEncoder):
      def default(self, obj, **kwargs):
          if isinstance(obj, ObjectId):
              return str(obj)
          else:            
              return JSONEncoder.default(obj, **kwargs)
  
  #Mongo Settings
  client = MongoClient()
  db = client.Sentiment
  Tweets = db.Tweet
  TweetTraining = db.TweetTraining
  
  #GET TEXT_TAG FROM TWEET
  for tweet in Tweets.find({"lang":"nl"},{"text"}):
    print json.dumps(tweet, cls=MongoEncoder)
  </code></pre>
  
  <p>I hope that you can help me out. Many thanks</p>
  
  <p>Erik</p>