Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'scripts': 0.03; '"the': 0.07; 'linux,': 0.07; 'tries': 0.07; 'received:209.85.219': 0.09; 'subject:script': 0.09; 'wrapper': 0.09; 'python': 0.11; 'command,': 0.16; 'it."': 0.16; 'it."': 0.16; 'script,': 0.16; 'subject:python': 0.16; 'sat,': 0.16; 'skip:# 20': 0.16; 'wrote:': 0.18; 'users.': 0.18; 'trying': 0.19; 'work,': 0.20; 'email addr:gmail.com>': 0.22; 'shell': 0.22; 'script.': 0.24; 'question': 0.24; 'script': 0.25; 'header:In- Reply-To:1': 0.27; 'installed': 0.27; 'am,': 0.29; 'unix': 0.29; 'andrew': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'easier': 0.31; 'probably': 0.32; 'run': 0.32; 'url:python': 0.33; 'beginning': 0.33; 'skip:# 10': 0.33; 'to:name:python-list': 0.33; '"the': 0.34; 'subject:with': 0.35; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'adjust': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'so,': 0.37; 'received:209': 0.37; 'being': 0.38; 'work?': 0.38; 'to:addr :python-list': 0.38; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'skip:* 10': 0.61; 'name': 0.63; 'nobody': 0.68; '2013': 0.98 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:x-originating-ip:in-reply-to:references :date:message-id:subject:from:to:content-type:x-gm-message-state; bh=6AgnC0W2o+wR29TJXRo+bRrYlIlDUBxFtbWeCCV5UZU=; b=OwFPD+ACEy9Ckiy1zLuTah6LsSOxssTlHpCTxaULUw+LvvEBya9mzF6yFOuux8F2+c uBt42HLFwANihFNB6w+ym1/CI4c8bxZGWC53YolvgiVtgTCsmznsoldOFhXWekRRik3b 3OMwujfMPOIaOamcfONaQCBa8RZ3AuLilZs7Ez2DslWXLzCy5IBjNhqbbK4X8KhduV9a 1sl4wC4idPM4FCAx35sw+UYC+v2vP6J9ar1DS2Avy/KPyhKV8HszRenjvqyfV7u0xVtl zUmYoRnFDsg8RpwZhm1t/gRN7TaJAbxnrqPxYX/X0GuoSFIG09NeiZ+ESzN9MGzO1kn5 +tbQ== MIME-Version: 1.0 X-Received: by 10.60.133.82 with SMTP id pa18mr8329494oeb.30.1365177508900; Fri, 05 Apr 2013 08:58:28 -0700 (PDT) X-Originating-IP: [220.245.216.139] In-Reply-To: References: Date: Sat, 6 Apr 2013 01:58:28 +1000 Subject: Re: Run python script with ./ From: Dylan Evans To: python-list Content-Type: multipart/alternative; boundary=047d7b414bb279490504d99f287d X-Gm-Message-State: ALoCoQnINPWNIdhW499N6tK/RzBL85r1nN/mq16i0B+kDJumTPjy/i82BZovLt3dHVhCOTAiW6oI X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 93 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365177512 news.xs4all.nl 6903 [2001:888:2000:d::a6]:43161 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42834 --047d7b414bb279490504d99f287d Content-Type: text/plain; charset=ISO-8859-1 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 --047d7b414bb279490504d99f287d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable



On Sat, Apr 6, 2013 at 1:04 AM, LubanWorks <luban.works@gmail.= com> wrote:


My question is:

Why=A0 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 ./=A0 to run the sc= ript, it cannot not work?

Your sh= ell will be trying to run your python script. The reason being that when yo= u do #!/bin/sh in the wrapper the shell tries to execute $0 which in this c= ase is the name of your python script.
=A0


I had many scrip= ts used #!/home/luban/bin/python when I only installed python=A0 under #!/h= ome/luban/ for Linux, they can run with ./, I don't want to change them= ,

so, how to let ./ run the p= ython script If I want to KEEP<= /span> wrapper #!/home/luban/b= in/python as the shebang line?


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

Best Regards,
Luban

--
http://mail.python.org/mailman/listinfo/python-list




--
&qu= ot;The UNIX system has a command, nice ... in order to be nice to the other= users. Nobody ever uses it." - Andrew S. Tanenbaum
--047d7b414bb279490504d99f287d--