bzr internal error: AttributeError: 'module' object has no attribute 'builtins'

Bug #393694 reported by Samuel Bronson on 2009-06-30
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

I get this error from running bzr in any way, except I can't find the flag that turns off plugin loading because it's not listed in the manpage and bzr --help does this too, so I can't try that...

% bzr
bzr: ERROR: exceptions.AttributeError: 'module' object has no attribute 'builtins'

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 729, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 872, in run_bzr
    from bzrlib.builtins import cmd_help
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 5573, in <module>
    from bzrlib.foreign import cmd_dpush
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 21, in <module>
    from bzrlib.branch import (
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 1977, in <module>
    __format7 = BzrBranchFormat7()
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 1825, in __init__
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 122, in __call__
    obj = _replace()
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 89, in _replace
    obj = factory(self, scope, name)
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 192, in _import
    module = __import__(module_python_path, scope, scope, [member])
  File "/usr/lib/python2.5/site-packages/bzrlib/repofmt/", line 62, in <module>
    from bzrlib.btree_index import (
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 21, in <module>
    import bisect
  File "/home/naesten/.bazaar/plugins/bisect/", line 455, in <module>
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 123, in register_command
    return plugin_cmds.register(cmd, decorate)
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 93, in register
    previous = _builtin_commands().get(k_unsquished)
  File "/usr/lib/python2.5/site-packages/bzrlib/", line 137, in _builtin_commands
    builtins = bzrlib.builtins.__dict__
AttributeError: 'module' object has no attribute 'builtins'

bzr 1.16.1 on python 2.5.4 (linux2)
arguments: ['/usr/bin/bzr']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
*** Bazaar has encountered an internal error.
    Please report a bug at
    including this traceback, and a description of what you
    were doing when the error occurred.

Robert Collins (lifeless) wrote :

Doesn't import needed module.

So, bzr-bisect is using bzrlib.builtins, but doesn't import it itself :). The fix should be quite easy.

As a workaround, bzr --no-plugins ... - this will disable plugin loading.

affects: bzr → bzr-bisect
Changed in bzr-bisect:
importance: Undecided → Critical
status: New → Triaged
Robert Collins (lifeless) wrote :

Actually, its something else, bzrlib.builtins is just not loaded by the time register-command is being called. Putting back to bzr and fixing.

affects: bzr-bisect → bzr
Robert Collins (lifeless) wrote :

This is fixed in already. I'm not sure why its showing up in 1.16. Looking into that now.

Changed in bzr:
status: Triaged → Fix Released
Robert Collins (lifeless) wrote :

Sam, can you check the file

my 1.16 copy has
def _builtin_commands():
    import bzrlib.builtins
    r = {}
    builtins = bzrlib.builtins.__dict__

If yours has that, I don't see how it can be failing!

Perhap change it as follows:
def _builtin_commands():
    import bzrlib.builtins
    import pdb;pdb.set_trace()
    r = {}

and poke around in the debugger.

Robert Collins (lifeless) wrote :

"" was in the PYTHONPATH, and bzr was being run from a directory with the 'bisect' plugin in it, leading to a circular import.

Changed in bzr:
status: Fix Released → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers