Skip to content

Shims are failing on Windows with .exe suffix as python scripts #5

@Tremeschin

Description

@Tremeschin

Hey, not sure what has changed on Windows OS' side, but it seems to be ignoring the shebangs (if they were ever a thing there) and executing the shims as a standard .exe file following some users of mine reports, causing errors like these:

PowerShell:

❯ uvx --from rustup cargo
error: Failed to spawn: `cargo`
  Caused by: This version of %1 is not compatible with the version of Windows you're running.
Check your computer's system information and then contact the software publisher. (os error 216)

cmd: A popup modal dialog:

Image

I'm 100% positive they worked at least two weeks ago as .exes, but no code has changed ever since, which is weird.

No issues on Linux/macOS as they know it's a python script via contents.

Potential solution

Easy way out is doing something similar to my reference repo for issue #2 defining the entry points in [project.scripts] and letting the package manager create files. On lin/mac they are basically name = "package.module:main" -> from package.module import main; main() as venv/bin/name metaprogrammed python scripts, but for windows, files like black.exe, gradio.exe seems to be native platform executables.

Also, instead of a unique file per shim, bundling a main script with multiple functions works much nicer 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions