Re: reload fails if module not in sys.path

2005-10-21 Thread Lonnie Princehouse
> That's OK, but you may find fiddling with sys.path is more productive :-) Yeah, that's what I'm doing and it works just fine. When I stumbled over this behavior yesterday it seemed (and still does) like a low-priority bug in reload. I was hoping a guru would reply with something like, "Of cour

Re: reload fails if module not in sys.path

2005-10-21 Thread Lonnie Princehouse
It's not just load_module. Reload fails on modules imported normally if their paths are no longer in sys.path. Easy to reproduce example: bash$ mkdir module_dir bash$ touch module_dir/plugin.py bash$ python Python 2.4.1 (#1, Sep 25 2005, 15:12:45) [GCC 3.4.3 20041125 (Gentoo 3.4.3-r1, ssp-3.4.3-

Re: reload fails if module not in sys.path

2005-10-20 Thread Fredrik Lundh
Lonnie Princehouse wrote: > Maybe it could fall back to module.__file__ if the module isn't found > in sys.path?? > ... or reload could just take an optional path parameter... > > Or perhaps I'm the only one who thinks this is silly: > > >>> my_module = imp.load_module(module_name, > >>> *imp.fin

Re: reload fails if module not in sys.path

2005-10-20 Thread Steve Holden
Lonnie Princehouse wrote: > So, it turns out that reload() fails if the module being reloaded isn't > in sys.path. > > Maybe it could fall back to module.__file__ if the module isn't found > in sys.path?? > ... or reload could just take an optional path parameter... > > Or perhaps I'm the only on

reload fails if module not in sys.path

2005-10-20 Thread Lonnie Princehouse
So, it turns out that reload() fails if the module being reloaded isn't in sys.path. Maybe it could fall back to module.__file__ if the module isn't found in sys.path?? ... or reload could just take an optional path parameter... Or perhaps I'm the only one who thinks this is silly: >>> my_module