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

Steven D'Aprano steve at REMOVETHIScyber.com.au
Fri Jan 27 23:07:43 EST 2006


On Fri, 27 Jan 2006 21:05:43 -0600, Charles Krug wrote:

> Here's the deal:
> 
> I've a dead-simple command-line program I'm using to test things that I
> can't (for various reasons) test in the IDE.
> 
> Here's a do-nothing subset that shows the idea:
> 
> # insanely simply command interpreter
> import Commands
> import sys
> 
> myPrompt = '$> '
> 
> # Raw Input doesn't QUITE do what I want in Python Win.
> while True:
>     try:
>         args = raw_input(myPrompt).strip().split()
>     except EOFError:
>         break
> 
>     cmd = args[0]
>     print '>%s<' % cmd
>     print args
> 
> As the comment says, when I run this under Python Win, I get an (pretty
> sure) Tkinter interface, not a command line, and I don't get my
> EOFError when I expect to.

When do you expect to get an EOFError? The only way I get an EOFError is
if I explicitly hit Ctrl-D while raw_input is running. When do you expect
to get it? Have you tried Ctrl-Z under Windows?



-- 
Steven.




More information about the Python-list mailing list