IDLE confusion

Claudio Grondi claudio.grondi at freenet.de
Tue May 16 10:39:43 CEST 2006


MrBlueSky wrote:
> Hi, I'm trying to use IDLE to develop My First Python App and my head
> hurts...
> 
> I've a file called spalvi.py with this in it:
>     from Test import *
>     firstTest("Mike")
> 
> And a file called Test.py with this in it:
>     def firstTest(name):
>         print "Yo",name
> 
> I open spalvi.py with IDLE and Run it.  It says "Yo Mike".
> I use the File menu to open Test.py and change the message from "Yo" to
> "Hi".
> I Run it again.... it still says "Yo Mike"  :-(
> I close everything down, open spalvi.py with IDLE and Run it again.  It
> says "Hi Mike".
> 
> So I'm obviously not using IDLE in the "right" way.  But what *is* the
> "right" way, when you're trying to develop using several source files?
> 
> John
> 
You need some deeper understanding of what import does and what happens 
when you import again (after the library files have changed).
Try in the IDLE menu [Shell] "Restart Shell" (Ctrl+F6) each time you 
have changed something in your files - this "resets" anything previously 
imported, which stays the same way otherwise.

Claudio



More information about the Python-list mailing list