When trying to start Buildbot’s master 0.8.6 I encountered this “exceptions.ImportError: cannot import name NoResource” error. The full transcript from the buildbot’s log is shown below:
2012-10-20 21:06:15+0300 [-] 2012-10-20 21:06:15+0300 [-] Unhandled Error Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 551, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 916, in gotResult _deferGenerator(g, deferred) File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 891, in _deferGenerator result = g.next() File "/usr/lib64/python2.7/site-packages/buildbot/master.py", line 166, in startService self.configFileName) ------ File "/usr/lib64/python2.7/site-packages/buildbot/config.py", line 144, in loadConfig exec f in localDict File "/home/buildbot/master/master.cfg", line 307, in from buildbot.status.html import WebStatus File "/usr/lib64/python2.7/site-packages/buildbot/status/html.py", line 20, in from buildbot.status.web.baseweb import WebStatus File "/usr/lib64/python2.7/site-packages/buildbot/status/web/baseweb.py", line 35, in from buildbot.status.web.changes import ChangesResource File "/usr/lib64/python2.7/site-packages/buildbot/status/web/changes.py", line 19, in from twisted.web.error import NoResource 2012-10-20 21:06:15+0300 [-] Configuration Errors: 2012-10-20 21:06:15+0300 [-] error while parsing config file: cannot import name NoResource (traceback in logfile) 2012-10-20 21:06:15+0300 [-] Halting master. 2012-10-20 21:06:15+0300 [-] Main loop terminated. 2012-10-20 21:06:15+0300 [-] Server Shut Down.
This has been fixed in 0.8.7, but if you can’t upgrade to 0.8.7 for whatever reason, see https://github.com/buildbot/buildbot/pull/509 for the explanation and patch. First locate where your python site-packages are (mine as shown below is in /usr/lib64/python2.7/site-packages
. You figure this out by executing:
# python -m site sys.path = [ '/home/buildbot/master', '/usr/lib64/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/gtk-2.0', '/usr/lib64/portage/pym', ] USER_BASE: '/root/.local' (exists) USER_SITE: '/root/.local/lib64/python2.7/site-packages' (doesn't exist) ENABLE_USER_SITE: True
Then, all you have to do is replace:
from twisted.web.error import NoResource
with
try: from twisted.web.error import NoResource except ImportError: from twisted.web.error import Error as NoResource
in 3 files:
/usr/lib64/python2.7/site-packages/buildbot/status/web/changes.py /usr/lib64/python2.7/site-packages/buildbot/status/web/logs.py /usr/lib64/python2.7/site-packages/buildbot/status/web/slaves.py
0