Skip to content

Script containing a "shebang" would not start under Windows  #100107

Closed
@peter88213

Description

@peter88213

Bug report

This Python script hello.pyw does not start on my PC when I double click it in Windows Explorer.

#!/usr/bin/env python3
from tkinter import messagebox
messagebox.showinfo(message='hello, world')

Instead, a console window pops up and disappears instantly.

Now I modify the shebang as follows:

#!/usr/bin/env python
from tkinter import messagebox
messagebox.showinfo(message='hello, world')

On double-clicking hello.pyw, a console opens, then the message box appears.

Now I remove the shebang:

from tkinter import messagebox
messagebox.showinfo(message='hello, world')

On double-clicking hello.pyw, the message box appears as expected.

This misbehavior was observed with the introduction of Python 3.11. It was not like this until version 3.10.8.

Your environment

  • CPython versions tested on: 3.11.1
  • Operating system and architecture: Windows 10 22H2 x64

I have implemented quite a few open source programs with Python, all of which have a shebang for working across platforms. On my download pages I had to generally discourage the use with Python 3.11.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixesOS-windowstype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions