[IPython-user] Can "import" module, then "run" cannot find it

Jonathan March JDM@MarchRay....
Mon Feb 22 20:34:58 CST 2010


You can use run - just specify the path to the module.

On Mon, Feb 22, 2010 at 1:13 AM, Thomas Baker <tbaker@tbaker.de> wrote:

> Hi Jörgen,
>
> > The reason for your confusion is that sys.path is the path used for the
> > python import mechanism but the run magic of ipython only looks in the
> > current directory.
>
> Okay - that does explain it - thank you!
>
> So if I want to run code, within ipython, but from a directory
> other than the directory where the code is located, I cannot use
> %run.  But I guess if I %edit the code, %edit will find it wherever
> it is in my path, and when I exit the editor, the code will be
> executed.  Would that be any different than using %run to execute
> the code?
>
> Many thanks,
> Tom Baker
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20100222/4ef1cf98/attachment.html 


More information about the IPython-user mailing list