Skip to content

FindPythonForBuild (PCBuild) fails with a path that contains a space #92348

@ariccio

Description

@ariccio

Bug report
I discovered this while playing around building with VS 2022 (I know it's not supported yet).

FindPythonForBuild tries to execute a batch file (find_python.bat) and builds the path as such:

$(MSBuildThisFileDirectory)\find_python.bat

If you clone the CPython repo into a user profile Documents directory (as is the default for the GitHub frontend for windows), and your user profile contains a space, this script fails.

Locally changing the line to add encoded quotes like this works for me:

<Exec Command="&quot;$(MSBuildThisFileDirectory)\find_python.bat&quot; -q"

You could probably repro this by cloning into any directory with a space in the path.

Your environment

  • CPython versions tested on: latest main HEAD
  • Operating system and architecture: Windows 10
  • Visual Studio 2022
  • User profile name: Lucius Riccio (yes, I still have a hand-me-down :))

CC @zooba since I think he still owns this code? It looks like the PSF has moved to GitHub for issue tracking, it will take a few minutes for me to reconfigure everything locally to fork this properly if you want me to submit a one-line patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions