Paul Moore <p.f.mo...@gmail.com> added the comment:

>From https://docs.python.org/3.7/using/windows.html#shebang-lines the 
>supported shebang lines are

* /usr/bin/env python
* /usr/bin/python
* /usr/local/bin/python
* python

There's a provision in there:

"""
The /usr/bin/env form of shebang line has one further special property. Before 
looking for installed Python interpreters, this form will search the executable 
PATH for a Python executable. This corresponds to the behaviour of the Unix env 
program, which performs a PATH search.
"""

The launcher does *not* implement the full functionality of the Unix "env" 
program, and in particular doesn't support (relative or absolute) paths in the 
Python interpreter part.

While "search PATH for the relative path given in the env shebang line" would 
be a potential feature request, it's not current behaviour, and in my view, 
it's too rare of a scenario to be worth the complexity it would add to the 
launcher.

As a workaround, you can use an absolute path in your shebang line:

#!F:\python\scripts3\.venv\Scripts\python.exe

(Obviously that requires a little more manual management of the shebang lines 
in your scripts).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34359>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to