[BUG] CLI crashes with raw traceback on non-UTF-8 .dmai files

Aperta
#27 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@xuu33030 ci sta già lavorando.

Dal 18/9/2026.

  • #61 di @xuu33030 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Start in maithili_dsl/cli.py at run_dmai_file, where the file is read outside the try/except, and look at how existing errors print Maithili messages and pick exit codes. Wrap the read so a UnicodeDecodeError or OSError produces a friendly message and a non-zero exit. Done means a non-UTF-8 temp file in tests/test_cli.py gives the expected exit code with no traceback. Pull request #61 is already open against this issue, so check it before starting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:cli bug good first issue P3

File: maithili_dsl/cli.py (run_dmai_file)

The file is read outside the try/except, so a .dmai file that is not valid UTF-8 crashes the CLI with a raw Python traceback instead of a friendly Maithili error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

(Verified against v0.3.0 with a UTF-16-encoded file.)

Fix: wrap the read in try/except (UnicodeDecodeError, OSError), print a Maithili error message (see existing style, e.g. ⚠️ त्रुटि: फाइल UTF-8 में नहि अछि।), and return a non-zero exit code (reuse EXIT_NOT_FOUND or add EXIT_BAD_ENCODING = 7 and document it).

Tests: tests/test_cli.py — write a non-UTF8 temp file, assert exit code and no traceback.

Good first issue: small, contained, and a nice tour of the CLI error-handling style.

Lingua principale
Python
Stelle
1
Fork
4
Merge medio
12g 21h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di alphacrack/python-maithili-dsl

Tutte le issue di alphacrack/python-maithili-dsl

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.