Environment variables not visible from Python

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Sep 22 02:12:01 EDT 2011


I don't understand why some environment variables are not visible from 
Python.

[steve at wow-wow ~]$ echo $LINES $COLUMNS $TERM
30 140 xterm
[steve at wow-wow ~]$ python2.6
Python 2.6.6 (r266:84292, Dec 21 2010, 18:12:50)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> (os.getenv('LINES'), os.getenv('COLUMNS'), os.getenv('TERM'))
(None, None, 'xterm')



-- 
Steven



More information about the Python-list mailing list