linux - 类型错误 : __init__() got an unexpected keyword argument 'timeout' pymongo

标签 linux python-2.7 pymongo rhel

我正在尝试将 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/

相关文章:

c - 如何开始调试?

python - 统一码编码错误 : 'latin-1' codec can't encode character '\u2013' in position 637: ordinal not in range(256)

python - 这段代码片段中 plt 指的是什么

mongodb - PyMongo 事务错误 :Transaction numbers are only allowed on a replica set member or mongos

java - 使用 Linux 服务器的凭据连接到 AD

c++ - SCTP recvmsg返回EFAULT(错误地址)

python - 带有gevent的mongoengine,如何关闭/结束连接?

mongodb - 如何在 MongoDB 中执行超前和滞后

c++ - Linux MinGW : on compiling he output list of 8 "nultiple definitions"

python - 如何删除包含重复第一个元素的二维列表中的那些一维列表?