[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2021-01-25 Thread Mitchell Young
Mitchell Young added the comment: I am struggling with the same issue as Anthony. To provide a more direct response to Manjusaka's query: python -c "import os; print(os.environ.get(\"PATHEXT\", \"\").split(os.pathsep))" ['.COM', '.EXE', '.BAT', '.CMD', '.VBS', '.VBE', '.JS', '.JSE', '.WSF',

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2020-01-22 Thread Anthony Sottile
Anthony Sottile added the comment: sure, it's the standard PATHEXT (basically a fresh vm from modern.ie) -- the only reason I noticed this is I was reading the source: https://github.com/python/cpython/blob/5bbac8cbdf140ebce446ea4e7db2b20a5d7b8402/Lib/shutil.py#L1367-L1373 C:\Users\IEUser>

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2020-01-22 Thread Manjusaka
Manjusaka added the comment: Hello Anthony would you mind to execute this command on your PC? python -c "import os; print(os.environ.get("PATHEXT", "").split(os.pathsep))" and show the result about this code? -- nosy: +Manjusaka ___ Python tracke

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2020-01-21 Thread Anthony Sottile
Anthony Sottile added the comment: should I open a new issue for this, or is this an appropriate task to add to this discussion shutil.which also doesn't apply `PATHEXT` when the path contains a directory separator C:\Users\IEUser\astpretty>venv\Scripts\python --version Python 3.7.5 C:\Use

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2019-08-27 Thread Роман Донченко
Change by Роман Донченко : -- nosy: +SpecLad ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2018-09-26 Thread Eryk Sun
Eryk Sun added the comment: In a patch review [1] for issue 24505, I had a discussion with Toby Tobkin about extending the behavior of shutil.which() on Windows. This was to match the behavior of the CMD shell, including securing the search path via NeedCurrentDirectoryForExePath, searching

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2018-09-26 Thread Steve Dower
Steve Dower added the comment: It certainly doesn't match "which" semantics, but given the F_OK and X_OK flags I can see cases where it ought not to. I'm not sure it does what it implies for those either though. I can see uses for "find files according to 'which'" and "find executable files

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2018-09-26 Thread Ryan McCampbell
Ryan McCampbell added the comment: This is how windows looks up commands, as well as the built in "where" command. (Note that windows doesn't actually distinguish between "executable" files and just plain old files, so this could be confusing for UNIX users... a text file for instance will s

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2018-09-26 Thread Paul Moore
Paul Moore added the comment: On further reflection, I'm less sure that the proposed behaviour is the best option, but I do think this warrants further consideration. -- ___ Python tracker _

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2018-09-26 Thread Paul Moore
Paul Moore added the comment: I don't think this is expected behaviour. It's not documented what should happen in this case but the behaviour suggested by the OP (to search for the path as given, followed by [path+e for e in os.environ['PATHEXT'].split(os.pathsep)] seems reasonable to me. T

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2018-09-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Isn't this an expected behavior? -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-b

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2018-09-26 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I am adding windows as a component during triaging since PATHEXT seems to be windows specific. Unfortunately, I couldn't verify this since I don't have windows system to check this against master so leaving it to 3.6. Thanks -- components:

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2018-09-26 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue31405] shutil.which doesn't find files without PATHEXT extension on Windows

2017-09-09 Thread Ryan McCampbell
New submission from Ryan McCampbell: On windows, shutil.which does not match the semantics of built-in command lookup. If you pass the name of a script like foo.py and the PATHEXT variable doesn't include .py it will search for foo.py.exe, foo.py.bat, foo.py.cmd, etc. but not foo.py, which sho