How to get terminal width?

Radovan Garabik garabik at melkor.dnp.fmph.uniba.sk.spam
Fri May 5 16:46:26 EDT 2000


Doug Stanfield <DOUGS at oceanic.com> wrote:
 : Assuming you're on a *nix platform, there is an environmental variable,
 : COLUMNS, that should be accessible.  If you use curses there is a
hmmm...

atlas13:pts/7:~% echo $COLUMNS
84
atlas13:pts/7:~% python
Python 1.5.2 (#0, Mar 12 2000, 22:39:11)  [GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import os
>>> os.environ['COLUMNS']
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python1.5/UserDict.py", line 14, in __getitem__
    def __getitem__(self, key): return self.data[key]
KeyError: COLUMNS


what's up?

-- 
 -----------------------------------------------------------
| Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__    garabik @ melkor.dnp.fmph.uniba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!



More information about the Python-list mailing list