Skip to content

Python Launcher for Windows (py.exe) breaks on non-python shebang line #94399

Closed
@CAD97

Description

@CAD97

Bug report

Given a non-python shebang line, e.g. #!/usr/bin/env bash, py.exe falls over with

❯ py ./x.py
Unable to create process using '/usr/bin/env bash ./x.py'

py.exe should not be trying to interpret non-python shebang lines on Windows. If py has been invoked (especially if manually invoked rather than implicitly by ftype association), the intent is to interpret the file as a python script.

I originally hit this with rust-lang/rust's x.py script, which is currently using /usr/bin/env bash to attempt to launch Python 3 across all OSes, whether they provide a python executable or just python3. (MSYS makes this more fun, as it does directly interpret and use the shebang line, rather than calling the ftype registered handler.)

Your environment

❯ winget list python
Name            Id                                     Version     Available   Source
-------------------------------------------------------------------------------------
Python 3        Python.Python.3                        3.10.4150.0 3.10.5150.0 winget
Python Launcher {691AAAA1-FE86-4973-8DA2-6AA2B3327562} 3.10.7751.0

Microsoft Windows
Version 21H2 (OS Build 22000.739)

Metadata

Metadata

Assignees

Labels

OS-windowstype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions