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:
[color=blue][color=green][color=darkred]
>>> my_module = imp.load_module (module_name, *imp.find_modul e(module_name,p ath))
>>> reload(my_modul e)[/color][/color][/color]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named whatever
I guess I could just deal with this by fiddling with sys.path or using
imp.load_module again, but.. um.. I like to complain. ;-)
The context here is that I'm loading user-defined modules as plugins,
and I don't want to keep the plugin directory in sys.path because of
potential module name conflicts.
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:
[color=blue][color=green][color=darkred]
>>> my_module = imp.load_module (module_name, *imp.find_modul e(module_name,p ath))
>>> reload(my_modul e)[/color][/color][/color]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named whatever
I guess I could just deal with this by fiddling with sys.path or using
imp.load_module again, but.. um.. I like to complain. ;-)
The context here is that I'm loading user-defined modules as plugins,
and I don't want to keep the plugin directory in sys.path because of
potential module name conflicts.
Comment