Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* fixed broken ObjectId import for pymongo 1.11 #130

Closed
wants to merge 1 commit into from

Conversation

endyman
Copy link

@endyman endyman commented May 7, 2012

as of pymongo 1.11 objectid now lives in bson:

http://api.mongodb.org/python/1.11/api/index.html

this fixes mongodb-engine support for pymongo 1.11
error prior to this patch when running ./manage.py syncdb:

File "/Users/nido/dev/python/django/damn-cms/src/django-mongodb-engine/django_mongodb_engine/fields.py", line 4, in
from pymongo.objectid import ObjectId
ImportError: No module named objectid

@flaper87
Copy link
Member

flaper87 commented May 7, 2012

It isn't backward compatible. Try adding the from pymongo.objectid import ObjectIdline inside a try / except and catch the ImportError. If that error is raised then try the new import style.

Cheers.

@charettes
Copy link
Member

Looks like #128 missed some imports. Can you make sure it's the last reference to pymongo.objectid in the codebase?

Please re-open a new pull request against develop branch.

@charettes charettes closed this May 7, 2012
@johnkoshy
Copy link

johnkoshy commented Nov 10, 2023

for me after installing pymongo solved my issue:
pip3 install pymongo

source: https://kb.objectrocket.com/mongo-db/how-to-install-pymongo-and-connect-to-mongodb-in-python-363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants