I'm working on a script to create epub from html files, but when I check my epub I have the following error : Mimetype entry missing or not the first in archive
The Mimetype is present, but it's not the first file in the epub. Any idea how to put it in first place in any case using Python ?
The solution I've found:

delete the previous mimetype file
when creating the new archive create an new mimetype file before adding anything else : zipFile.writestr("mimetype", "application/epub+zip")

Why does it work : the mimetype is the same for all epub : "application/epub+zip", no need to use the original file.
epub3 : how to add the mimetype at first in archive