【发布时间】:2015-04-22 14:24:36
【问题描述】:
我有一个 python 脚本,它同时使用多个 SSH 链接到多个远程服务器。有时当脚本完成时,我想在垃圾收集期间,我得到了这个异常:
Exception in thread Thread-7 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1574, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'
Exception in thread Thread-5 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1574, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'
Exception in thread Thread-4 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1574, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1574, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'
我搜索了Exception in thread Thread-7 (most likely raised during interpreter shutdown),发现有时在多线程脚本中杀死线程会导致此异常。这对我来说真的很奇怪,因为我的脚本中没有线程。另一方面,它似乎与paramiko 有关,我很确定我不使用线程来创建 SSH 链接;我只有多个打开的 shell 连接到多台服务器(可能不止一个 shell 连接到一台特定的服务器)。知道异常的来源吗??
【问题讨论】:
-
@DanielPryden,是的!问题似乎是一样的!感谢您指出。
标签: python exception paramiko python-multithreading