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

未关闭
#27 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@xuu33030 已经在做这个了。

开始于 2026年9月18日。

  • #61 来自 @xuu33030 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
22/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
cli

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Python
星标
1
派生
4
平均合并
12 天 21 小时
30 天内合并 PR
1

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

alphacrack/python-maithili-dsl 的其他 Issue

查看 alphacrack/python-maithili-dsl 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。