Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #11846 > unrolled thread

Re: Execute script from ipython

Started byChris Rebert <clp2@rebertia.com>
First post2011-08-19 08:11 -0700
Last post2011-08-19 08:11 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Execute script from ipython Chris Rebert <clp2@rebertia.com> - 2011-08-19 08:11 -0700

#11846 — Re: Execute script from ipython

FromChris Rebert <clp2@rebertia.com>
Date2011-08-19 08:11 -0700
SubjectRe: Execute script from ipython
Message-ID<mailman.221.1313766701.27778.python-list@python.org>
On Fri, Aug 19, 2011 at 6:00 AM, Johan Ekh <ekh.johan@gmail.com> wrote:
> Hi all,
> I have a script "myscript.py" located in "/usr/local/bin" on my linux box.
> I can execute it in ipython with
>
> run /usr/local/bin/myscript.py
>
> but not with
>
> run myscript.py
>
> even though /usr/local/bin is in my $PATH and in my $PYTHONPATH.
>
> What should I do to correct this?

Given that %run takes a filename and not a module name, I doubt
PYTHONPATH matters. ipython's docs for %run don't seem to indicate
that a search of any kind is performed. So, I'd say you have to either
pass a valid absolute or relative path to myscript.py, or run
myscript.py from bash instead of ipython.

Changing your script's shebang line to ipython might also work
(haven't tried it myself). Or you could try patching ipython's run()
function to add this search feature you desire.

Cheers,
Chris
--
http://rebertia.com

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web