Steve Dower <steve.do...@python.org> added the comment:

> But then I need two separate workflows based on what is passed in. For py.exe 
> I need to run it and get sys.executable. But for python.exe I *cannot* use 
> sys.executable because that’s the base interepeter, not the venv path I want. 
> And `if Path(arg).stem == "py"` just seems like a bug waiting to happen.

If you use shutil.which() to resolve "python" or "py" against PATH (which 
doesn't include the application directory), then you'll get the full path to 
the correct python.exe and will get the expected sys.executable. So it's only 
one flow that works for both once you add the shutil.which step.

----------

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

Reply via email to