Skip to content

#! /usr/bin/env pythonw shebang causes "[ERROR] No runtime installed that matches w. Try running "py install w"." #191

@DervishD

Description

@DervishD

Install source and version

  • Installed from the Windows Store
  • Installed with the MSIX from python.org
  • Installed with the MSI from python.org
  • Installed with winget install 9NQ7512CXL7T

Version:
25.0

Describe the bug
Using this minimal script for testing, named t.pyw:

#! /usr/bin/env pythonw

import sys
import time
from ctypes import windll

windll.user32.MessageBoxW(None, "Script started", "Hi", 0x10)

print('This goes to stdout', file=sys.stdout)
time.sleep(3)
print('This goes to stderr', file=sys.stderr)
time.sleep(3)

windll.user32.MessageBoxW(None, "Script finished", "Done", 0x10) 

If launched using double click it does not do anything. If launched using py t.pyw, the error message [ERROR] No runtime installed that matches w. Try running "py install w". is produced. For some reason the shebang is not processed properly, and in fact the shebang #! /usr/bin/env pyw works perfectly, don't know why.

To Reproduce
Steps to reproduce the behavior:

  1. Open a command prompt.
  2. Run py t.pyw
  3. See error

Expected behavior
A normal run, just like when the #! /usr/bin/env pyw is used, or like the #! /usr/bin/env python3 shebang with the legacy installer. The real script which triggered this for me was working perfectly with the legacy installer/launcher and the #! /usr/bin/env python3 shebang.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrelease-blockerDo not release without fixing this issue!

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions