Exception inside contextmanager should cancel the zim creation
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start at the Python writer.Creator context-manager entry point and reproduce the issue with the example in the report. Trace what happens when the block raises an exception; done means creation is cancelled, temporary files are removed, and no incomplete valid ZIM file remains.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When using the context-manager, should a (non libzim) error occur, the exception is raised but the finalization is done on the Creator as if everything went well.
with libzim.writer.Creator(
"test_x07.zim", main_page="A/index.html", index_language="eng", min_chunk_size=2048,
) as zfile:
zfile.add_article(DumbArticle("index.html", "hello", ARTICLE_MIME, "bonjour"))
raise Exception("outch")
zfile.add_article(DumbArticle("page2.html", "hello2", ARTICLE_MIME, "bonjour2"))
T:0; A:4; RA:0; CA:4; UA:0; FA:0; IA:1; C:0; CC:0; UC:0; WC:1
T:0; Waiting for workers
T:0; ResolveRedirectIndexes
Resolve redirect
T:0; Set article indexes
set index
T:0; Resolve mimetype
T:0; create title index
T:0; 6 title index created
T:0; 2 clusters created
T:0; write zimfile :
T:0; write mimetype list
T:0; write directory entries
T:0; write url prt list
T:0; write title index
T:0; write cluster offset list
T:0; write header
T:0; write checksum
T:0; rename tmpfile to final one.
T:0; finish
Traceback (most recent call last):
File "./demo.py", line 55, in <module>
raise Exception("outch")
Exception: outch
This results in a valid ZIM file on the filesystem but lacking the second article of course.
I think the expected behavior would be to cancel the ZIM creation and remove temporary files.
@mgautierfr @kelson42 ?
- Ngôn ngữ chính
- Python
- Star
- 109
- Fork
- 29
- Merge trung bình
- 9 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openzim/python-libzim
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
openzim/python-libzim#268 · 4 bình luận · 1 reaction ·
-
Release 3.14.0 Đang mởtask
openzim/python-libzim#267 · 1 người được giao ·
-
Code review: writer-path use-after-free, sys.modules corruption, GIL held across all reader I/O Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
openzim/python-libzim#266 ·
-
Build for ABI3 Đang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
openzim/python-libzim#264 · 1 bình luận ·
-
enhancement upstream
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
openzim/python-libzim#241 ·
Tất cả issue của openzim/python-libzim
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
-
hcocena Đang mởpolicies-accepted pre-review precheck-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Bioconductor/BiocContributions#214 · 5 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
TencentCloud/Octop#1169 · 1 bình luận ·
-
[开源推荐] 在老板拷问你之前,先让 AI 灵魂拷问你 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
521xueweihan/HelloGitHub#3778 ·
-
The version checker's trailing attribute region has no control for a less-than inside a quoted value Đang mởarea: dashboard area: tests bug perceived difficulty: 2 python
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Nitjsefnie-Harness-Commons/daedalus#1105 · 1 bình luận ·