Unable to see os.environ['COLUMNS']
Tim Chase
python.list at tim.thechases.com
Sat Sep 13 13:09:56 EDT 2008
Not sure what's going on here and hoping for some insight:
tim at rubbish:~$ echo $COLUMNS
129
tim at rubbish:~$ python2.5
Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> import os
>>> os.environ.get('COLUMNS')
>>> 'COLUMNS' in os.environ
False
I can coerce it by using
tim at rubbish:~$ COLUMNS=$COLUMNS python2.5
Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> import os
>>> 'COLUMNS' in os.environ
True
However, this seems hokey to me.
FWIW, this is in Bash on Debian.
What's the best way to read what seems to be a pseudo-environment
variable?
-tkc
More information about the Python-list
mailing list