Exception AttributeError: “‘NoneType‘ object has no attribute ‘error‘“ in <bound method Connection._

使用redis 3.5.2 ,自己写了一个redis工具类,外部的python的脚本去调他,在脚本执行完之后, 提示该错误。

原因:

真正报错的位置在:

connection.py 中
Exception AttributeError: “‘NoneType‘ object has no attribute ‘error‘“ in <bound method Connection._

Exception AttributeError: “‘NoneType‘ object has no attribute ‘error‘“ in <bound method Connection._

 

Exception AttributeError: “‘NoneType‘ object has no attribute ‘error‘“ in <bound method Connection._

Stack Overflow大神做出了解释:os 模块在调用Connection.__del__之前已经被卸载了,打印了一下,确实是None。

解决的办法,在对redis操作完之后,主动  conn.connection_pool.disconnect() ,

或者更新redis包到3.5.3:

Exception AttributeError: “‘NoneType‘ object has no attribute ‘error‘“ in <bound method Connection._

如图,3.5.3中 os异常被捕获了。

 

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-25
  • 2021-06-13
  • 2022-01-08
  • 2022-01-29
  • 2021-11-20
  • 2021-07-31
相关资源
相似解决方案