{"record":{"id":"981bd75e02e5b5ee","repo":"pulumi/pulumi","slug":"evaluating-python-execution-alias-w","errorCode":null,"errorMessage":"evaluating python execution alias: %w","messagePattern":"evaluating python execution alias: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/python/toolchain/pip.go","lineNumber":395,"sourceCode":"\t\t\t\te = \".\" + e\n\t\t\t}\n\t\t\texts = append(exts, e)\n\t\t}\n\t} else {\n\t\texts = append(exts, \".com\", \".exe\", \".bat\", \".cmd\")\n\t}\n\n\tpath := os.Getenv(\"PATH\")\n\tfor _, dir := range filepath.SplitList(path) {\n\t\tif !strings.Contains(strings.ToLower(dir), filepath.Join(\"microsoft\", \"windowsapps\")) {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, pythonCmd := range pythonCmds {\n\t\t\tfor _, ext := range exts {\n\t\t\t\tpath := filepath.Join(dir, pythonCmd+ext)\n\t\t\t\t_, err := os.Lstat(path)\n\t\t\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\t\t\treturn \"\", \"\", fmt.Errorf(\"evaluating python execution alias: %w\", err)\n\t\t\t\t}\n\t\t\t\tif os.IsNotExist(err) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\treturn pythonCmd, path, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\", \"\", errors.New(\"no python execution alias found\")\n}\n\n// VirtualEnvCommand returns an *exec.Cmd for running a command from the specified virtual environment\n// directory.\nfunc VirtualEnvCommand(virtualEnvDir, name string, arg ...string) *exec.Cmd {\n\tif runtime.GOOS == windows {\n\t\tname = name + \".exe\"\n\t}","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/python/toolchain/pip.go#L377-L413","documentation":"During resolveWindowsExecutionAlias (the fallback that scans %LOCALAPPDATA%\\Microsoft\\WindowsApps for UWP execution aliases), os.Lstat on a candidate python executable returned an error that is NOT 'file not found'. The toolchain wraps it as 'evaluating python execution alias: %w'.","triggerScenarios":"On Windows, Lstat(filepath.Join(windowsAppsDir, pythonCmd+ext)) fails with an unexpected OS error (e.g. permission denied, path too long, broken reparse point) while resolving aliases for pythonCmds.","commonSituations":"Restrictive ACLs or antivirus interference on the WindowsApps directory; corrupted reparse points after a Store update; symlink/alias left dangling after uninstalling the Store Python.","solutions":["Read the wrapped %w error to identify the underlying OS failure and fix that (permissions, path length, disk state).","Run `pulumi` from an elevated shell once to rule out ACL denials on WindowsApps.","If the alias is broken, remove it via Settings > Apps > Advanced app settings > App execution aliases and reinstall Python from the Store or python.org with PATH enabled.","Reboot after a Store Python update so reparse points are refreshed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Windows pre-check\ndir := filepath.Join(os.Getenv(\"LOCALAPPDATA\"), \"Microsoft\", \"WindowsApps\")\nif _, err := os.Lstat(filepath.Join(dir, \"python.exe\")); err != nil && !os.IsNotExist(err) {\n\treturn fmt.Errorf(\"WindowsApps dir is unhealthy (%v); fix permissions/alias before proceeding\", err)\n}","typeGuard":null,"tryCatchPattern":"path, cmd, err := toolchain.CommandPath()\nif err != nil && strings.Contains(err.Error(), \"evaluating python execution alias\") {\n\t// fall back to a manually configured interpreter\n\tpath = os.Getenv(\"PULUMI_PYTHON_CMD\")\n}","preventionTips":["Keep the WindowsApps directory free of ACL/AV restrictions","Reboot after Microsoft Store Python updates","Enable/disable Python app execution aliases deliberately in Windows settings"],"tags":["windows","python","filesystem","toolchain"],"backgroundTag":"windows-execution-alias","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}