Re: Run python script with ./

Discussion in 'Python' started by Dylan Evans, Apr 5, 2013.

  1. Dylan Evans

    Dylan Evans Guest

    On Sat, Apr 6, 2013 at 1:04 AM, LubanWorks <> 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
     
    Dylan Evans, Apr 5, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    476
  2. Replies:
    1
    Views:
    342
    Larry Bates
    Dec 14, 2006
  3. sophie_newbie

    Error when python script run as cgi script

    sophie_newbie, Oct 21, 2007, in forum: Python
    Replies:
    3
    Views:
    606
    Dennis Lee Bieber
    Oct 22, 2007
  4. Replies:
    1
    Views:
    473
    Gabriel Genellina
    Apr 7, 2008
  5. Replies:
    9
    Views:
    981
    Paddy O'Loughlin
    Feb 27, 2009
Loading...

Share This Page