Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: Run python script with ./ (http://www.velocityreviews.com/forums/t959450-re-run-python-script-with.html)

Dylan Evans 04-05-2013 03:58 PM

Re: Run python script with ./
 
On Sat, Apr 6, 2013 at 1:04 AM, LubanWorks <luban.works@gmail.com> wrote:
>
>
>
> My question is:
>
> Why when I use #!/home/luban/Linux/Python/2.7.3/bin/python at the
> beginning of myscript.py, *./*myscript.py can work,
>
> but if I use the wrapper #!/home/luban/bin/python in my python script, use
> *./* to run the script, it cannot not work?
>


Your shell will be trying to run your python script. The reason being that
when you do #!/bin/sh in the wrapper the shell tries to execute $0 which in
this case is the name of your python script.


>
>
> I had many scripts used #!/home/luban/bin/python when I only installed
> python under #!/home/luban/ for Linux, they can run with ./, I don't want
> to change them,
>
> so, how to let ./ run the python script If I want to *KEEP* wrapper
> #!/home/luban/bin/python as the shebang line?
>
>

Probably easier to use a symlink, or just use #!python and adjust your
$PATH.


>
> Best Regards,
> Luban
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>



--
"The UNIX system has a command, nice ... in order to be nice to the other
users. Nobody ever uses it." - Andrew S. Tanenbaum



All times are GMT. The time now is 12:19 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.