onnx / turnkeyml

The no-code AI toolchain
Apache License 2.0
74 stars 16 forks source link

Specify how errors should be handled during decoding #148

Closed danielholanda closed 7 months ago

danielholanda commented 7 months ago

Description

Depending on how information is printed on the screen, logged_subprocess might fail to decoding a byte sequence as UTF-8.

To handle this issue, we simply replace characters that cannot be decoded with a replacement character. The replacement character is typically U+FFFD (�). This can be useful to ensure that all characters are displayed, even if some of them are corrupted.

log_stdout = proc.stdout.decode("utf-8", errors="ignore")