Package: pydf
Version: 9
Severity: normal

Using pydf in Emacs shell buffers fails like this:

$ pydf
Traceback (most recent call last):
  File "/usr/bin/pydf", line 644, in <module>
    display_table(table, terminal_width)
  File "/usr/bin/pydf", line 534, in display_table
    squeeze_table(table, terminal_width-1)
  File "/usr/bin/pydf", line 482, in squeeze_table
    colsize = len(row[col][1])
ValueError: __len__() should return >= 0
$

That's because the termios detection routine appears to work, but
returns zero. When running inside Emacs, the best way to detect the
terminal width is probably to use COLUMNS, both shell mode and term mode
set it:

--- /usr/bin/pydf       2010-04-05 18:11:10.000000000 +0200
+++ /tmp/pydf   2010-04-11 21:55:41.041725101 +0200
@@ -77,6 +77,8 @@
     return 80
 
 def get_terminal_width():
+    if 'INSIDE_EMACS' in os.environ:
+        return int(os.environ['COLUMNS'])
     handlers = [get_terminal_width_termios, get_terminal_width_resize, 
get_terminal_width_dumb]
     for handler in handlers:
         width = handler()

Thanks.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (900, 'unstable'), (850, 'testing'), (800, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages pydf depends on:
ii  python                        2.5.4-9    An interactive high-level object-o

pydf recommends no packages.

pydf suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to