typeerror:__init __()得到了一个意外的关键字参数'timeout'pymongo

问题描述:

我试图将facebook数据提取到mongoDB中。我在Linux环境(RHEL)上使用python 2.7.3和pymongo-3.3.0,同时提取数据,出现以下错误。typeerror:__init __()得到了一个意外的关键字参数'timeout'pymongo

Exception AttributeError: "'Cursor' object has no attribute '_Cursor__id'" in <bound method Cursor.__del__ of <pymongo.cursor.Cursor object at 0x48fa110>> ignored (<type 'exceptions.TypeError'>, TypeError("__init__() got an unexpected keyword argument 'timeout'",),<traceback object at 0x490a638>)

请教我如何解决这个问题。

使用collection.find()时使用相同的问题,使用的参数是而不是timeout”。

正确的参数是no_cursor_timeout”。该参数将避免游标超时异常。用法

例子:

collection.find(no_cursor_timeout=True) 

这将避免你的(可能)原始异常:

pymongo.errors.CursorNotFound: Cursor not found, cursor id: 

PD:我会,如果你没有使用上收集查找更新我的答案。如果这没有帮助,请使用示例os用法更新您的问题。