[Tutor] Is IDLE prone to memory losses ?

alan.gauld@bt.com alan.gauld@bt.com
Wed, 12 Dec 2001 17:21:46 -0000


> That is the point : instead of telling me about the real 
> mistake I made it
> says that :
>     "if x1 >360:"  is on line 9,  where it actually was 
> _before_ I made the change, but isn't anymore, far from it. 


> Now, if I close the editing window and reopen it, run the script, 
> I'll get an error message just like the one
> you got and that makes sense.

I wonder....

Are you by any chance running your script by importing it into 
the interactive window in IDLE?

If so the changes you make in the editor won't show up until 
you reload() the module. That might explain the behaviour you see.

Just a guess.

If I'm right be aware that reload has some quirks to watch out 
for, in particular it only works if you do:

import foo

not if you do:

from foo import *

Also if you remove a definiton from a loaded module and reload 
the old definition will probably still be there!

I usually find it easier (ie safer!) to create the module with 
a stanza like:

if __name__ = "__Main__":
   # test the program here

at the end. 
That way I run it from IDLE using the CTRL-F5 key and there are 
no import artifacts left over

OTOH If you are already doing that then I don't know whats 
happened.

Alan g.