-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/triageThis issue needs to be triagedThis issue needs to be triaged
Description
- Poetry version: 1.3.1
- Python version: 3.9.13
- OS version and name: Windows 11 22H2
- pyproject.toml: gist
- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option) and have included the output below.
Issue
I want to use poetry along with pyenv-win.
When I set prefer-active-python = true
and call poetry install
I get "Command cannot be found" error:
PS F:\python\projects\tutorial-hypermodern-python-winand> poetry install
El sistema no puede encontrar la ruta especificada.
Command 'C:\Users\Àíäðåé\.pyenv\pyenv-win\versions\3.8.10\python.exe -c "import sys; print('.'.join([str(s) for s in sys.version_info[:3]]))"' returned non-zero exit status 1.
Username in the output has broken encoding (Àíäðåé instead of Андрей). I've found out that poetry tries to get current interpreter using utils.env._full_python_path
function which returns broken path in my case.
I've found two possible solutions:
- Add
universal_newlines=True
/text=True
tosubprocess.check_output
call. That fixes only paths which can be encoded with local encoding - cp1251. - Encode output to UTF-8 in child process:
subprocess.check_output(
list_to_shell_command(
# [python, "-c", '"import sys; print(sys.executable)"']
[python, "-c", '"import sys; sys.stdout.buffer.write(sys.executable.encode())"']
),
shell=True,
).strip()
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working as expectedSomething isn't working as expectedstatus/triageThis issue needs to be triagedThis issue needs to be triaged