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


Groups > comp.lang.python > #98851

Re: What meaning is of '#!python'?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Rob Hills <rhills@medimorphosis.com.au>
Newsgroups comp.lang.python
Subject Re: What meaning is of '#!python'?
Date Sun, 15 Nov 2015 11:10:54 +0800
Lines 44
Message-ID <mailman.348.1447557067.16136.python-list@python.org> (permalink)
References <ed2472ca-7efb-4676-b49e-356260dd533c@googlegroups.com> <mailman.340.1447552722.16136.python-list@python.org> <3aa2f352-ea19-4252-9a09-c884887cf810@googlegroups.com> <CAPTjJmqs7yEeana50mH0PxayiUwsSBXeye2_gKcEFbUkbVQeWQ@mail.gmail.com>
Reply-To rhills@medimorphosis.com.au
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de RNcKL+253jBLV3uAwLLRfABbUYA6EFLgw5LHRZGrERjw==
Return-Path <rhills@medimorphosis.com.au>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python': 0.10; 'systems.': 0.11; 'ignore': 0.14; 'subject:python': 0.14; '.py': 0.16; '1:13': 0.16; 'abusing': 0.16; 'executable,': 0.16; 'executable.': 0.16; 'numpy': 0.16; 'quoted': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'wrote:': 0.16; 'copied': 0.18; 'script.': 0.18; 'email addr:gmail.com&gt;': 0.18; 'shell': 0.18; '2015': 0.20; 'work,': 0.21; 'file:': 0.22; '(or': 0.23; 'originally': 0.23; 'tried': 0.24; 'import': 0.24; 'header:In- Reply-To:1': 0.24; 'script': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'example': 0.26; 'command': 0.26; 'chris': 0.26; 'skip:# 10': 0.27; 'looks': 0.29; 'starts': 0.29; '15,': 0.30; 'run': 0.33; 'common': 0.33; 'file': 0.34; 'nov': 0.35; 'to:addr :python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'operating': 0.37; 'someone': 0.38; 'sure': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'australia': 0.61; 'charset:windows-1252': 0.62; 'more': 0.63; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'chrisa': 0.84; 'eg:': 0.84; 'url:php': 0.86; 'western': 0.89; 'comment.': 0.91; 'hills': 0.93; 'imagine': 0.96
X-Enigmail-Draft-Status N1110
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
In-Reply-To <CAPTjJmqs7yEeana50mH0PxayiUwsSBXeye2_gKcEFbUkbVQeWQ@mail.gmail.com>
X-Content-Filtered-By Mailman/MimeDel 2.1.20+
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:98851

Show key headers only | View raw


On 15/11/15 10:18, Chris Angelico wrote:
> On Sun, Nov 15, 2015 at 1:13 PM, fl <rxjwg98@gmail.com> wrote:
>> Excuse me. Below is copied from the .py file:
>>
>> #!python
>> from numpy import *
>> from numpy.random import *
>>
> Then someone doesn't know how to use a shebang (or is deliberately
> abusing it), and you can ignore it. It starts with a hash, ergo it's a
> comment.
>
> ChrisA

Looks like the author of the script file has tried to create a Python
Shell script.  This link describes them in detail:

http://www.dreamsyssoft.com/python-scripting-tutorial/intro-tutorial.php

Not sure whether the example originally quoted would work, I imagine it
might on some 'nix operating systems.

The more common first line is:

    #!/usr/bin/env python

If you start a script file with this line and make the file executable,
you can then run the script from the command line without having to
preface it with a reference to your Python executable.  Eg:

    my-script.py


versus

    python my-script.py


HTH,

-- 
Rob Hills
Waikiki, Western Australia

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


Thread

What meaning is of '#!python'? fl <rxjwg98@gmail.com> - 2015-11-14 17:54 -0800
  Re: What meaning is of '#!python'? Chris Angelico <rosuav@gmail.com> - 2015-11-15 12:58 +1100
    Re: What meaning is of '#!python'? fl <rxjwg98@gmail.com> - 2015-11-14 18:13 -0800
      Re: What meaning is of '#!python'? Chris Angelico <rosuav@gmail.com> - 2015-11-15 13:18 +1100
      Re: What meaning is of '#!python'? Rob Hills <rhills@medimorphosis.com.au> - 2015-11-15 11:10 +0800
  Re: What meaning is of '#!python'? Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-11-14 20:26 -0600
  Re: What meaning is of '#!python'? Michael Torrie <torriem@gmail.com> - 2015-11-14 19:28 -0700
  Re: What meaning is of '#!python'? eryksun <eryksun@gmail.com> - 2015-11-14 23:57 -0600
  Re: What meaning is of '#!python'? <paul.hermeneutic@gmail.com> - 2015-11-15 21:54 -0700

csiph-web