Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.maint.python > #8622
| From | Ben Finney <ben+debian@benfinney.id.au> |
|---|---|
| Newsgroups | linux.debian.maint.python |
| Subject | Re: Python program as a command-line program |
| Date | 2016-06-27 09:00 +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> |
| Organization | linux.* mail to news gateway |
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
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