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
activate for venv containing apostrophe doesn't work in powershell #79848
Comments
On Windows 10, when I try to activate a venv in powershell where the name contains an apostrophe, I get the following error ("don't" is the name of the venv): PS N:\projects\cpython\don't\Scripts> .\activate.ps1 This works OK in Command Prompt. |
From the error I think the quotes are not properly escaped while doing text replacement in venv activate file template at [0] while it's generated? On linux/Mac double quotes are used and hence the error is not triggered with single quote in virtualenv name. Using double quote in virtualenv name triggers the parse error. $ python3.7 -m venv py37\"-bpo-35667-venv
$ source py37\"-bpo-35667-venv/bin/activate
py37"-bpo-35667-venv/bin/activate:57: parse error near `then' Looking into the py37\"-bpo-35667-venv/bin/activate script there is below line where the double quote is unbalanced : if [ "x(py37"-bpo-35667-venv) " != x ] ; then
PS1="(py37"-bpo-35667-venv) ${PS1:-}"
else I tried escaping the quotes with backslash at [0] but I get a similar error. I guess it's similar case in Powershell as I can see from Activate.ps1 but I haven't tested it. I am not sure about the difference in semantics between powershell and command prompt with respect to quoting since I don't have access to Windows. py37\'-bpo-35667-venv/bin/Activate.ps1 file with unbalanced quote
[0] Line 280 in a5b7616
|
CMD only uses single quotes in Double quotes in file names generally shouldn't be a problem in Windows. As far as I know, only the named-pipe file system allows them in pipe-file names (e.g. r'\\?\pipe\"pipename"'), and for regular files they're allowed in stream names (e.g. 'filename:"streamname"'). Otherwise, double quote should be reserved in file names as the DOS_DOT wildcard character. |
This has reportedly been fixed by the changes made to fix bpo-37354. I'll close this, but please reopen if you find it's still a problem. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: