Running script in __main__ shows no output in IDLE

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Tue May 23 03:15:39 CEST 2006


heidi.hunter at fantasy-interactive.com a écrit :
> I just downloaded the most recent (2.4.3) Python and IDLE (1.1.3) to
> Windows XP Professional. I'm new to the IDLE environment, so hopefully
> someone can tell me what I'm missing here! Below is the code, which I'm
> editing within IDLE, and attempting to test with the Run commands.
> 
> I was expecting to see at least see the prints to stdout from the if
> __name__ ... statement and main() function, but when I use F5 Run
> module I don't see any output or errors. Any suggestions? Does IDLE
> still need the executable file statement at the top even if I run it
> explicity?

I can't tell you about IDLE related stuff (I don't use it myself), but 
FWIW, you have a problem with main()'s 'arg' param : you use it like this:

 >     parser.parse(args[0])
but pass it like this:
 >     main("\\Iceman\propod\flash\xml\webService\XmlData\Authors\Heidi")

The first problem is that:
"\\Iceman\propod\flash\xml\webService\XmlData\Authors\Heidi"
already raises an exception ('ValueError: invalid \x escape').

The second problem is that somestring[0] returns the first characted of 
somestring.

First correct your code, then see what happens. And eventually, find a 
better tool than IDLE...



More information about the Python-list mailing list