0

Buildbotのreporter.MailNotifierを使用して、ビルドごとに簡単な電子メール通知システムをセットアップしようとしています。2 台の Windows コンピューターと 1 台の Linux コンピューターに実装し、同じエラーを再現しました。ここにコードスニペットがあります

from buildbot.plugins import *

c = BuildmasterConfig = {}
#Added workers, protocols, and other configurations

#Test scheduler
c['schedulers'] = [schedulers.Periodic(name="tester", builderNames=["runtest"], periodicBuildTimer=60)]

####### BUILDBOT SERVICES
mn = reporters.MailNotifier(fromaddr='email@gmail.com', sendToInterestedUsers=False,
                            relayhost="smtp.gmail.com",smtpPort=587, useTls=True,
                            extraRecipients=["email@gmail.com"],
                            smtpUser="email@gmail.com", smtpPassword="email_password")
c['services'] = [mn]

ただし、twistd.log で次のエラーを受け取るたびに:

2017-06-15 21:20:14-0700 [ESMTPSender,client] SMTP Client retrying server. Retry: 1
2017-06-15 21:20:15-0700 [ESMTPSender,client] Unhandled Error
    Traceback (most recent call last):
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\python\log.py", line 103, in callWithLogger
        return callWithContext({"system": lp}, func, *args, **kw)
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\python\log.py", line 86, in callWithContext
        return context.call({ILogContext: newCtx}, func, *args, **kw)
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\python\context.py", line 122, in callWithContext
        return self.currentContext().callWithContext(ctx, func, *args, **kw)
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\python\context.py", line 85, in callWithContext
        return func(*args,**kw)
    --- <exception caught here> ---
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\internet\selectreactor.py", line 149, in _doReadOrWrite
        why = getattr(selectable, method)()
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\internet\tcp.py", line 208, in doRead
        return self._dataReceived(data)
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\internet\tcp.py", line 214, in _dataReceived
        rval = self.protocol.dataReceived(data)
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\protocols\tls.py", line 330, in dataReceived
        self._flushReceiveBIO()
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\protocols\tls.py", line 295, in _flushReceiveBIO
        ProtocolWrapper.dataReceived(self, bytes)
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\protocols\policies.py", line 120, in dataReceived
        self.wrappedProtocol.dataReceived(data)
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\protocols\basic.py", line 571, in dataReceived
        why = self.lineReceived(line)
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\mail\smtp.py", line 995, in lineReceived
        why = self._okresponse(self.code, b'\n'.join(self.resp))
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\mail\smtp.py", line 1044, in smtpState_to
        return self.smtpState_toOrData(0, b'')
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\mail\smtp.py", line 1062, in smtpState_toOrData
        self.sendLine(b'RCPT TO:' + quoteaddr(self.lastAddress))
      File "c:\users\me\buildbot\sandbox\lib\site-packages\twisted\mail\smtp.py", line 179, in quoteaddr
        res = email.utils.parseaddr(addr)
      File "c:\python27\Lib\email\utils.py", line 214, in parseaddr
        addrs = _AddressList(addr).addresslist
      File "c:\python27\Lib\email\_parseaddr.py", line 457, in __init__
        self.addresslist = self.getaddrlist()
      File "c:\python27\Lib\email\_parseaddr.py", line 217, in getaddrlist
        while self.pos < len(self.field):
    exceptions.TypeError: object of type 'module' has no len()

クイック ヒント: Windows 10 (64 ビット) および Ubuntu 14.04 の Buildbot 0.9.8 と 0.9.1 の両方でエラーが表示されます。エラー ログは Python 2.7.13 virtualenv 15.1.0 twisted 17.5.0 のものです。次のコードを _parseaddr.py に挿入すると機能しますが、より良い修正を探しています。

if str(type(self.field)) == "<type 'module'>":
    return [('',u'email@gmail.com')]
4

1 に答える 1