Assignment to option._verbosity_level in run_bzr() may assign to the ImportReplacer object

Adeodato Simó dato at net.com.org.es
Tue Nov 6 17:01:32 GMT 2007


Hello.

I just bumped into this:

% bzr cdiff
Plugin "Bzrtools" is not up to date with installed Bazaar version 0.93.0.dev.0.
There should be a newer version of Bzrtools available, e.g. 0.93.
bzr: ERROR: exceptions.AttributeError: 'ImportReplacer' object has no attribute '_verbosity_level'

Traceback (most recent call last):
  File "/home/adeodato/devel/bzr/bzr.dev/bzrlib/commands.py", line 802, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/adeodato/devel/bzr/bzr.dev/bzrlib/commands.py", line 762, in run_bzr
    option._verbosity_level = 0
AttributeError: 'ImportReplacer' object has no attribute '_verbosity_level'


This happens because bzrtool's commands are of a subclass where
run_argv_aliases is overriden, and only calls Command.run_argv_aliases
if the versions match. Which means that in the case above
Commands.run_argv_aliases does not get called, which means the option
module is not accessed, which means it is still an ImportReplacer object
by the time run_bzr() tris to assign to option._verbosity_level.

I can think of several fixes; seems the appropriate one would be to
handle __setattr__ in ScopeReplacer?

Cheers,

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
Experience is something you don't get until just after you need it.




More information about the bazaar mailing list