fix: don't mistake Windows' Python stub for a real interpreter - #60
Merged
Merged
Conversation
Windows ships python.exe/python3.exe "App Execution Alias" stubs on PATH by default even with no real Python installed. install.ps1's Get-Command check and tools.rs's execute_web_search both treated the stub as a real interpreter (it's a real, if useless, file/process), so the embedded-Python fallback never triggered and ddgs installs failed with a confusing "Python not found" message from the stub itself instead of falling back cleanly. install.ps1 now rejects a resolved python/python3 path under WindowsApps and falls through to Install-EmbeddedPython, same as if nothing were found. tools.rs now recognizes the stub's distinctive output after a successful-but-useless spawn and retries against the embedded interpreter, the same way it already does for a NotFound spawn error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
python.exe/python3.exe"App Execution Alias" stubs inWindowsAppsthat sit on PATH by default even with no real Python installed. They're real files/processes, just useless ones — running one just prints "Python was not found; run without arguments to install from the Microsoft Store...".install.ps1'sInstall-Ddgsandtools.rs'sexecute_web_searchboth treated the stub as a real interpreter, so the existing embedded-Python fallback (Install-EmbeddedPython/embedded_python_path) never triggered —ddgsinstall/usage failed with a confusing "Python not found"-shaped error instead of falling back to the self-contained Python that's already downloaded for exactly this case.install.ps1now rejects a resolvedpython/python3path underWindowsApps(Test-IsAppExecutionAliasStub) and falls through toInstall-EmbeddedPython, same as if nothing were found.tools.rsnow recognizes the stub's distinctive output after a successful-but-useless spawn (looks_like_windows_app_execution_alias_stub) and retries against the embedded interpreter, the same way it already does for aNotFoundspawn error. If there's no embedded Python either, it now returns a message that names the actual problem (a Store stub) instead of the generic "could not run" text.web_searchcall and on every install run, so a real Python installed later is picked up automatically.Test plan
cargo test --bin boxcode— 360 passed, including two new tests (web_search_falls_back_to_the_embedded_python_when_configured_one_is_the_windows_stub,a_windows_stub_with_no_embedded_fallback_is_explained_clearly)tests/install_ps1_test.ps1run against a locally-downloaded pwsh 7.6.4 — 27/27 passed, including newTest-IsAppExecutionAliasStubcases