Skip to content

E3-1712: Fix UnicodeEncodeError by setting locale to UTF-8

Anders Lindh Olsson requested to merge e3-1712 into main

Fixes a non-blocking gitlab CI job output issue, where the console log would be cluttered by a python traceback print:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit
    stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\u2018' in position 415: ordinal not in range(128)

This could arise if there was output from a subprocess - in this particular case git - from a e3.utils.run_make call which contained unicode/non-ascii characters. The gitlab runners' locale is set to POSIX, and the only other available options are C and en_US.utf8.

See pipeline at e3!256 (merged) for verification.

Edited by Anders Lindh Olsson

Merge request reports