我是Python和BuildBot的全新用户。当前我正在使用电子邮件警报 当BuildBot生成状态发生更改(从“成功”更改为“失败”,或反之亦然),并且每次生成失败时都会发送电子邮件。我在尝试发送电子邮件时遇到以下Python错误。在
--- <exception caught here> ---
**ESMTPClient.__init__(self, secret, contextFactory, *args, **kw)
exceptions.TypeError?: unbound method init() must be called with ESMTPClient
instance as first argument (got ESMTPSender instance instead)**
我在网上找到了一些这个错误的例子,包括
You just need to pass 'self' as an argument to 'Thread.init' and calling the super class
但我仍然不确定为什么会出错。如果您能提供任何指导/帮助,说明为什么会出现此错误,以及如何着手解决该问题,我将不胜感激。我不是这段代码的作者,所以我不确定要寻找什么来解决这个问题。在
在以下代码从gmail帐户更改为公司帐户之前,该电子邮件正在工作。在
^{pr2}$以下是生成异常的代码块:
class ESMTPSender(SenderMixin, ESMTPClient):
requireAuthentication = True
requireTransportSecurity = True
def __init__(self, username, secret, contextFactory=None, *args, **kw):
self.heloFallback = 0
self.username = username
if contextFactory is None:
contextFactory = self._getContextFactory()
ESMTPClient.__init__(self, secret, contextFactory, *args, **kw)
self._registerAuthenticators()
SSA公司
这似乎是一个很难出现的异常,通常除非从其他类继承,否则通常不会显式调用
__init__
。有一种情况下,您可能会得到这个错误:要解决此问题,我们可以使
^{pr2}$Bar
从Foo
继承:如果将
Bar
从Foo
子类化是没有意义的,那么可以将公共代码分解成一个单独的函数:虽然这种问题很难诊断,如果没有实际看到产生错误的代码。在
相关问题 更多 >
编程相关推荐