On 10.02.2021 08:15, Christopher Barker wrote:
And all the examples given here of how to set environment variables and shortcuts, etc on Windows is EXACTLY the kind of information I don't want to have to provide for my students :-( -- I'm teaching Python, not Windows administration.
That's fair, but please note that the idea is to have the Python installer take care of setting the env var globally, so no admin or user would need to bother with this.
It's really important to support configuration per environment these days. Ideally with any of the "environment" tools.
True, and those can easily override any globally set env vars. Note that you can set PYTHONUTF8=0 to disable and already globally set PYTHONUTF8=1.
conda could manage this on a per env basis. venv could as well, via the .bat or .ps1 files to activate the environment on Windows.
So technically, env vars are indeed an easy way to enable UTF-8 mode on a per installation and per venv basis, on all platforms Python supports.
What's best: only tooling and installers would need to be adapted, not Python itself, since the UTF-8 mode and env var has already been around for quite some time.
And for those who don't want to wait:
setx PYTHONUTF8 1
does the trick in an admin command shell on Windows globally.
set PYTHONUTF8 1
does the same locally in a user command shell or as part of the venv activate.bat file.
It's not really all that hard :-)