Shows traceback when completing commands

Bug #276216 reported by Mert Dirik
2
Affects Status Importance Assigned to Milestone
Bazaar
Invalid
Low
Unassigned
QBzr
Fix Released
High
Lukáš Lalinský

Bug Description

When I try to auto-complete bzr commands, my first try fails and shows a traceback:

debian% bzr bra[TAB]bzr: ERROR: exceptions.AttributeError: 'LazyCommand' object has no attribute 'hidden'

Traceback (most recent call last):
  File "/home/mert/prog/bzr-1.7~rc2/lib/python/bzrlib/commands.py", line 857, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/mert/prog/bzr-1.7~rc2/lib/python/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/home/mert/prog/bzr-1.7~rc2/lib/python/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/mert/prog/bzr-1.7~rc2/lib/python/bzrlib/commands.py", line 818, in ignore_pipe
    result = func(*args, **kwargs)
  File "/home/mert/prog/bzr-1.7~rc2/lib/python/bzrlib/builtins.py", line 3298, in run
    shellcomplete.shellcomplete(context)
  File "/home/mert/prog/bzr-1.7~rc2/lib/python/bzrlib/shellcomplete.py", line 24, in shellcomplete
    shellcomplete_commands(outfile = outfile)
  File "/home/mert/prog/bzr-1.7~rc2/lib/python/bzrlib/shellcomplete.py", line 73, in shellcomplete_commands
    if cmdclass.hidden:
AttributeError: 'LazyCommand' object has no attribute 'hidden'

