Gripe: Use Ctrl-D (i.e. EOF) to exit

John Hazen invalid at hazen.net
Wed Feb 25 18:06:38 EST 2004


* Erno Kuusela <erno-news at erno.iki.fi> [2004-02-23 17:38]:
> 
> of course typing EOF is the normal way to tell any unix stdio app to
> exit. but the EOF key depends on your tty settings and is set with
> stty. hardcoding ctrl-d is strictly speaking broken ;)

I'm not sure if you were implying that python does this...

I just tested it, and it's not hardcoded (2.3a2 darwin).

  lap:john$ stty eof ^A
  lap:john$ cat 
  nthoeu
  nthoeu
  < exited by typing ^A >
  lap:john$ python
  Python 2.3a2+ (#4, Mar  2 2003, 17:13:46) 
  [GCC 3.1 20020420 (prerelease)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> 
  < exited by typing ^A >
  lap:john$ 

So, another solution to the OP's problem is to change the EOF character
to something else.

-John
< my_first_name AT my_last_name DOT net >




More information about the Python-list mailing list