我正在尝试将 facebook 数据提取到 mongoDB 中。我在linux环境(RHEL)上使用python 2.7.3和pymongo-3.3.0,在提取数据时,出现以下错误。
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() 时遇到同样的问题,并且要使用的参数不是“超时”。
正确的参数是“no_cursor_timeout”。该参数将避免光标超时异常。
使用示例:
collection.find(no_cursor_timeout=True)
这将避免您(可能)最初的异常:
pymongo.errors.CursorNotFound: Cursor not found, cursor id:
PD:如果您不使用集合上的查找,我将更新我的答案。如果这没有帮助,请使用示例操作系统使用情况更新您的问题。
关于linux - 类型错误 : __init__() got an unexpected keyword argument 'timeout' pymongo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38735225/