Incompatibility with diff from bzrtools ('DiffWriter' object has no attribute 'isatty')

Bug #329845 reported by Eduardo de Oliveira Padoan
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar Pager Plugin
Fix Committed
Medium
Mark Lee

Bug Description

$ bzr cdiff
bzr: ERROR: exceptions.AttributeError: 'DiffWriter' object has no attribute 'isatty'

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 896, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 842, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools/command.py", line 13, in run_argv_aliases
    commands.Command.run_argv_aliases(self, argv, alias_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 542, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools/command_classes.py", line 548, in run
    colordiff(color, check_style, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools/colordiff.py", line 203, in colordiff
    get_cmd_object('diff').run(*args, **kwargs)
  File "/home/edcrypt/.bazaar/plugins/pager/__init__.py", line 48, in run
    setup_pager()
  File "/home/edcrypt/.bazaar/plugins/pager/__init__.py", line 12, in setup_pager
    if not sys.stdout.isatty() or not hasattr(os, 'fork'):
AttributeError: 'DiffWriter' object has no attribute 'isatty'

bzr 1.12 on python 2.5.2 (linux2)
arguments: ['/usr/bin/bzr', 'cdiff']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'pt_BR.UTF-8'
plugins:
  avahi /usr/lib/python2.5/site-packages/bzrlib/plugins/avahi [0.3dev]
  bisect /home/edcrypt/.bazaar/plugins/bisect [1.1.0.pre.0]
  bookmarks /home/edcrypt/.bazaar/plugins/bookmarks [unknown]
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [1.12]
  dbus /usr/lib/python2.5/site-packages/bzrlib/plugins/dbus [unknown]
  diffstat /home/edcrypt/.bazaar/plugins/diffstat [0.2]
  extcommand /home/edcrypt/.bazaar/plugins/extcommand [unknown]
  gtk /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.95.0.final.1]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
  local_branches /home/edcrypt/.bazaar/plugins/local_branches [0.4.16dev]
  netrc_credential_store /usr/lib/python2.5/site-packages/bzrlib/plugins/netrc_credential_store [unknown]
  pager /home/edcrypt/.bazaar/plugins/pager [unknown]
  rxrenames /home/edcrypt/.bazaar/plugins/rxrenames [unknown]
  search /home/edcrypt/.bazaar/plugins/search [1.7dev]
  stats /home/edcrypt/.bazaar/plugins/stats [unknown]
  touch /home/edcrypt/.bazaar/plugins/touch [unknown]
  upload /home/edcrypt/.bazaar/plugins/upload [1.0dev]
*** 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.

Related branches

Revision history for this message
Mark Lee (malept) wrote :

I have two fixes in my branch (<lp:~malept/bzr-pager/bugfix.329845>, linked to this bug). The first revision (r9) avoids using the pager if sys.stdout does not have the 'isatty' attribute (e.g., bzrtool's DiffWriter). The second revision (r10) enables proper support for `bzr cdiff` by detecting if sys.stdout is a DiffWriter.

Changed in bzr-pager:
status: New → Confirmed
Revision history for this message
Lukáš Lalinský (luks) wrote :

Please use isinstance(sys.stdout, DiffWriter) instead of type(sys.stdout) is DiffWriter

Revision history for this message
Mark Lee (malept) wrote :

> Please use isinstance(sys.stdout, DiffWriter) instead of type(sys.stdout) is DiffWriter

Revision 11 contains that change.

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

Thanks, merged.

Changed in bzr-pager:
assignee: nobody → malept
importance: Undecided → Medium
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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