> On 18 Nov 2019, at 22:42, Wildman via Python-list <python-list@python.org> > wrote: > > On Mon, 18 Nov 2019 22:15:31 +0100, Peter J. Holzer wrote: > >>> On 2019-11-18 15:01:57 -0600, Wildman via Python-list wrote: >>> On Tue, 19 Nov 2019 05:09:07 +1100, Chris Angelico wrote: >>>> On Tue, Nov 19, 2019 at 5:06 AM Wildman via Python-list >>>> <python-list@python.org> wrote: >>>>> On Sun, 17 Nov 2019 18:27:45 +0000, Barry Scott wrote: >>>>>> Because you are installing from a deb you know the exact path to the >>>>>> python you >>>>>> need to use. There is no need to use the /usr/bin/env to search the path >>>>>> and >>>>>> potential break your code, because a version of python that you do not >>>>>> expect is on >>>>>> the path. >>>>> >>>>> I don't understand. The deb does not install python so I >>>>> fail to see how I would know the exact path. >>>>> >>>>> As to env breaking my code, never heard of such a thing. >>>>> >>>> >>>> The deb should depend on an appropriate Python package. Then you can >>>> assume and expect that this version of Python is installed. >>> >>> Yes, of course, python(3) is listed as a "depends" in the deb >>> control file. That does insure that python is installed but >>> in no way does that tell me the path of the python executable. >> >> The debian packaging guidelines tell you where the execuable has to be. >> If you install the python package you can be very sure that the >> executable will be in /usr/bin. And this is the executable you want to >> use. You don't want to use some other random program called "python" >> (which may or may not be an interpreter for some version of the Python >> language) which just happens to be in the user's path. >> >> hp > > Yes, /usr/bin is the likely place to find the python executable > but a guideline is not a guarantee.
It will be in /usr/bin because the python package cannot change that with users getting very upset. > I have always been taught > it is never a good idea to use a hard path unless it is something > installed with your program or something created by your program. > That approach has not failed me. That is not true for packagers, the reverse is true use exact paths. The use of env to find a program on the path is reasonable if you cannot know where python might be installed. Often the case when publishing scripts. Barry > > -- > <Wildman> GNU/Linux user #557453 > The cow died so I don't need your bull! > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list