executing a python program by specifying only its name in terminal or command line

Steve Holden steve at holdenweb.com
Tue Feb 26 09:47:09 CET 2008


bharath venkatesh wrote:
> hi,
>    i wanna run a python program by specifying  only its  name ex prog 
> with the arguments in the terminal or command line instead of specifying 
> python prog in the terminal to run the program   not even specifying the 
> it with .py extension ..
> for example i want to run the python program named prog by sepcifying
> $prog -arguments
> instead of
> $python prog -arguments
> or
> $prog.py -arguments
> can anyone tell me how to do it
> 
reseach pathext for Windows.

For Unix-like systems use the shebang (#!) line, and don't put a .py at 
the end of the filename.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list