[Tutor] a question

Kent Johnson kent37 at tds.net
Sun Jul 3 14:06:44 CEST 2005


Xinyue Ye wrote:
> when I type sys.ps2 after import sys,
> I got the message like:
> Traceback (most recent call last):
>  File "<pyshell#10>", line 1, in -toplevel-
>   sys.ps2
> AttributeError: 'module' object has no attribute 'ps2'
> why does it happen?

>From the docs:
ps1
ps2
    Strings specifying the primary and secondary prompt of the interpreter. These are only defined if the interpreter is in interactive mode.

When you are running in IDLE, the command shell is provided by IDLE, not Python, so ps1 and ps2 are not defined.

Kent



More information about the Tutor mailing list