Skip to content

poetry env use on Windows needs to deal with spaces in path or take a command line list #1747

@madig

Description

@madig
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10 1909 x64
  • Poetry version: 1.0.0
  • Link of a Gist with the contents of your pyproject.toml file: N/A

Issue

On Windows, Python is typically installed into C:\Program Files, i.e. C:\Program Files\Python38\python.exe. Attempting to make poetry use it rather than the Python it is installed for results in:

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

[EnvCommandError]
Command C:\Program Files\Python38\python.exe -c "import sys; print('.'.join([str(s) for s in sys.version_info[:3]]))" errored with the following return 
code 1, and output:

In this case, the path must be treated as ["C:\\Program Files\\Python38\\python.exe"].

Python for Windows also comes with the py program for selecting which installed Python gets called. You can call it like py and it will start the latest Python, or like py -2.7-32 to start that other thing. In that case, the string must be interpreted as ["py", "-2.7-32"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions