[Tutor] Is my Python install hosed?
John Fouhy
john at fouhy.net
Mon Oct 2 01:52:06 CEST 2006
On 02/10/06, Will Shattuck <willshattuck at gmail.com> wrote:
> I'm going through the tutorial "Learning to Program" at
> http://www.freenetpages.co.uk/hp/alan.gauld/. I reached the section
> talking about sys.exit(). I typed it in as indicated, but I received
> errors rather than it actually exiting the Python Shell windows
> generated when starting IDLE. Here is the text:
>
> ==============================
> >>> import sys
> >>> sys.exit()
>
> Traceback (most recent call last):
> File "<pyshell#20>", line 1, in -toplevel-
> sys.exit()
> SystemExit
> ==============================
Nah, I get that too. I think it's an IDLE thing.
>From the command line:
Python 2.4.3 (#1, Mar 30 2006, 11:02:16)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> raise SystemExit
Morpork:~ repton$
>From IDLE:
IDLE 1.1.3
>>> raise SystemExit
Traceback (most recent call last):
File "<pyshell#0>", line 1, in -toplevel-
raise SystemExit
SystemExit
>>>
IDLE will just be catching the exception, I guess. You can do it yourself:
>>> try:
... sys.exit()
... except SystemExit:
... print 'Not exiting!'
...
Not exiting!
--
John.
More information about the Tutor
mailing list