openzim / python-libzim

Libzim binding for Python: read/write ZIM files in Python
https://pypi.org/project/libzim/
GNU General Public License v3.0
62 stars 20 forks source link

Zim with no article leave temp files behind #41

Closed rgaudin closed 4 years ago

rgaudin commented 4 years ago
with libzim.writer.Creator("test_x05.zim", main_page="A/index.html", index_language="fra", min_chunk_size=2048) as zim:
    pass

T:7; A:3; RA:0; CA:3; UA:0; FA:0; IA:0; C:0; CC:0; UC:0; WC:0
T:7; Waiting for workers
T:7; ResolveRedirectIndexes
Resolve redirect
T:7; Set article indexes
set index
T:7; Resolve mimetype
T:7; create title index
T:7; 5 title index created
T:7; 2 clusters created
T:7; write zimfile :
T:7;  write mimetype list
T:7;  write directory entries
T:7;  write url prt list
T:7;  write title index
T:7;  write cluster offset list
T:7;  write header
T:7;  write checksum
T:7; rename tmpfile to final one.
T:7; finish

and on the filesystem:

.rw-r--r--   24k reg  staff 10 Jun 13:33  test_x05.idx
drwxr-xr-x     - reg  staff 10 Jun 13:33  test_x05.idx.tmp
.rw-r--r--   50k reg  staff 10 Jun 13:33  test_x05.zim
.rw-r--r--   24k reg  staff 10 Jun 13:33  test_x05_title.idx
drwxr-xr-x     - reg  staff 10 Jun 13:33  test_x05_title.idx.tmp

zim file is working (albeit without actual article) but the xapian stuff is not removed.

mgautierfr commented 4 years ago

The index are cleaned by the Creator destructor. This is probably because we don't correctly delete it :