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

Mike Maxwell maxwell at ldc.upenn.edu
Mon Feb 23 15:38:59 EST 2004


Gerrit wrote:
> You can put in your .pythonrc:
>
> from sys import exit
>
> It helps!

It does indeed--thanks!

Actually, I tried putting this in both ~/.pythonrc and ~/.pythonrc.py (the
latter as suggested by the Python documentation I checked after reading
Gerrit's msg).  Neither seemed to work, for reasons I don't understand (but
which are probably explained in the documentation. Somewhere).

However, by putting the above import cmd into a file and then setting the
env var 'PYTHONSTARTUP' to point to this file, it works.  (According to the
documentation, this has the effect of only being read when Python is started
interactively--not when it is run e.g. from a script.  That's fine with me.)

Again, thanks--while I still think the design feature that outputs the "use
ctrl-D..." msg is a Bug, this is a nice work-around.

    Mike Maxwell







More information about the Python-list mailing list