-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poetry breaks when there are spaces in path to Python #1479
Comments
Hello, I'm not sure about the removing of The main cause for the problem is, that the path to the python interpreter should be quoted, e.g. like this: try:
python_version = decode(
subprocess.check_output(
" ".join(
[
"{}".format(shlex.quote(python)),
"-c",
"\"import sys; print('.'.join([str(s) for s in sys.version_info[:3]]))\"",
]
),
shell=True,
)
)
except CalledProcessError as e:
raise EnvCommandError(e) |
Unfortunately, In CPython, I don't see how |
@finswimmer are your concerns about environment variables targeted at this particular problem or generic? I can't think of any sane circumstance where it would be an issue here. The only thing I can think of is if the shell launched by Python via |
Solved by #1774 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option).Issue
Cannot use Python interpreter at "C:\Program Files\Python38\python.exe", because Poetry makes a subprocess call using shell without properly quoting arguments. Note that, while I found this issue in Windows, any operating system is affected. It's just that spaces in paths are not so common in other systems. The above path is the default installation folder of Python for Windows when installed for all users.
Simply removing the
" ".join
andshell=True
from https://github.com/sdispater/poetry/blob/master/poetry/utils/env.py#L185 and other subprocess calls throughout this file, and possibly in many other files, should fix this issue.Poetry should always use the argument list form (without
shell=True
) to call subprocesses, which has no ambiguity or other issues with escaping special characters.The text was updated successfully, but these errors were encountered: