Txredisapi公司异常。运行时错误:超过最大递归深度

2024-06-16 09:30:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试删除除Redis中的某些密钥之外的所有密钥,但确实出现以下异常:

  ... File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twisted/protocols/basic.py", line 572, in dataReceived
    return self.rawDataReceived(data)
  File "build/bdist.macosx-10.6-intel/egg/txredisapi/protocol.py", line 184, in rawDataReceived

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twisted/protocols/basic.py", line 589, in setLineMode
    return self.dataReceived(extra)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twisted/protocols/basic.py", line 564, in dataReceived
    why = self.lineReceived(line)
  File "build/bdist.macosx-10.6-intel/egg/txredisapi/protocol.py", line 134, in lineReceived

exceptions.RuntimeError: maximum recursion depth exceeded

代码如下:

^{pr2}$

当我在Redis中使用大约725个密钥调用resetAll函数时,我触发了异常。如果数字较低,如200等,则不会发射。有人知道发生了什么吗?谢谢。在


Tags: inpybasiclibpackageslinelibrary密钥
1条回答
网友
1楼 · 发布于 2024-06-16 09:30:11

在安装了Python和Git的Linux/Mac计算机终端上尝试以下操作:

cd
git clone https://github.com/andymccurdy/redis-py.git redis-py
cd redis-py
sudo python setup.py install

Behind the scenes, redis-py uses a connection pool to manage connections to a Redis server. By default, each Redis instance you create will in turn create its own connection pool. You can override this behavior and use an existing connection pool by passing an already created connection pool instance to the connection_pool argument of the Redis class.

示例(另存为代尔凯斯.py):

^{pr2}$

记住,我还没有测试过,但是你的评论可能会形成最终的解决方案,或者你可以从这里开始。始终在redis cli中进行监视以确保。在

相关问题 更多 >