bzr 1.7rc2 on python 2.5.2 (linux2)
arguments: ['/home/mert/bin/bzr', 'shell-complete']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'tr_TR.UTF-8'
plugins:
  bzr_notification /home/mert/.bazaar/plugins/bzr_notification [unknown]
  bzr_stats /home/mert/.bazaar/plugins/bzr_stats [unknown]
  bzrtools /home/mert/.bazaar/plugins/bzrtools [1.7.0]
  diffstat /home/mert/.bazaar/plugins/diffstat [0.2.0]
  dns_cache /home/mert/.bazaar/plugins/dns_cache [unknown]
  extmerge /home/mert/.bazaar/plugins/extmerge [unknown]
  file_revno /home/mert/.bazaar/plugins/file_revno [unknown]
  gtk /home/mert/.bazaar/plugins/gtk [0.95.0]
  launchpad /home/mert/prog/bzr/lib/python/bzrlib/plugins/launchpad [unknown]
  lesslog /home/mert/.bazaar/plugins/lesslog [unknown]
  qbzr /home/mert/.bazaar/plugins/qbzr [0.9.4]
  remove_revisions /home/mert/.bazaar/plugins/remove_revisions [unknown]
  service /home/mert/.bazaar/plugins/service [unknown]
  update_mirrors /home/mert/.bazaar/plugins/update_mirrors [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.
nchn

There is no matter if I try to complete branch or checkout, it shows a traceback, but it still completes the command. Following completings doesn't show traceback, only the first one when the shell is opened.

Revision history for this message
John A Meinel (jameinel) wrote :

'qbzr' is the one which installs a LazyCommand, though it is bzrtools which is probing the registered commands.

I would guess the best fix would be to have LazyCommand proxy requests for attributes (via __getattr__ work).

Revision history for this message
John A Meinel (jameinel) wrote :

Arguably we could handle this better than giving a traceback, even if QBzr isn't fully conforming to our expected api.

Changed in bzr:
importance: Undecided → Low
status: New → Triaged
Lukáš Lalinský (luks)
Changed in qbzr:
assignee: nobody → luks
importance: Undecided → High
milestone: none → 0.9.5
status: New → Confirmed
Lukáš Lalinský (luks)
Changed in qbzr:
status: Confirmed → Fix Committed
Revision history for this message
Lukáš Lalinský (luks) wrote :

I think the Bazaar side should be closed as invalid, clearly LazyCommand was broken and bzrlib can't assume that _everything_ is broken (IMO). While it would be nice to have a system that can handle anything, it doesn't seem worth the time.

Revision history for this message
Mert Dirik (mertdirik) wrote :

"bzr help commands" fails with qbzr rev 438.

debian% bzr help commands
bzr: ERROR: No module named qbzr.lib.commands
You may need to install this Python library separately.

Revision history for this message
Lukáš Lalinský (luks) wrote : Re: [Bug 276216] Re: Shows traceback when completing commands

On Wed, Oct 1, 2008 at 12:42 PM, Mert Dirik <email address hidden> wrote:
> "bzr help commands" fails with qbzr rev 438.

I assume you mean 483, not 438.

> debian% bzr help commands
> bzr: ERROR: No module named qbzr.lib.commands
> You may need to install this Python library separately.

Works for me, using both 1.7 and bzr.dev. Can you pastebin the error
from ~/.bzr.log?

Lukas

Revision history for this message
Mert Dirik (mertdirik) wrote :

Lukáš Lalinský yazmış:
 > I assume you mean 483, not 438.
>
Yes, I'm sorry.

>> debian% bzr help commands
>> bzr: ERROR: No module named qbzr.lib.commands
>> You may need to install this Python library separately.
>
> Works for me, using both 1.7 and bzr.dev. Can you pastebin the error
> from ~/.bzr.log?
>
http://pastebin.ubuntu.com/52884/

Revision history for this message
Alexander Belchenko (bialix) wrote :

Mert Dirik пишет:
> Lukáš Lalinský yazmış:
> > I assume you mean 483, not 438.
> Yes, I'm sorry.
>
>>> debian% bzr help commands
>>> bzr: ERROR: No module named qbzr.lib.commands
>>> You may need to install this Python library separately.
>> Works for me, using both 1.7 and bzr.dev. Can you pastebin the error
>> from ~/.bzr.log?
>>
> http://pastebin.ubuntu.com/52884/
>

You have installed qbzr in the directory "/home/mert/.bazaar/plugins/qbzr_trunk"
It's incorrect location. Directory where qbzr resides should be named "qbzr"
not "qbzr_trunk", i.e. "/home/mert/.bazaar/plugins/qbzr"

Revision history for this message
Mert Dirik (mertdirik) wrote :

Alexander Belchenko yazmış:
>
> You have installed qbzr in the directory "/home/mert/.bazaar/plugins/qbzr_trunk"
> It's incorrect location. Directory where qbzr resides should be named "qbzr"
> not "qbzr_trunk", i.e. "/home/mert/.bazaar/plugins/qbzr"
>
I've moved it to qbzr and "help commands" works fine, but completion still shows
traceback.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Mert Dirik пишет:
> Alexander Belchenko yazmış:
>> You have installed qbzr in the directory "/home/mert/.bazaar/plugins/qbzr_trunk"
>> It's incorrect location. Directory where qbzr resides should be named "qbzr"
>> not "qbzr_trunk", i.e. "/home/mert/.bazaar/plugins/qbzr"
>>
> I've moved it to qbzr and "help commands" works fine, but completion still shows
> traceback.

I suppose now you have different error. Can you pastebin new traceback?
Can you confirm that you have Qt/PyQt installed on your system?

Revision history for this message
Mert Dirik (mertdirik) wrote :

Alexander Belchenko yazmış:
 > I suppose now you have different error. Can you pastebin new traceback?
> Can you confirm that you have Qt/PyQt installed on your system?
>

http://pastebin.ubuntu.com/52926/ (rev. 486)

All the qbzr commands works fine so Qt/PyQt should be installed.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Mert Dirik пишет:
> Alexander Belchenko yazmış:
> > I suppose now you have different error. Can you pastebin new traceback?
>> Can you confirm that you have Qt/PyQt installed on your system?
>>
>
> http://pastebin.ubuntu.com/52926/ (rev. 486)
>
> All the qbzr commands works fine so Qt/PyQt should be installed.

Thank you.

Traceback has error:
AttributeError: 'LazyCommand' object has no attribute 'hidden'

Lukas has changed LazyCommand class to LazyCommandProxy in qbzr trunk revno.480.
So I suppose you're still running QBzr version without this fix.

You can run `bzr plugins -v` and inspect qbzr's version and location.
If you're running from qbzr trunk you should see version 0.9.5dev0.

Revision history for this message
Lukáš Lalinský (luks) wrote :

On Wed, Oct 1, 2008 at 8:02 PM, Mert Dirik <email address hidden> wrote:
> Alexander Belchenko yazmış:
> > I suppose now you have different error. Can you pastebin new traceback?
>> Can you confirm that you have Qt/PyQt installed on your system?
>
> http://pastebin.ubuntu.com/52926/ (rev. 486)
>
> All the qbzr commands works fine so Qt/PyQt should be installed.

I'm fairly sure this isn't revision 486, because there is no
LazyCommand in that revision. I've renamed the class while fixing this
bug.

Lukas

Revision history for this message
Mert Dirik (mertdirik) wrote :

Lukáš Lalinský yazmış:
 > I'm fairly sure this isn't revision 486, because there is no
> LazyCommand in that revision. I've renamed the class while fixing this
> bug.
>

Ok. I remember I've reverted it to r479 because of the "help commands" problem
and then I've forgot it after moving qbzr_trunk to qbzr. Now it works fine.

Thank you very much.

Revision history for this message
Martin Pool (mbp) wrote :

Arguably the shell completion function should default to hiding the
error and just giving no completions... (on the other hand maybe that
would just be mysterious)

--
Martin <http://launchpad.net/~mbp/>

Changed in qbzr:
status: Fix Committed → Fix Released
Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
Revision history for this message
Robert Collins (lifeless) wrote :

I think its better to hold to the contract than swallow an error mysteriously, except in exceptional circumstances, and this isn't exceptional.

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.