Getting Python scripts to execute in RedHat
Daniel Nogradi
nogradi at gmail.com
Fri Jun 23 13:47:39 EDT 2006
> I apologise if this is a stupid newbie error, but I've been googling
> "hash bang" and "shebang" all morning. I've added the shebang to my
> scripts:
>
> #!/usr/bin/python
>
> I've added execute permissions:
>
> chmod +rx shebang.py
>
> But I still can't execute my scripts by themselves
>
> shebang.py ## produces error
>
> python shebang.py ## runs correctly
>
> I found one site that mentioned adding "./" to the beginning, and that
> works.
>
> ./shebang.py ## runs correctly.
>
> I gather that there's a path problem then. My script is in
> ~/pyscripts/. How do I get my scripts to run without using "./"?
Add ~/pyscripts to your path for example by putting this into your
.bash_profile if you are using bash:
PATH=$PATH:$HOME/pyscripts
export PATH
HTH,
Daniel
More information about the Python-list
mailing list