Skip to content

Python 3.11.0b4 - py launcher fails when running a script with a shebang line #94772

Closed
@pfmoore

Description

@pfmoore

Bug report

When running a script with a "shebang" line, the py.exe launcher in Python 3.11.0b4 fails with an error:

To reproduce, create the following script as x.py:

#!/usr/bin/env python
import sys
print(sys.version)
print(sys.executable)

Run the script using py.exe built from a 3.11.0b4 checkout using build.bat:

❯ .\amd64\py.exe .\x.py
 .\x.py': The system cannot find the file specified.ata\Local\Programs\Python\Python310\python.exe

Note the truncated python executable name. This appears to be related to the use of CRLF line endings in the file - if I switch to LF line endings, I get

❯ .\amd64\py.exe .\x.py
Unable to create process using 'C:\Users\Gustav\AppData\Local\Programs\Python\Python310\python.exe
 .\x.py': The system cannot find the file specified.

Your environment

  • Launcher from 3.11.0b4, but the active Python version is 3.10.3.
  • Operating system and architecture: Windows 11, 64-bit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    • Status

      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions