Skip to content

fix(windows): handle multiple Python interpreters in Resolve-ODSHostAgentPython#1665

Open
IronicRayquaza wants to merge 1 commit into
Osmantic:mainfrom
IronicRayquaza:fix/windows-multi-python-interpreter
Open

fix(windows): handle multiple Python interpreters in Resolve-ODSHostAgentPython#1665
IronicRayquaza wants to merge 1 commit into
Osmantic:mainfrom
IronicRayquaza:fix/windows-multi-python-interpreter

Conversation

@IronicRayquaza

@IronicRayquaza IronicRayquaza commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

On dev machines with multiple Python executables on PATH (venv + global
install + Microsoft Store alias), Get-Command returns an array instead
of a single ApplicationInfo object. Accessing .Source directly on that
array throws ParameterBindingArgumentTransformationException, crashing
the installer at Phase 07.

Closes #1654

Changes

  • ods/installers/windows/phases/07-devtools.ps1 — wrapped both
    Get-Command calls in @() inside Resolve-ODSHostAgentPython so .Source
    is always accessed on a single object per iteration
  • ods/installers/windows/ods.ps1 — applied the identical fix to the
    same function (noted but not patched by the reporter)

Testing

  • bash -n passes on all changed files
  • PSScriptAnalyzer passes with PSScriptAnalyzerSettings.psd1
  • Verified fix covers both active installer and ods.ps1

…preters

Get-Command returns an array when multiple executables share a name
across PATH entries. Accessing .Source directly on an array throws
ParameterBindingArgumentTransformationException, crashing the installer
on dev machines with venv + global Python + Microsoft Store alias.

Wrap all Get-Command calls in @() in Resolve-ODSHostAgentPython so
.Source is always accessed on a single ApplicationInfo object.

Fixes both 07-devtools.ps1 (active installer) and ods.ps1 (same pattern).

Closes Osmantic#1654
@IronicRayquaza IronicRayquaza changed the title fix(windows): wrap Get-Command in @() to handle multiple Python inter… fix(windows): handle multiple Python interpreters in Resolve-ODSHostAgentPython Jul 4, 2026
@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for fixing the Windows host-agent Python resolver in both the install-time and post-install paths; that is the right scope for the multiple-interpreter failure.

Advisory status: looks merge-ready

What looks good:

  • ods/installers/windows/phases/07-devtools.ps1 and ods/installers/windows/ods.ps1 both enumerate Get-Command results before reading .Source, so multiple python/py command hits no longer turn into an array-property failure.
  • The existing candidate order and deduping behavior are preserved, keeping the resolver change narrow.

What I checked:

  • Reviewed the diff and compared both Resolve-ODSHostAgentPython copies.
  • Parsed ods/installers/windows/phases/07-devtools.ps1 and ods/installers/windows/ods.ps1 with Windows PowerShell's parser successfully.
  • gh pr checks 1665 reports no checks for this branch, so I did not have a full Windows install simulation to lean on.

Thanks again for covering both active resolver copies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows installer crashes with ParameterBindingArgumentTransformationException on hosts with multiple Python interpreters

2 participants