[Tutor] logging to cmd.exe
Mats Wichmann
mats at wichmann.us
Tue Sep 26 08:35:05 EDT 2017
On 09/26/2017 05:22 AM, Albert-Jan Roskam wrote:
> Rather than change your code can you change the codepage with the chcp
> command?
the way chcp takes effect is problematic for this:
"Programs that you start after you assign a new code page use the new
code page, however, programs (except Cmd.exe) that you started before
assigning the new code page use the original code page. "
so making the change from inside the code does not seem like it will work.
> ========> Good to keep in mind, but my objection would be similar to that with specifying the PYTHONIOENCODING variable: one needs to change the environment first before the script runs without errors.
quicktip: try Python 3.6. It's had a change in this area and no longer
uses the code page.
I think there's also a module you can use for pre-3.6, sorry too lazy to
do a search.
More information about the Tutor
mailing list