python - Collection object is not callable error in PyMongo with server_info() -
i upgrading working django project python3.4. after deploying, got following issue!
(the same project works fine under python2.7
pymongo2.8
flavour.)
i have pymongo3.2
& django-mongo-sessions
along other libraries
file "/home/ec2-user/py33/local/lib/python3.4/site-packages/mongo_sessions/session.py", line 8, in <module> mongo_sessions import settings file "/home/ec2-user/py33/local/lib/python3.4/site-packages/mongo_sessions/settings.py", line 36, in <module> mongo_db_version = mongo_client.connection.server_info()['version'] file "/home/ec2-user/py33/local/lib64/python3.4/site-packages/pymongo/collection.py", line 2348, in __call__ self.__name.split(".")[-1]) typeerror: 'collection' object not callable. if meant call 'server_info' method on 'collection' object failing because no such method exists.
i looked this issue looks similar. i'm pretty sure i'm using pymongo3.2
itself!
it looks django-mongo-sessions has not been updated support pymongo 3.x. particular problem database.connection renamed database.client in pymongo 3.0. failing line of code should changed to:
mongo_db_version = mongo_client.client.server_info()['version']
that's not required change. see migration guide details.
Comments
Post a Comment