3
python模块paramiko抛出奇怪的异常,如图所示。最后我发现它在模块日志记录中真正发生的位置。当我用pydev在Eclipse中的行上设置断点时,并在表达式视图中将下面的行放在下面时,评估值会让我困惑。我想知道在什么情况下可能会发生异常,尽管我认为这是不可能的。python typeerror unbound方法emit必须用streamhandler实例作为fistr参数调用(取而代之的是filehandler实例)
self.__class__ # <class 'logging.FileHandler'>
isinstance(self, FileHandler) # False
isinstance(self, StreamHandler) # False
发射的FileHandler的方法:
def emit(self, record):
"""
Emit a record.
If the stream was not opened because 'delay' was specified in the
constructor, open it before calling the superclass's emit.
"""
if self.stream is None:
self.stream = self._open()
StreamHandler.emit(self, record)
没有足够的上下文来回答这个问题。显示导致此错误的最小程序。 – Daniel 2014-11-08 07:06:22
@Daniel对不起,我还没有找到_context_,但这是我所要求的,以及我一直在挖掘我的项目来寻找。我会在找到其他胶水时更新这篇文章。 – Wizr 2014-11-09 04:14:41