[Python-Dev] RE: Windows IO
Mon, 17 Mar 2003 12:01:38 -0800
> > 2. Is there any way to know if a console is being used (that a
> > device is the console)?
> >>> import sys
> >>> sys.stdin.isatty()
> >>> sys.stdout.isatty()
> >>> whatever = open('whatever.txt', 'w')
> >>> whatever.isatty()
Python 2.2.1 (#34, Jul 16 2002, 16:25:42) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
Have we discovered the mystery of life at last? "True" is 64? :)
NOTE: PythonDoc says "isatty" is Unix only.
> This really belongw on c.l.py, where it gets asked frequently enough.
Sorry, I thought a Python "guts" question would be ok here and likely to get
better informed answers than over on the (more or less) application side of
> I haven't paid attention to the answers. Fredrik's Console extension for
> Windows should tickle your fancy:
I'll take a look at it. Meanwhile, someone has kindly sent me source for a
PDCurses binding for Python.
Thanks to everyone for their answers! I'd like to thank the Academy, the
Screen Actor's Guild and especially, Timbot, who helped make it all possible
Seattle, WA USA