Skip to content

Commit

Permalink
tentative fix for finding Python on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
denik committed Dec 18, 2024
1 parent fe36bce commit ecf1137
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libs/python/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ func DetectExecutable(ctx context.Context) (string, error) {
//
// See https://github.com/pyenv/pyenv#understanding-python-version-selection
out, err := exec.LookPath("python3")

// On Windows with uv, the venv/Scripts directory contains python.exe but not python3.exe nor python3
if runtime.GOOS == "windows" && err != nil && errors.Is(err, exec.ErrNotFound) {
out, err = exec.LookPath("python.exe")
}

// most of the OS'es have python3 in $PATH, but for those which don't,
// we perform the latest version lookup
if err != nil && !errors.Is(err, exec.ErrNotFound) {
Expand Down

0 comments on commit ecf1137

Please sign in to comment.