我最近升级到 pymongo 3.0 并且遇到了这里提到的相同错误。接受的答案修复了读取首选项错误,我的应用程序正在运行。但是,每当我尝试运行查询时,我现在都会收到一个新错误,并且想知道是否有其他人遇到过这个问题。
这是追溯。
Traceback (most recent call last):
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask_login.py", line 756, in decorated_view
elif not current_user.is_authenticated():
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/werkzeug/local.py", line 338, in __getattr__
return getattr(self._get_current_object(), name)
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/werkzeug/local.py", line 297, in _get_current_object
return self.__local()
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask_login.py", line 46, in <lambda>
current_user = LocalProxy(lambda: _get_user())
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask_login.py", line 794, in _get_user
current_app.login_manager._load_user()
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask_login.py", line 363, in _load_user
return self.reload_user()
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/flask_login.py", line 325, in reload_user
user = self.user_callback(user_id)
File "/mongo_login/mongo_login/app/auth/views.py", line 79, in load_user
user.get_by_id(id)
File "/mongo_login/mongo_login/app/auth/users.py", line 23, in get_by_id
dbUser = models.User.objects.with_id(id)
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/mongoengine/queryset/base.py", line 600, in with_id
return queryset.filter(pk=object_id).first()
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/mongoengine/queryset/base.py", line 309, in first
result = queryset[0]
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/mongoengine/queryset/base.py", line 160, in __getitem__
return queryset._document._from_son(queryset._cursor[key],
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/mongoengine/queryset/base.py", line 1410, in _cursor
**self._cursor_args)
File "/mongo_login/mongo_login_env/lib/python2.6/site-packages/pymongo/collection.py", line 929, in find
return Cursor(self, *args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'snapshot'