Skip to content

pythonw.exe from venv in 3.13 always creates console window #126084

Closed

Description

@chrullrich

Bug report

Bug description:

In 3.13.0a4 yet another form of launcher executable was added, apparently called "venvlauncher". This latest creation is apparently unaware that pythonw (the GUI subsystem, no-console-window form of interpreter) exists and always runs the regular python.exe (CLI subsystem). Therefore any attempt to run a script in 3.13 will either attach to the current console or create a new, blank console window.

I have not tried building venvlauncher.c with a different definition of EXENAME to see if that works, but since %PROGRAMFILES%\Python313\Lib\venv\scripts\nt\venvwlauncher.exe does not contain the string "pythonw", I'm pretty sure my guess is correct.

There is plenty of infrastructure in the Windows build to make this work, not least this block in venvlauncher.c:

// This should always be defined when we build for real,
// but it's handy to have a definition for quick testing
#ifndef EXENAME
#define EXENAME L"python.exe"
#endif

Someone probably forgot to hook up the external definition in the build.

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Linked PRs

Activity

  1. changed the title [-]pythonw.exe in 3.13 always creates console window[/-] [+]pythonw.exe from venv in 3.13 always creates console window[/+] on Oct 28, 2024
  2. added a commit that references this issue on Oct 28, 2024
    b08755a
  3. added a commit that references this issue on Oct 29, 2024
  4. added a commit that references this issue on Oct 29, 2024
  5. added a commit that references this issue on Oct 29, 2024
  6. added a commit that references this issue on Dec 8, 2024
  7. added a commit that references this issue on Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixesOS-windowstopic-venvRelated to the venv moduletype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions