Exception inside contextmanager should cancel the zim creation
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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 ?
- Lenguaje dominante
- Python
- Estrellas
- 109
- Forks
- 29
- Merge medio
- 9 d 1 h
- PR fusionados (30 d)
- 1
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de openzim/python-libzim
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
openzim/python-libzim#268 · 4 comentarios · 1 reacción ·
-
Release 3.14.0Posiblemente ocupada @benoit74 la tomó hace 20 días. Abiertotask
openzim/python-libzim#267 · 1 asignado ·
-
Code review: writer-path use-after-free, sys.modules corruption, GIL held across all reader I/OAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
openzim/python-libzim#266 ·
-
Build for ABI3Posiblemente ocupada @rgaudin la tomó hace 45 días. Abiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
openzim/python-libzim#264 · 1 comentario ·
-
enhancement upstream
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
openzim/python-libzim#241 ·
Todos los issues de openzim/python-libzim
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
qgis/QGIS-Plugins-Website#459 ·
-
bug severity:medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
bot-found bug priority: P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
madenvel/KalinkaPlayer#179 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ls1intum/edutelligence#1098 ·
Los mantenedores suelen responder en 1 día