Newbie IDLE - import issues

sismex01 at hebmex.com sismex01 at hebmex.com
Tue Nov 26 09:47:45 EST 2002


> From: Kenny Tilton [mailto:ktilton at nyc.rr.com]
> Sent: Tuesday, November 26, 2002 8:34 AM
> 
> I must misunderstand things badly.
> 
> Using IDLE: I have import statements where apparently 
> necessary. I hit Ctrl-F5 and I see print statements at
> the end of imported modules fire.
> 
> But I still get errors on imported stuff being undefined.
> 
> Then I open the imported file and ^f5 it and then I can ^f5 
> successfully the importing file which before gave me an error.
> 
> any help with this would be appreciated. As is I end up 
> having to open ten files and run them manually every morning.
>

Without more information ("detailed" information :-)
I can only say that this sounds like some module you're
trying to import isn't in your sys.path.  BUT, since
you load it in IDLE and <F5> it, and *then* load (into
IDLE I suppose) the "importer" module, and now it runs
correctly, everything works as it should.

Python only imports a module once, and any subsequent
import only loads the pertinent references into the target
namespace, without actually loading the module from storage.

You can check which modules you have loaded at any time
by checking sys.modules, which is a dictionary of all
currently imported modules.

You can also check sys.path to see which directories
are checked for module imports.

And, with more information we might help s'more ;-)

g'day!

-gustavo




More information about the Python-list mailing list