Skip to content

Regression: click.launch() broken on Windows in version 8.1.8 #2868

Closed

Description

@ivankravets

click.launch("https://click.palletsprojects.com/en/stable/") results in [WinError 2] The system cannot find the file specified on Windows due to an incorrect migration from os.system to subprocess.call. Refer to the official documentation:

Replacing `os.system()`

sts = os.system("mycmd" + " myarg")
# becomes
retcode = call("mycmd" + " myarg", shell=True)

Proposed fix ivankravets@fb59f90

Environment:

  • Python version: 3.x
  • Click version: 8.1.8

Activity

  1. davidism commented on Mar 10, 2025

    @davidism
    Member

    We do not want to use shell=True, so you'll need to find a different fix.

  2. ivankravets commented on Mar 10, 2025

    @ivankravets
    Author

    Sorry, but I’m not sure I understand you. The API has been working since the first version of Click (more than 10 years), and the documentation highlights the use of click.launch() in multiple places for opening web URLs. See: https://click.palletsprojects.com/en/stable/utils/#launching-applications

    Could you revert that part of the code if there is no solution that avoids breaking an API that has worked for multiple years? The launch function is a high-level abstraction and should not expose the end developer to OS-related technical issues.

  3. davidism commented on Mar 10, 2025

    @davidism
    Member

    I'm not saying this isn't a bug, I'm saying we don't want to use shell=True. So the fix is not to revert it or use shell=True, but to research and fix it another way.

  4. johannkm commented on Apr 1, 2025

    @johannkm

    I also ran in to this. Here's where this was introduced: #1477

    I believe it would work to use the same error handling for windows as this diff adds for Linux: https://github.com/pallets/click/blob/stable/src/click/_termui_impl.py#L673-L679, with a fallback to webbrowser.open()

  5. added this to the 8.2.1 milestone on May 10, 2025
  6. modified the milestones: 8.2.1, 8.2.2 on May 14, 2025
  7. modified the milestones: 8.2.2, on Jul 16, 2025
  8. rafalkrupinski commented on Jul 21, 2025

    @rafalkrupinski

    #2986 mentions it's reasonable to drop support for an OS withing six months of its EOL.
    The support for Windows 8 ended in 2023.

    Should users be encouraged to use <8.1.8 if they want to support older Windows?

  9. removed this from the milestone on Aug 3, 2025
  10. PlumLariat commented on May 19, 2026

    @PlumLariat
    Contributor

    Ran on Windows 11 latest with 8.4.1, could not reproduce bug. I don't think it occurs any longer.

  11. Rowlando13 commented on May 19, 2026

    @Rowlando13
    Member

    @pyconus, I watched the above user try to reproduce, I also thing this no longer occurs.

  12. added this to the 8.4.1 milestone on May 19, 2026
  13. modified the milestones: 8.4.1, 8.4.0 on May 22, 2026
  14. added
    windows
    on May 22, 2026
  15. kdeldycke commented on May 22, 2026

    @kdeldycke
    Collaborator

    This has been fixed in 8.4.0 by #3186

  16. locked as resolved and limited conversation to collaborators on Jul 24, 2026
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

    windows

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions