UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-14: character maps to <undefined>

In Python 3.6+, output to a Windows console file uses Unicode. All other files, however, default to using the process ANSI code page, which is typically a legacy encoding. The latter includes the standard files (i.e. stdin, stdout, stderr) when they’re redirected to something other than a console, such as a disk file or pipe. In your case the encoding of sys.stdout is code page 1252, maybe because the output is piped to Eclipse. There are two environment variables that you can set to override the encoding of sys.stdout. To force just the standard files to use UTF-8 , set PYTHONIOENCODING=utf-8. To use UTF-8 as the default in all cases, enable UTF-8 mode via PYTHONUTF8=1. To configure the latter for a single running instance of Python, use the command-line option -X utf8 instead of setting PYTHONUTF8=1.