[issue28686] py.exe ignored PATH when using python3 shebang

2022-02-04 Thread Segev Finer
Change by Segev Finer : -- nosy: +Segev Finer ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28686] py.exe ignored PATH when using python3 shebang

2020-03-18 Thread Riccardo Polignieri
Riccardo Polignieri added the comment: Three years later, this problem seems on the way to fix itself (https://xkcd.com/1822/). Versioned shebangs (and versioned "/env" shebangs) used to be a more prominent issue when you needed a way to tell Python 2 / Python 3 scripts apart. With the

[issue28686] py.exe ignored PATH when using python3 shebang

2020-02-28 Thread fireattack
fireattack added the comment: More interestingly, I can't reproduce the same bug on my another Win 7 machine with similar setup. -- ___ Python tracker ___

[issue28686] py.exe ignored PATH when using python3 shebang

2020-02-28 Thread fireattack
fireattack added the comment: Just copy/paste a related issue reported in issue39785: When run a python script with "#!/usr/bin/python" shebang with py.exe, it will always use python2 instead of python3 on Win 10, despite the default being set to py3 already (so does the PATH). According

[issue28686] py.exe ignored PATH when using python3 shebang

2020-02-28 Thread Steve Dower
Steve Dower added the comment: So we're missing two things to move this forward: 1. A clear specification (and user-facing explanation) of the behaviour of py.exe in the presence of all possible shebangs and PATH settings 2. Someone willing to update the code Given the current behaviour is

[issue28686] py.exe ignored PATH when using python3 shebang

2017-06-07 Thread Riccardo Polignieri
Riccardo Polignieri added the comment: @Jens Lindgren I know, pretty annoying right? But see previous answer by Paul here http://bugs.python.org/issue28686#msg287181 > The Unix ability to have 2 different versions of Python on PATH > and select which you use based on executable name doesn't

[issue28686] py.exe ignored PATH when using python3 shebang

2017-06-07 Thread Jens Lindgren
Jens Lindgren added the comment: Sorry I need to clarify. On Linux both python and python3 works as there is a symlink created from python to python3 in the venv folder. On Windows only python.exe is created. I copied it to python3.exe. Now I can use python3 script.py to start but py-launcher

[issue28686] py.exe ignored PATH when using python3 shebang

2017-06-07 Thread Jens Lindgren
Jens Lindgren added the comment: I just got hit by this bug and would like to add my thoughts on this. If you are in an activated venv, no matter if you launch with command python or python3, it will launch the version in venv (version 3.6.1 in this case). I expect the py-launcher and shebang

[issue28686] py.exe ignored PATH when using python3 shebang

2017-05-14 Thread Paul Moore
Paul Moore added the comment: > Since we don't AFAIK have any possibility of mixed virtual environments > ignoring SheBangs should meet the basic requirements of operating inside of a > venv. If you want a script to use the current environment, then #!/usr/bin/env python does that. There's

[issue28686] py.exe ignored PATH when using python3 shebang

2017-05-14 Thread Vinay Sajip
Vinay Sajip added the comment: > If the user is operating in a virtual environment they are ring fenced and, > presumably, don't wish any other versions of python to be used I'm not sure that's true. I have a number of tools which rely on specific libraries and so I have created venvs for

[issue28686] py.exe ignored PATH when using python3 shebang

2017-05-14 Thread Steve Barnes
Steve Barnes added the comment: If the user is operating in a virtual environment they are ring fenced and, presumably, don't wish any other versions of python to be used, (regardless of the SheBang in the files). Since we don't AFAIK have any possibility of mixed virtual environments

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-22 Thread Vinay Sajip
Changes by Vinay Sajip : -- nosy: +vinay.sajip ___ Python tracker ___ ___

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-08 Thread Eryk Sun
Eryk Sun added the comment: If the system doesn't have a "python3.exe" on PATH, then "env python3" will run a registered version, exactly like it currently does. IMO, this is slightly less confusing than the current behavior, which skips searching PATH in this case. We can take it a step

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-08 Thread Riccardo Polignieri
Riccardo Polignieri added the comment: Paul: > When inside a venv: - If you want to execute a script, use a shebang of #!/usr/bin/env python and then use `py myscript.py` Yes, I'm totally on board with this - that is, as far as I run my own scripts. I just wonder, what if one day I pip

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-08 Thread Eryk Sun
Eryk Sun added the comment: > it's not possible to tell by inspection the version of a Python > interpreter. If getting the version of python[w].exe is ever required, it should be simple for 3.5+, for which python[w].exe has standard file version information with the product version (i.e.

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-07 Thread Paul Moore
Paul Moore added the comment: > - when inside a venv (almost always) go 'python' the old way, because 'py' is > unreliable here, *unless* you manually check the shebang of your scripts > before you execute them. No. When inside a venv: - If you want to use the interactive interpreter, use

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-07 Thread Riccardo Polignieri
Riccardo Polignieri added the comment: Paul: > it's not possible to tell by inspection the version of a Python interpreter. True, but it's an implementation detail. Couldn't be solved? Versioned interpreters a la Linux, of course, or maybe how about including some kind of manifest file?

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-06 Thread Paul Moore
Paul Moore added the comment: I agree, I don't particularly want versioned executables. I'm not sure I see much point to even having versioned launchers - "py -2" and "py -3" seem fine to me if needed. The only use cases I can see are: 1. Use the Python executable that's first on PATH: "py"

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-06 Thread Steve Dower
Steve Dower added the comment: > If Python on Windows changed to ship python3.exe and python37.exe alongside > python.exe, then it might be worth revisiting this discussion Agreed, though if we started including versioned executables wouldn't that resolve this issue naturally? (As in, we'd

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-06 Thread Paul Moore
Paul Moore added the comment: > 2) you really want to have meaningful shebangs (ie, version-specific) in your > scripts because, well, 2017 and the world is still split between py2 and py3, This is the one I think is overspecifying. I don't see a really *good* reason for not just saying

