Friendlier error message than `TypeError`
还没有人认领这个 Issue。
评估
调研方向
回溯指向 sqlrunner/main.py 约第 44 行,入口点行为显示在 sqlrunner/main.py 中。首先在不使用 --dsn 或 DATABASE_URL 的情况下复现运行,并检查该输入是如何解析的。完成标准是:失败时产生更友好的错误,而不是所示的 TypeError 和堆栈跟踪。
由索引模型根据 Issue 内容生成。
描述
When neither --dsn is passed nor DATABASE_URL is set, SQL Runner prints a stack trace:
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 9, in <module>
results = main.run_sql(dsn=args.dsn, sql_query=sql_query)
File "/app/sqlrunner/main.py", line 51, in run_sql
database=parsed_dsn.path.strip("/"),
TypeError: a bytes-like object is required, not 'str'
parsed_dsn is an instance of ParseResultBytes rather than ParseResult because dsn was None:
- 主要语言
- 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 小时 新手友好度 45/100
opensafely-core/sqlrunner#25 ·
查看 opensafely-core/sqlrunner 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
SR_SECURITY_DESCRIPTOR.fromString drops the SACL when no DACL is present可能已有人在做 @paul7436 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
equinor/fmu-sumo-uploader#302 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
modelscope/evalscope#1821 ·
维护者通常 1 天内回复
-
Sanity on ansible-core devel fails: ignore-2.23.txt references the removed import-3.9 test可能已有人在做 @yurnov 今天认领。 未关闭needs_triage
难度 1/5 1 小时以内 新手友好度 91/100
ansible-collections/kubernetes.core#1275 ·
维护者通常 1 天内回复