-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
venv activate.bat is UTF-8 encoded but uses current console codepage #76590
Comments
Let's say I have a folder c:\test-ä in Windows Now if I run: py -m venv env the result is incorrectly just: C:\Users\Username\AppData\Local\Programs\Python\Python36\python.exe If I run: path So clearly the encoding is broken for the folder name. I can fix this by changing activate.bat character encoding to OEM-US and then replacing "test-├ż" by "test-ä". If I now activate and run: where python By running: path So looks good here as well. I suggest that what ever is creating activate.bat file, is using incorrect character encoding for the creation of the file. If this is somehow platform specific, there could be a guide in the venv documentation about how to fix this. |
The CMD shell decodes batch scripts using the attached console's output codepage, which defaults to OEM. OTOH, venv writes the replacement values for the template activate.bat as UTF-8 (codepage 65001), which is correct and should not be downgraded to OEM. Instead, the batch script could temporarily switch the console to codepage 65001. Then restore the previous codepage at the end. For example:
[rest of script]
|
Eryk's solution seems to be best, so I'll add that. |
it does not work as expected on swiss german (and likely other internationalised) windows systems. See https://bugs.python.org/issue32409 |
This commit broke a lot of the Windows buildbots: https://buildbot.python.org/all/#/builders/32/builds/1707 Can someone work on a patch soon? If not we need to revert the commits in all the branches that are failed to build :( |
I will have a look. |
Pablo Galindo reverted the change because it broke Windows buildbots, and we have a policy to revert a change breaking buildbots if the regression cannot be fixed "quickly" event: Is someone working on investigating the bug? Do you need help to reproduce the bug? Copy of the test_venv error: ====================================================================== Traceback (most recent call last):
File "D:\buildarea\3.x.bolen-windows8\build\lib\test\test_venv.py", line 302, in test_unicode_in_batch_file
out, err = check_output(
File "D:\buildarea\3.x.bolen-windows8\build\lib\test\test_venv.py", line 37, in check_output
raise subprocess.CalledProcessError(
TypeError: __init__() takes from 3 to 5 positional arguments but 6 were given |
That error is a bug in the test, but it only shows up on an error path anyway. Without removing the extra None we don't get to see the actual error output. I can't look into this over the next week or two, but a quick glance at the original PR looks like a lot of quotes are missing around executable paths, so maybe it was that? |
See also bpo-35558. |
This appears to be completely resolved now, but if it's not, please ping with the details and we'll reopen. |
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: