Karthikeyan Singaravelan <[email protected]> added the comment:
>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
function global:prompt {
Write-Host -NoNewline -ForegroundColor Green '(py37'-bpo-35667-venv) '
_OLD_VIRTUAL_PROMPT
}
[0]
https://github.com/python/cpython/blob/a5b76167dedf4d15211a216c3ca7b98e3cec33b8/Lib/venv/__init__.py#L280
----------
nosy: +vinay.sajip, xtreak
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35667>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com