Open
Description
I would like to search for an executable in the PATH but not from the current working directory (cwd
). By default, as documented in shutil.which
, it prepends the cwd before PATH, so it's not possible to get the expected executable.
For example, I have a whoami.exe
in the cwd but I would like to get the one from the system32 directory; there's no way to do so using shutil.which
.
>>> import shutil
>>> shutil.which('whoami')
'.\\whoami.EXE'
I think it makes sense for that to be the default behaviour since that's how it is on Windows. I would like to have a parameter to disable this behaviour in shutil.which
.
Thanks!