bzr qannotate fails with traceback

Bug #209467 reported by Antonín Komenda
2
Affects Status Importance Assigned to Milestone
QBzr
Fix Released
Critical
Alexander Belchenko

Bug Description

Hallo, I have updated to new bazaar 1.3.0 and qbzr 0.9.0 and I got this traceback on qannotate:

.:gree@amila[~/workspace/swiz5]$ bzr qann swiz/core/G_Extender.php
bzr: ERROR: exceptions.AttributeError: 'tuple' object has no attribute 'decode'

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 834, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 790, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 492, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.4/site-packages/bzrlib/plugins/qbzr/__init__.py", line 136, in run
    win = AnnotateWindow(branch, tree, relpath, file_id, encoding)
  File "/usr/lib/python2.4/site-packages/bzrlib/lazy_import.py", line 125, in __call__
    return obj(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/plugins/qbzr/annotate.py", line 149, in __init__
    self.annotate(tree, fileId)
  File "/usr/lib/python2.4/site-packages/bzrlib/plugins/qbzr/annotate.py", line 168, in annotate
    item.setText(3, self.codec.decode(text.rstrip(), 'replace')[0])
AttributeError: 'tuple' object has no attribute 'decode'

bzr 1.3 on python 2.4.5.final.0 (linux2)
arguments: ['/usr/bin/bzr', 'qann', 'swiz/core/G_Extender.php']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'cs_CZ.UTF-8'
plugins:
  bzrtools /usr/lib/python2.4/site-packages/bzrlib/plugins/bzrtools [1.3.0]
  email /usr/lib/python2.4/site-packages/bzrlib/plugins/email [unknown]
  gtk /usr/lib/python2.4/site-packages/bzrlib/plugins/gtk [0.93.0]
  launchpad /usr/lib/python2.4/site-packages/bzrlib/plugins/launchpad [unknown]
  qbzr /usr/lib/python2.4/site-packages/bzrlib/plugins/qbzr [0.9.0]
  rebase /usr/lib/python2.4/site-packages/bzrlib/plugins/rebase [0.3.0]
*** 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.

All other q-commands work fine for me.

Cheers,
--
AK

Tags: qannotate

Related branches

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

This is because of difference between Python 2.5.x and Python 2.4.x. In Python 2.4 codecs.lookup('utf-8') returns tuple
(<built-in function utf_8_encode>, <function decode at 0x00957670>, <class encodings.utf_8.StreamReader at 0x00956540>, <class encodings.utf_8.StreamWriter at 0x00956510>)

but in Python 2.5 the same statement returns object <codecs.CodecInfo object for encoding utf-8 at 0x10a95e0>, that supports tuple-like interface to access by index.

We should either switch to tuple-like interface, i.e. decoder = codecs.lookup(...)[1] or use special functions like codecs.getdecoder(...)

Changed in qbzr:
importance: Undecided → Critical
milestone: none → 0.9.1
status: New → Confirmed
Revision history for this message
Alexander Belchenko (bialix) wrote :

even simplier solution to use text.decode('utf-8') without codecs.lookup at all, like in cat.py

Changed in qbzr:
assignee: nobody → bialix
Revision history for this message
Alexander Belchenko (bialix) wrote :

Antonin, you need to apply attached patch as short term solution. I can't predict how fast we release 0.9.1 with required bugfix.

Changed in qbzr:
status: Confirmed → Fix Committed
Revision history for this message
Antonín Komenda (gree) wrote :

The patch fixed the problem. It works fine now. Thanks a lot.

Changed in qbzr:
status: Fix Committed → Fix Released
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.