You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem: backwards compatibility with old python scripts using non-standard shebang lines is not available. Old py launcher supported such shebangs, new one cannot.
example:
python script:
#!/opt/indel/bin/indel-python2
import traceback
import time
I really don't want shebangs to become a "run arbitrary executable" feature here - a lot of malicious code loves to hide behind legitimate programs, and we want py.exe to be treated as a legitimate program. So that really puts me off having it launch anything that it isn't responsible for.1
Would it work if you could map an arbitrary command like /opt/indel/bin/indel-python2 to a -V option, like "/opt/indel/bin/indel-python2": "-V:PythonCore\\2.7"? Non-standard Python installs can be registered using PEP 514 for this (you can test if it's already registered with py -V:2.7), and managed ones (which we hope will be the future) are of course included.
If you really do need a tool that handles shebangs to arbitrary executable, then I think you may need to find it elsewhere. We want the Python launcher to launch Python, not anything.
Footnotes
Malicious code can, of course, replace those legitimate executables and "win" that way, but that's outside of our threat model. ↩
Activity
zooba commentedon Apr 10, 2026
I really don't want shebangs to become a "run arbitrary executable" feature here - a lot of malicious code loves to hide behind legitimate programs, and we want
py.exeto be treated as a legitimate program. So that really puts me off having it launch anything that it isn't responsible for.1Would it work if you could map an arbitrary command like
/opt/indel/bin/indel-python2to a-Voption, like"/opt/indel/bin/indel-python2": "-V:PythonCore\\2.7"? Non-standard Python installs can be registered using PEP 514 for this (you can test if it's already registered withpy -V:2.7), and managed ones (which we hope will be the future) are of course included.If you really do need a tool that handles shebangs to arbitrary executable, then I think you may need to find it elsewhere. We want the Python launcher to launch Python, not anything.
Footnotes
Malicious code can, of course, replace those legitimate executables and "win" that way, but that's outside of our threat model. ↩
felixhirt commentedon Apr 15, 2026
Yes, this should work for us, would be great if you can implement this
Adds shebang_templates configuration for overriding shebangs. (#359)
zooba commentedon Jun 4, 2026
There is now a beta release at https://www.python.org/downloads/release/pymanager-263b1/ with the change to add the configuration setting I proposed. The docs are currently at https://github.com/python/cpython/pull/150931/changes but should be on the website today/tomorrow.