Win10 build error: UnicodeDecodeError: 'gbk' codec can't decode byte 0x91

Hi, could you please help checking this? Thanks!
Followed the tutorial step by step, can’t pass this one, tried several times:

PS C:\dev\anki> .\run

C:\dev\anki>set PYTHONWARNINGS=default

C:\dev\anki>call .\bazel.bat run  //qt:runanki -k --

C:\dev\anki>\bazel\bazel  --output_user_root=\bazel\anki run  //qt:runanki -k --
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Analyzed target //qt:runanki (650 packages loaded, 59535 targets configured).
INFO: Found 1 target...
ERROR: C:/dev/anki/ts/lib/BUILD.bazel:33:8: Executing genrule //ts/lib:fluent_gen failed: (Exit 1): bash.exe failed: error executing command C:/msys64/usr/bin/bash.exe -c ... (remaining 1 argument(s) skipped)
Traceback (most recent call last):
  File "\\?\C:\bazel\anki\3u4s6wvw\execroot\net_ankiweb_anki\bazel-out\host\bin\ts\lib\genfluent.exe.runfiles\net_ankiweb_anki\ts\lib\genfluent.py", line 11, in <module>
    modules = json.load(open(strings_json))
  File "c:\python\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
UnicodeDecodeError: 'gbk' codec can't decode byte 0x91 in position 213854: illegal multibyte sequence
----------------
Note: The failure of target //ts/lib:genfluent (with exit code 1) may have been caused by the fact that it is running under Python 3 instead of Python 2. Examine the error to determine if that appears to be the problem. Since this target is built in the host configuration, the only way to change its version is to set --host_force_python=PY2, which affects the entire build.

If this error started occurring in Bazel 0.27 and later, it may be because the Python toolchain now enforces that targets analyzed as PY2 and PY3 run under a Python 2 and Python 3 interpreter, respectively. See https://github.com/bazelbuild/bazel/issues/7899 for more information.
----------------
ERROR: C:/dev/anki/pylib/anki/_backend/BUILD.bazel:46:8: Executing genrule //pylib/anki/_backend:fluent_gen failed: (Exit 1): bash.exe failed: error executing command C:/msys64/usr/bin/bash.exe -c ... (remaining 1 argument(s) skipped)
Traceback (most recent call last):
  File "\\?\C:\bazel\anki\3u4s6wvw\execroot\net_ankiweb_anki\bazel-out\host\bin\pylib\anki\_backend\genfluent.exe.runfiles\net_ankiweb_anki\pylib\anki\_backend\genfluent.py", line 11, in <module>
    modules = json.load(open(strings_json))
  File "c:\python\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
UnicodeDecodeError: 'gbk' codec can't decode byte 0x91 in position 213854: illegal multibyte sequence
----------------
Note: The failure of target //pylib/anki/_backend:genfluent (with exit code 1) may have been caused by the fact that it is running under Python 3 instead of Python 2. Examine the error to determine if that appears to be the problem. Since this target is built in the host configuration, the only way to change its version is to set --host_force_python=PY2, which affects the entire build.

If this error started occurring in Bazel 0.27 and later, it may be because the Python toolchain now enforces that targets analyzed as PY2 and PY3 run under a Python 2 and Python 3 interpreter, respectively. See https://github.com/bazelbuild/bazel/issues/7899 for more information.
----------------
Target //qt:runanki failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1985.793s, Critical Path: 434.76s
INFO: 987 processes: 343 internal, 580 local, 64 worker.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
PS C:\dev\anki>

Manually appended , encoding='UTF-8' to the two open places, so the line became

modules = json.load(open(strings_json, encoding='UTF-8'))

And then rerun, it passed and finished building, running now :smiley:

1 Like

Thanks for the report, I’ll make this change to the code.

1 Like