MongoKit “ImportError: No module named objectid ” error

后端 未结 2 647
粉色の甜心
粉色の甜心 2021-01-12 13:56

I get some very strange error using MongoKit:

>>> from mongokit import *
Traceback (most recent call last):
  File \"\", line 1, in <         


        
相关标签:
2条回答
  • 2021-01-12 14:14

    As Electro said, it's a Bug.

    I used the following dirty little hack to keep my site running until it is fixed:

    import sys
    import pymongo
    import bson.objectid
    pymongo.objectid = bson.objectid
    sys.modules["pymongo.objectid"] = bson.objectid
    
    0 讨论(0)
  • 2021-01-12 14:26

    It's an error in the dependencies. As of PyMongo 1.11 objectid lives in the bson module, not pymongo.

    0 讨论(0)
提交回复
热议问题