execute script everywhere

Erik Max Francis max at alcyone.com
Sun Mar 14 05:14:42 CET 2004


myang wrote:

> After we compile a C program, we can put the executable file under a
> directory (like /bin) so that we can run it everywhere, and don't have
> to
> type the full path.
> Can we do the same thing to a python script?
> For example, I have a script.py under "/home/john/". Can I just type
> "python
> script.py" to run it under another directory "/home/tom/"?

Make sure it has a proper bangpath, make it executable, and then put it
somewhere in your PATH.  Then you can run it no matter what your pwd is
with

	script.py

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ Courage is the fear of being thought a coward.
    -- Horace Smith



More information about the Python-list mailing list