我有以下问题:
我写了一个 FTPHandler(StreamHandler),它通过 'transport=paramiko.Transport(...)' 和 'transport.connect(...)' 连接到服务器,并打开一个 sftp 连接与 'SFTPClient.from_transport(.. .)'。
我将这个处理程序导入一个名为“JUS_Logger.py”的类中,这是我的日志记录模块。此“FMP_Logger”由另一个类“JUS_Reader”导入。
问题是,如果我启动“JUS_Reader”,传输正在初始化,但连接失败。也不例外,程序只是挂起。如果我杀了它,我会得到堆栈跟踪
CTraceback (most recent call last):
File "./JUS_Reader.py", line 24, in <module>
from JUS_Logger import logger
File "/<home>/.../JUS_Logger.py", line 74, in <module>
ftpHandler=FTPHandler(ftpOut,10)
File "/<home>/FTPHandler.py", line 21, in __init__
self.transport.connect(username=ftpOut['user'].decode('base64'),password=ftpOut['passwd'].decode('base64'))
File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1004, in connect
self.auth_password(username, password)
File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1165, in auth_password
return self.auth_handler.wait_for_response(my_event)
File "/usr/lib/python2.7/dist-packages/paramiko/auth_handler.py", line 158, in wait_for_response
event.wait(0.1)
File "/usr/lib/python2.7/threading.py", line 403, in wait
self.__cond.wait(timeout)
File "/usr/lib/python2.7/threading.py", line 262, in wait
_sleep(delay)
但是,如果我自己运行“JUS_Logger.py”,一切正常,传输连接建立,SFTClient 也连接。
有任何想法吗?或者进一步的问题?