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


Groups > linux.debian.maint.python > #8622

Re: Python program as a command-line program

Path csiph.com!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!news.glorb.com!bofh.it!news.nic.it!robomod
From Ben Finney <ben+debian@benfinney.id.au>
Newsgroups linux.debian.maint.python
Subject Re: Python program as a command-line program
Date Mon, 27 Jun 2016 09:00:02 +0200
Message-ID <rOyGu-5ah-9@gated-at.bofh.it> (permalink)
References <rMBfr-2Hb-9@gated-at.bofh.it> <rMF9n-57L-25@gated-at.bofh.it> <rN19U-2q7-13@gated-at.bofh.it> <rN1tg-2Ol-11@gated-at.bofh.it> <rNEXD-3Se-13@gated-at.bofh.it>
X-Mailbox-Line From debian-python-request@lists.debian.org Mon Jun 27 06:55:10 2016
Old-Return-Path <debian-python@m.gmane.org>
X-Amavis-Spam-Status No, score=-9.125 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, HEADER_FROM_DIFFERENT_DOMAINS=0.001, LDO_WHITELIST=-5, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-1.426] autolearn=ham autolearn_force=no
X-Policyd-Weight using cached result; rate: -6.1
X-Injected-Via-Gmane http://gmane.org/
Lines 31
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock sha1:oDvcOoGmxeJQeGgh+cHv8CJLfIY=
X-Mailing-List <debian-python@lists.debian.org> archive/latest/13955
List-ID <debian-python.lists.debian.org>
List-URL <https://lists.debian.org/debian-python/>
List-Archive https://lists.debian.org/msgid-search/854m8fw28q.fsf@benfinney.id.au
Approved robomod@news.nic.it
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Date Mon, 27 Jun 2016 16:54:29 +1000
X-Original-Message-ID <854m8fw28q.fsf@benfinney.id.au>
X-Original-References <20160621211338.GC2172@hle.local> <8537o6xbf6.fsf@benfinney.id.au> <20160622205419.2f58379f.barry@wooz.org> <85k2hgwvoc.fsf_-_@benfinney.id.au> <20160624152733.551f7118.barry@wooz.org>
X-Original-X-Complaints-To usenet@ger.gmane.org
Xref csiph.com linux.debian.maint.python:8622

Show key headers only | View raw


Barry Warsaw <barry@debian.org> writes:

> On Jun 23, 2016, at 11:17 AM, Ben Finney wrote:
>
> >There isn't, AFAIK, anything portable that I can write in the shebang
> >to turn a command invocation of ‘./foo/bar.py’ into ‘python3 -m
> >foo.bar’.
>
> Why not just have a file that contains only?
>
>     exec python3 -m foo.bar

Because that's not something I can write in the shebang of an existing
Python file, and expect it to work as I move around the directory that
contains the file.

There's no obvious way to tell the kernel (via the shebang line in the
Python file) how to execute this file via a Python interpreter, without
hitting the failure scenarios documented in PEP 366.

This is unlike Perl. Heck, it's unlike Make and Awk and Sed.

The case I'm making is that Python breaks the “put the interpreter
command in the shebang, and it'll work” criterion for Python to be
called a Unix scripting language.

-- 
 \       “I am amazed, O Wall, that you have not collapsed and fallen, |
  `\            since you must bear the tedious stupidities of so many |
_o__)                  scrawlers.” —anonymous graffiti, Pompeii, 79 CE |
Ben Finney

Back to linux.debian.maint.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Python package providing both modules and an app Hugo Lefeuvre <hle@debian.org> - 2016-06-21 23:20 +0200
  Re: Python package providing both modules and an app Ben Finney <ben+debian@benfinney.id.au> - 2016-06-22 03:30 +0200
    Re: Python package providing both modules and an app Hugo Lefeuvre <hle@debian.org> - 2016-06-22 22:00 +0200
      Re: Python package providing both modules and an app Ben Finney <ben+debian@benfinney.id.au> - 2016-06-23 03:10 +0200
        Re: Python package providing both modules and an app Hugo Lefeuvre <hle@debian.org> - 2016-06-23 18:40 +0200
          Re: Python package providing both modules and an app Hugo Lefeuvre <hle@debian.org> - 2016-06-30 08:30 +0200
      Re: Python package providing both modules and an app Thomas Goirand <zigo@debian.org> - 2016-07-05 10:50 +0200
    Re: Python package providing both modules and an app Barry Warsaw <barry@debian.org> - 2016-06-23 03:00 +0200
      Python program as a command-line program (was: Python package providing both modules and an app) Ben Finney <ben+debian@benfinney.id.au> - 2016-06-23 03:20 +0200
        Re: Python program as a command-line program (was: Python package  providing both modules and an app) Barry Warsaw <barry@debian.org> - 2016-06-24 21:30 +0200
          Re: Python program as a command-line program Ben Finney <ben+debian@benfinney.id.au> - 2016-06-27 09:00 +0200
      Re: Python package providing both modules and an app Ian Cordasco <graffatcolmingov@gmail.com> - 2016-06-23 03:30 +0200
  Re: Python package providing both modules and an app Thomas Goirand <zigo@debian.org> - 2016-07-05 10:40 +0200
    Re: Python package providing both modules and an app Hugo Lefeuvre <hle@debian.org> - 2016-07-05 16:50 +0200
      Re: Python package providing both modules and an app Thomas Goirand <zigo@debian.org> - 2016-07-05 21:00 +0200

csiph-web