Rus Python script interactively

Diez B. Roggisch deets at nospam.web.de
Sat Jul 18 12:39:53 EDT 2009


Gnarlodious schrieb:
> In an interactive session (I am using iPython), what is the most
> elegant way to run a Python script from Terminal? Right now I am
> saying:
> 
> import subprocess
> subprocess.call("python /path/to/scriptname.py", shell=True)
> 
> But I am calling a shell process and I'd rather not. The script just
> runs, no inputs are needed. Is there a more Pythonesque method?

If it's in the path, you can just import it. That will of course only be 
possible once per ipython-session.

Diez



More information about the Python-list mailing list