[issue28686] py.exe ignored PATH when using python3 shebang

2017-02-06 Thread Riccardo Polignieri
Riccardo Polignieri added the comment: > I'm inclined to say YAGNI, and we simply leave "/usr/bin/env python3" > undefined. I can't say I'm really happy with this answer. Fact is, 1) you almost always have to work from within a virtual env these days, 2) you really want to have meaningful

[issue28686] py.exe ignored PATH when using python3 shebang

2016-11-14 Thread Paul Moore
Paul Moore added the comment: I agree that the docs are a little confusing on this. Having said that, though, I'm not entirely sure the behaviour needs fixing. The scenario where there's a problem is: 1. User has written a script that needs Python 3 and won't run with Python 2. 2. User does

[issue28686] py.exe ignored PATH when using python3 shebang

2016-11-14 Thread wdhwg001
wdhwg001 added the comment: Okay. But somehow I still think the current way of handling shebang is confusing. That makes a python3-only script unable to find a way to use both versioned shebang and virtualenv. Maybe it could be changed to `Command is eligible for path search, or there is no

[issue28686] py.exe ignored PATH when using python3 shebang

2016-11-14 Thread Eryk Sun
Eryk Sun added the comment: Virtual commands that are parsed to start with "python" are restricted to the list of installed versions of Python -- unless the virtual command allows searching and the Python command has no version specification (e.g.`#! /usr/bin/env python`). "python3" is

[issue28686] py.exe ignored PATH when using python3 shebang

2016-11-14 Thread wdhwg001
wdhwg001 added the comment: And during the entire testing procedure, `C:\Users\wdhwg001\study\venv\Scripts` was manually added to user `PATH` and system `PATH`, but `py.exe` cannot find the hardlinked `python3.exe` in there. -- ___ Python tracker

[issue28686] py.exe ignored PATH when using python3 shebang

2016-11-14 Thread wdhwg001
wdhwg001 added the comment: But actually after I created a `python3.bat` into venv/Scripts, the shebang `#! /usr/bin/env python3` still does not take the `python3.bat`. Then I created a hardlink from `python.exe` to `python3.exe`, the shebang still does not work. I didn't check the code of

[issue28686] py.exe ignored PATH when using python3 shebang

2016-11-14 Thread Paul Moore
Paul Moore added the comment: 1. I don't think searching . should be included - on Unix /usr/bin/env searches PATH, and I believe we should do the same here. 2. The PATH search does happen (from my reading of the code) but it looks for a "python3" command, which isn't available. Again this is

[issue28686] py.exe ignored PATH when using python3 shebang

2016-11-14 Thread wdhwg001
New submission from wdhwg001: https://github.com/pypa/virtualenv/issues/979 TL;DR py.exe does not search PATH when using `#! /usr/bin/env python3`. And the right steps I think should be: 1. Search ./ 2. Search PATH 3. Fallback to system installed Python 3 But currently py.exe seems only do