Friendlier error message than `FileNotFoundError`
还没有人认领这个 Issue。
评估
调研方向
从 sqlrunner/main.py 开始,这里会将输入传递给 main.read_text,然后检查 sqlrunner/main.py 中的 read_text。使用不存在的输入路径运行 SQL Runner,并验证它会报告一条明确指出缺失文件的友好错误,而不会打印 FileNotFoundError 堆栈跟踪。
由索引模型根据 Issue 内容生成。
描述
If the input file doesn't exist, then SQL Runner prints a stack trace. A friendlier error message than FileNotFoundError would be nice.
Running actions: query
jobrunner.run loop started
query: Copying in code from /Users/iaindillingham/Code/opensafely/tpp-database-schema
query: Preparing
query: Executing
query: Logs written to: /Users/iaindillingham/Code/opensafely/tpp-database-schema/metadata/query.log
query: Finalizing
query: Job exited with error code 1
query: Cleaning up container and volume
=> query
Job exited with error code 1
log file: metadata/query.log
outputs:
(no outputs)
logs:
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/app/sqlrunner/__main__.py", line 8, in <module>
sql_query = main.read_text(args.input)
File "/app/sqlrunner/main.py", line 37, in read_text
return f_path.read_text(encoding="utf-8")
File "/usr/lib/python3.10/pathlib.py", line 1134, in read_text
with self.open(mode='r', encoding=encoding, errors=errors) as f:
File "/usr/lib/python3.10/pathlib.py", line 1119, in open
return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: 'analysis/query.sql'
- 主要语言
- Python
- 星标
- 1
- 派生
- 0
- 平均合并
- 8 天 18 小时
- 30 天内合并 PR
- 6
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
opensafely-core/sqlrunner 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 25/100
opensafely-core/sqlrunner#398 ·
-
难度 5/5 一周以上 新手友好度 25/100
opensafely-core/sqlrunner#72 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
opensafely-core/sqlrunner#54 ·
-
Update README未关闭
难度 2/5 1-3 小时 新手友好度 45/100
opensafely-core/sqlrunner#44 ·
-
难度 2/5 1-3 小时 新手友好度 52/100
opensafely-core/sqlrunner#26 ·
查看 opensafely-core/sqlrunner 的全部 Issue
相似的 Issue
-
[Bug]: `graphify export svg` writes a graph.svg that is not well-formed XML when a label contains a control character可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
Graphify-Labs/graphify#4241 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
-
DeviceTracker未关闭
难度 2/5 1-3 小时 新手友好度 63/100
XiaoMi/ha_xiaomi_home#1821 ·
维护者通常 1 天内回复
-
Maven path-index: "Ambiguous or noncanonical artifact path" error does not report the offending path未关闭
难度 2/5 1-3 小时 新手友好度 76/100
pulp/pulp_maven#524 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复