Shell: run script

Logan logan at phreaker.nospam
Wed Nov 26 20:48:02 CET 2003


On Wed, 26 Nov 2003 18:40:05 +0000, leroybt.rm wrote:

> Can someone tell me how to run a script from a interactive shell
> 
> I type the following:
> 
>>>>python filename
>>>>python filename.py
>>>>run filename
>>>>run filename.py
>>>>/run filename
>>>>/run filename.py
> 
> and in all cases I get errors. I can't believe I can not run
> a script from the shell.

Normally, you do not want to run your scripts from a Python shell,
but from the bash etc. (Linux shells) or from a DOS console 
(Windows) etc. For this, you use: 

    python <path_to_file>

If you really want to run a script from the Python shell, the 
following will do: 

    execfile("<path_to_file>")

HTL, L.


-- 
mailto: logan at phreaker(NoSpam).net





More information about the Python-list mailing list