X.py: %1 is not a valid Win32 application

When trying to build rustc (I really need to test --bless for this PR), I'm getting WindowsError: [Error 193] %1 is not a valid Win32 application before even entering the bootstrap Rust code.

D:\rust-lang>git submodule foreach git clean -fdx
Entering 'src/doc/book'
Entering 'src/doc/edition-guide'
Entering 'src/doc/embedded-book'
Entering 'src/doc/nomicon'
Entering 'src/doc/reference'
Entering 'src/doc/rust-by-example'
Entering 'src/doc/rustc-guide'
Entering 'src/llvm-project'
Entering 'src/stdarch'
Entering 'src/tools/cargo'
Entering 'src/tools/clippy'
Entering 'src/tools/miri'
Entering 'src/tools/rls'
Entering 'src/tools/rust-installer'
Entering 'src/tools/rustfmt'

D:\rust-lang>py x.py --help
info: Downloading and building bootstrap before processing --help
      command. See src/bootstrap/README.md for help with common
      commands.
Updating only changed submodules
Submodules updated in 0.18 seconds
    Finished dev [unoptimized] target(s) in 0.36s
Traceback (most recent call last):
  File "x.py", line 11, in <module>
    bootstrap.main()
  File "D:\rust-lang\src\bootstrap\bootstrap.py", line 910, in main
    bootstrap(help_triggered)
  File "D:\rust-lang\src\bootstrap\bootstrap.py", line 896, in bootstrap
    run(args, env=env, verbose=build.verbose)
  File "D:\rust-lang\src\bootstrap\bootstrap.py", line 136, in run
    ret = subprocess.Popen(args, **kwargs)
  File "D:\Program Files\x86\Python37-32\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "D:\Program Files\x86\Python37-32\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application

Is this an issue of my machine environment, the Python that I'm using, x.py, or something else?

Windows 10.0.18362 Build 18362
py --version: Python 3.7.3
py -3 --version: Python 3.7.3
py -2 --version: Python 2.7.17

For what it's worth, I've recently built rust on Windows 10. I can't reproduce this exact error. I'm using python 3.7.4 on Windows 10 18362.476. I'm compiling with MSVC 2019 (16.3.10) and have C++ and .NET tools installed, as well as the Windows 10 SDK.

All commands are being run from "x64 Native Tools Command Prompt for VS 2019", which ensures the necessary environment variables are set.

I'm sorry I can't be of more help. Perhaps it would be worth editing bootstrap.py to print more details?

My VSConfig (gotten from VSInstaller):

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.VisualStudio.Component.NuGet",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Microsoft.VisualStudio.Component.IntelliCode",
    "Component.Microsoft.VisualStudio.LiveShare",
    "Microsoft.VisualStudio.Component.VC.CoreIde",
    "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
    "Microsoft.VisualStudio.Component.Graphics.Tools",
    "Microsoft.VisualStudio.Component.VC.DiagnosticTools",
    "Microsoft.VisualStudio.Component.Windows10SDK.18362",
    "Microsoft.VisualStudio.Component.Debugger.JustInTime",
    "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
    "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
    "Microsoft.VisualStudio.Component.VC.CMake.Project",
    "Microsoft.VisualStudio.Component.VC.ATL",
    "Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
    "Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
    "Microsoft.VisualStudio.Workload.NativeDesktop"
  ]
}

I get the same results running from the native tools command prompt as previously in both powershell and cmd.

Though launching the native tools command prompt gives the following error message before the first prompt, so maybe my VS install is more messed up than I ever realized:

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.