python and vc numbers

Gregory Ewing greg.ewing at canterbury.ac.nz
Sun Nov 29 20:21:54 EST 2009


Daniel Dalton wrote:
> what function/module should
> I use to figure out what tty my program was invoked from?

Here's one way:

% python
Python 2.5 (r25:51908, Apr  8 2007, 22:22:18)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import os
 >>> os.popen("tty").read()
'/dev/ttyp1\n'

-- 
Greg



More information about the Python-list mailing list