Windows: check_ai.py fails decoding UTF-8 guides with the default locale
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
Direzione di ricerca
Inizia con le tre chiamate a Path.read_text() con codifica implicita in utils/check_ai.py alle righe 50, 75 e 84, quindi esegui python utils/check_ai.py dalla radice del repository. Aggiungi un test di regressione usando una locale predefinita non UTF-8; il lavoro è completato quando il checker legge Markdown coerentemente come UTF-8 e ha esito positivo su Windows senza -X utf8.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
The documented agent setup check crashes on Windows when Python uses the default CP1252 locale encoding. The checker reads UTF-8 Markdown with Path.read_text() without an explicit encoding.
Reproduced on Windows, CPython 3.12.14, checkout 8b3c707ebd3ec4881f4190cf42931da07eaf3b65. utils/check_ai.py is unchanged between this checkout and my existing attention-mask branch.
Reproduction
From the repository root in an installed development environment:
python utils/check_ai.py
It exits 1 at utils/check_ai.py:50:
prose = CODE_FENCE.sub("", path.read_text())
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 7411: character maps to <undefined>
The same checkout succeeds with:
python -X utf8 utils/check_ai.py
Expected behavior and proposed scope
The check should read repository Markdown consistently as UTF-8, independent of the system locale. There are three implicit-encoding read_text() calls in this script (lines 50, 75, and 84). Proposed fix: specify encoding="utf-8" for all three and add a regression test using a non-UTF-8 default. No .ai files would change.
I can submit this focused fix if that direction is welcome. Two targeted searches for check_ai with encoding/Windows found no duplicate. Reproduction and proposed fix were investigated with AI assistance.
- Lingua principale
- Python
- Stelle
- 34.6k
- Fork
- 7.4k
- Merge medio
- 3g 7h
- PR unite (30g)
- 73
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di huggingface/diffusers
-
bug needs-env-info pipelines
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
huggingface/diffusers#14794 ·
-
bug needs-code-example needs-env-info pipelines
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
huggingface/diffusers#14780 · 1 commento ·
-
bug pipelines
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/diffusers#14769 · 1 commento ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
huggingface/diffusers#14639 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
huggingface/diffusers#14616 ·
Tutte le issue di huggingface/diffusers
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
stephrobert/dsoxlab#238 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
sublimehq/package_control#1780 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
nwg-piotr/nwg-displays#145 ·