tools/strata_bench.py: UnicodeDecodeError reading CMakeLists.txt on non-UTF-8 Windows (GBK/cp932), before any measurement
Maintainers usually reply within 3 days
Nobody has claimed this yet.
- #2879 by @ctr-137 — closed without merging
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 81/100
Research direction
Start in tools/strata_bench.py at project_version() around line 564, then inspect its other read_text() calls for repository files. Compare the encoding used there with setup.py's read of CMakeLists.txt; confirm the fix lets the script read the version on non-UTF-8 Windows before measurement begins. Done means the benchmark proceeds past collect_machine() without a UnicodeDecodeError.
Written by the indexing model from the issue text.
Description
tools/strata_bench.py:564 (project_version) reads CMakeLists.txt with Path.read_text() and no encoding=, so it decodes with the OS locale code page. On a Chinese or Japanese Windows (GBK / cp932) the file's UTF-8 BOM makes the read fail and BENCH.bat dies before any measurement:
$ python tools/strata_bench.py
Starting strata-iq2_xs.json on port 8080 (loading takes 1-3 minutes; the PC may be slow meanwhile) ...
still loading (2 s) ...
Traceback (most recent call last):
File "D:\Strata\tools\strata_bench.py", line 1028, in <module>
sys.exit(main())
File "D:\Strata\tools\strata_bench.py", line 989, in main
pre = collect_machine(base, key, cfg, a.gpu)
File "D:\Strata\tools\strata_bench.py", line 639, in collect_machine
"strata_version": project_version(), "strata_commit": git_commit(),
File "D:\Strata\tools\strata_bench.py", line 564, in project_version
m = re.search(r"project\(strata VERSION ([\d.]+)", (ROOT / "CMakeLists.txt").read_text())
File "C:\Users\...\lib\pathlib.py", line 1135, in read_text
return f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xbf in position 2: illegal multibyte sequence
CMakeLists.txt starts with the UTF-8 BOM EF BB BF; 0xbf at offset 2 is the third BOM byte. Note it leaves the server it started behind, and the process exits with a traceback rather than a message.
setup.py:4649 reads the same file with encoding="utf-8":
m = re.search(r"project\(strata VERSION ([\d.]+)", (ROOT / "CMakeLists.txt").read_text(encoding="utf-8"))
so this looks like a strata_bench.py omission rather than an intentional locale dependency. Other read_text() calls in the file that read repository files are likely to hit the same thing on those systems.
Workaround (no source change needed): run with UTF-8 mode on.
set PYTHONUTF8=1
BENCH.bat
Verified: the suite then runs to completion (420 s) and writes a normal report.
Suggested fix: pass encoding="utf-8" at that call (and audit the other read_text() calls in the file), or read with errors="replace" — the value only needs to match project(strata VERSION x.y.z).
Environment: Windows 11 Pro 10.0.26200, Python 3.10.11, Strata 0.1.44.1 (release engine). A benchmark report produced on this machine is in #2791, which mentions this bug.
- Dominant language
- C++
- Stars
- 11.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Niko1221/Strata
-
[Other] error detected in the compilation of Strata/src/qwen35/q36_engine.cuPossibly taken A pull request linked to this issue is open or already merged. Openneeds-format
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
Niko1221/Strata#3368 · 1 comment ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-2 days Newbie friendliness 75/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Niko1221/Strata#3269 · 2 comments ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 64/100
Niko1221/Strata#3197 · 3 comments ·
Maintainers usually reply within 3 days
Similar issues
-
(S1 - Need confirmation)
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
CleverRaven/Cataclysm-DDA#89194 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
moonshine-ai/moonshine#231 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
documentation good first issue M7: multi-node no hardware needed
Difficulty 1/5 Under an hour Newbie friendliness 95/100
GageLawton/noise-cancellation#299 ·
Maintainers usually reply within 1 day