Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42903

Re: Run python script with ./

Path csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <luban.works@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'scripts': 0.03; '&quot;the': 0.07; 'linux,': 0.07; 'tries': 0.07; 'bash': 0.09; 'subject:script': 0.09; 'wrapper': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'command,': 0.16; 'it."': 0.16; 'it.&quot;': 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; 'seems': 0.21; 'email addr:gmail.com&gt;': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'script.': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'header:In- Reply-To:1': 0.27; 'installed': 0.27; 'am,': 0.29; 'unix': 0.29; "doesn't": 0.30; '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; 'fri,': 0.33; 'skip:# 10': 0.33; '"the': 0.34; 'subject:with': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'adjust': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'so,': 0.37; 'being': 0.38; 'work?': 0.38; 'pm,': 0.38; 'skip:. 10': 0.39; 'url:mail': 0.40; 'how': 0.40; 'skip:* 10': 0.61; 'name': 0.63; 'header:Reply-To:1': 0.67; 'nobody': 0.68; 'reply-to:no real name:2**0': 0.71; 'reply- to:addr:gmail.com': 0.80; 'wrapper,': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:reply-to:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=pgNVuUAJZE+VDCV0ed+TKUypUsmZCC+4aflBdlhqFo8=; b=V8oCM4Eyz7FO5yknLu70/0DsH9hlACQwHMRE9UfgQ7wW+5FPh6EumFymPZZv1vj/Me MmY5PP9xD0t0my3ReWZ8xA0SxyBUHVRk8pn+q1Na17mClCSJPVRcxDr4MSfKYjY5uJOY g+oLGJvXo4iJz34d1gAo6HfYWy/ylMTGS5OpPqT/JwY59ijEhyvLjbC1bmVf+Hp+5D3L XcfD3R6PRNivGvSi6FRmLcQKXZ0xn1B3cOuDwedTNv80uxwlVubJNCatm/VY097uFgts JFUDtXlkqwpCiYjRuWg1C6+aAOWGfqEaAdswv16e2QKuvq1g5159MqvqlJBGjx4hiilz 4tYA==
MIME-Version 1.0
X-Received by 10.58.96.72 with SMTP id dq8mr10537212veb.49.1365243301582; Sat, 06 Apr 2013 03:15:01 -0700 (PDT)
In-Reply-To <CADQvV+uNvLe9g_OdgoeWYeWqtGxO9OtPDMj_q09OHnQ_6RG2ow@mail.gmail.com>
References <CALpAWgMZv=0Pvtz7sDUgMHjR94J7gOjGKGL3iYRqEyWjUXLeTA@mail.gmail.com> <CADQvV+uNvLe9g_OdgoeWYeWqtGxO9OtPDMj_q09OHnQ_6RG2ow@mail.gmail.com>
Date Sat, 6 Apr 2013 18:15:01 +0800
Subject Re: Run python script with ./
From LubanWorks <luban.works@gmail.com>
To Dylan Evans <dylan@dje.me>
Content-Type multipart/alternative; boundary=089e013a258605db3204d9ae7a55
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To LubanWorks@gmail.com
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.196.1365243311.3114.python-list@python.org> (permalink)
Lines 129
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365243311 news.xs4all.nl 6879 [2001:888:2000:d::a6]:60685
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:42903

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

I have test that wrapper, under Bash 4.1.2, ./myscript.py works, it doesn't
work under Bash 3.2.25, seems Bash relative.

http://stackoverflow.com/questions/15838183/run-python-script-with-dot-slash


On Fri, Apr 5, 2013 at 11:58 PM, Dylan Evans <dylan@dje.me> wrote:

>
>
>
> 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
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Run python script with ./ LubanWorks <luban.works@gmail.com> - 2013-04-06 18:15 +0800

csiph-web