2016-08-03 121 views
2

我試圖將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>)

請教我如何解決這個問題。

回答

3

使用collection.find()時使用相同的問題,使用的參數是而不是timeout」。

正確的參數是no_cursor_timeout」。該參數將避免遊標超時異常。用法

例子:

collection.find(no_cursor_timeout=True) 

這將避免你的(可能)原始異常:

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

PD:我會,如果你沒有使用上收集查找更新我的答案。如果這沒有幫助,請使用示例os用法更新您的問題。

相關問題