[IPython-user] import local_module requires reload(local_module)
Thu Jan 31 01:48:35 CST 2008
On Jan 24, 2008 8:34 AM, Alan Brogan <firstname.lastname@example.org> wrote:
> Hello the list,
> I have tried list archives and general Googling, but still cannot figure out
> how to crack this one. Hopefully someone on the list can point me towards a
> The question is about "import path", that wonder module from Jason
> Orendorff. I have modified it to pass all the commands through a logger, and
> generally need to import that version of the module. In Python this proceeds
> smoothly when I run from the dir containing my version of path.py, see
> transcript below. But in ipython I need to import, then reload the path
> module. (Again, see transcript below). This reload is also needed when
> importing other modules from this directory, so that instead of a simple
> "import other" I need to do a "import path; reload(path); import other"
> How do I get over this glitch ?
The issue is that IPython ships with Jason's path module in
Extensions, and by default it injects Extensions into sys.path. I'm
not sure this is a good idea, IPython should really leave sys.path
alone, and let users either modify $PYTHONPATH or manually tweak
sys.path in their startup scripts if they so desire.
Unconditionally modifying sys.path is likely to cause problems of this
nature. Ville, I think you introduced that for Extensions, any
particular reason why? I'm thinking this should probably be fixed...
More information about the IPython-user