[Tutor] exit message

Alan Gauld alan.gauld at btinternet.com
Mon May 6 10:46:48 CEST 2013


On 06/05/13 05:24, Jim Mooney wrote:
> I've noticed that if you exit() a program you always get a traceback message:
> Traceback (most recent call last):
>    File "<pyshell#1>", line 1, in <module>
>      exit('what now?')
>    File "C:\Python33\lib\site.py", line 380, in __call__
>      raise SystemExit(code)

Only within IDLE. You should remember that IDLE is a development tool 
and not intended for running finished programs. As such, it includes 
lots of useful extra "features" that help the developer, like catching 
exceptions and printing error messages. This is true for Ctrl-C 
keypresses as well as exit. It means you stay in IDLE rather than 
exiting the tool.

If you run your code from the OS instead of from IDLE it will do what 
you expect.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list