You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.
In modern versions of pymongo, they've abandoned support for Python 2, and removed the py3 compatibility libraries. This means that in mongoengine-goodjson 1.1.8,
from bson import (
ObjectId, DBRef, RE_TYPE, Regex, MinKey, MaxKey, Timestamp, Code, Binary,
PY3, SON
)
from bson.py3compat import text_type, string_type
will fail because of PY3 and bson.py3compat no longer existing. For example:
>>> import pymongo
>>> pymongo.__version__
'4.0'
>>> import mongoengine_goodjson
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/appuser/conda/envs/esg_web/lib/python3.10/site-packages/mongoengine_goodjson/__init__.py", line 6, in <module>
from .encoder import GoodJSONEncoder
File "/home/appuser/conda/envs/esg_web/lib/python3.10/site-packages/mongoengine_goodjson/encoder.py", line 16, in <module>
from bson import (
ImportError: cannot import name 'PY3' from 'bson' (/home/appuser/conda/envs/esg_web/lib/python3.10/site-packages/bson/__init__.py)
At this point I think losing support for 2.7 entirely would be more than justified, but if it's desired to preserve that, we can simply embed the few lines that are actually being used:
For what it's worth, I'm using the current master branch and it works fine for my use case (I'm only using the Document document). I just had to change my import statement to
from mongoengine_goodjson.document import Document as gjDocument
and have my documents inherit from gjDocument.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In modern versions of pymongo, they've abandoned support for Python 2, and removed the py3 compatibility libraries. This means that in mongoengine-goodjson 1.1.8,
will fail because of PY3 and bson.py3compat no longer existing. For example:
At this point I think losing support for 2.7 entirely would be more than justified, but if it's desired to preserve that, we can simply embed the few lines that are actually being used:
and leave everything else alone.
To work around this, right now I'm having to do something like
on the client side (as well as a
collections.Iterable = collections.abc.Iterable
elsewhere, to deal with that issue) but obviously that's not optimal.The text was updated successfully, but these errors were encountered: