How do I tell if I'm running in the PyWin interpreter?

Charles Krug cdkrug at
Sat Jan 28 09:52:35 EST 2006

On 2006-01-28, Peter Otten <__peter__ at> wrote:
> Charles Krug wrote:
>> Is there a way to detect that I'm running the the PyWin interpreter so
>> that I can bypass its raw_input behavior?
> You could test
> if pywin_specific_module in sys.modules:
>    # use workaraound
> Or maybe you can get away with always using sys.stdin.readline() instead of
> raw_input()? Look into for an example.
> Peter
> is the "battery included" I was thinking of last night.
Unfortunately it uses something that PyWin replaces.

However I did note that PyWin's version raises KeyboardInterrupt out of
its dialog box.

That's not ideal, but at least it gives me an idea what I need to trap
to exit.

More information about the Python-list mailing list