[IPython-user] autoreload 1 and aimport don't seem to work
Pauli Virtanen
pav@iki...
Sat Aug 30 16:02:43 CDT 2008
Sat, 30 Aug 2008 13:53:57 -0700, khosra wrote:
> I am using 0.9.rc1 and have 'import ipy_autoreload' in ipy_user_conf.py.
> I can get aimport to work only with modules in the current directory. I
> am probably not understanding the documentation. What am I doing
> incorrectly? First time I tried this feature.
[clip]
> In [5]: reload_test.reload_me # didn't seem to load
>
>
---------------------------------------------------------------------------
> NameError Traceback (most recent call
> last)
>
> /home/amir/python/<ipython console> in <module>()
>
> NameError: name 'reload_test' is not defined
It's a bug (my bad, sorry!), incorrect use of __import__ in the
autoreload extension. Instead of
mod = __import__(modname)
ip.to_user_ns({modname: mod})
it should say
__import__(modname)
ip.to_user_ns({modname: sys.modules[modname]})
in ipy_autoreload.py
You should still be able to do
aimport reload_test.reload_me
import reload_test.reload_me
and then hopefully works.
--
Pauli Virtanen
More information about the IPython-user
mailing list