Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 05-20-2025, 11:56 PM   #1
Shane45666
Junior Member
Shane45666 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: May 2025
Device: Calibre
Error opening rezipped or open Epub file

Keep getting this error when trying to edit a re-zipped EPUB, or open the unzipped folder to edit.


calibre, version 8.4.0

Traceback (most recent call last):
File "calibre\gui2\tweak_book\job.py", line 33, in run
File "calibre\gui2\tweak_book\boss.py", line 101, in get_container
File "calibre\ebooks\oeb\polish\container.py", line 1637, in get_container
File "calibre\ebooks\oeb\polish\container.py", line 1226, in __init__
calibre.ebooks.oeb.polish.container.InvalidEpub: META-INF/container.xml contains no link to OPF file

There is an OPF file, and a META-INF file, and the container.xml seems to have a link to the OPF file

XML File

<?xml version="1.0" encoding="UTF-8"?><container xmlns="urnasis:names:tcpendocument:xmlns:conta iner" version="1.0">
<rootfiles xmlns="">
<rootfile full-path="OPS/package.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>

How to fix?
Shane45666 is offline   Reply With Quote
Old 05-21-2025, 12:01 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,242
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
that error indicates you have broken your epub file. I suggest you use the edit book tool rather than trying to hand edit epub files.
kovidgoyal is online now   Reply With Quote
Old 05-21-2025, 01:30 AM   #3
Shane45666
Junior Member
Shane45666 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: May 2025
Device: Calibre
I got the original as an extracted Epub file, so I am trying to turn it back into an epub file. When I try to add it to calibre with Multiple folders, it does not recognize the book properly
Shane45666 is offline   Reply With Quote
Old 05-21-2025, 01:32 AM   #4
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 45,210
Karma: 168808723
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Shane45666 View Post
Keep getting this error when trying to edit a re-zipped EPUB, or open the unzipped folder to edit.


calibre, version 8.4.0

Traceback (most recent call last):
File "calibre\gui2\tweak_book\job.py", line 33, in run
File "calibre\gui2\tweak_book\boss.py", line 101, in get_container
File "calibre\ebooks\oeb\polish\container.py", line 1637, in get_container
File "calibre\ebooks\oeb\polish\container.py", line 1226, in __init__
calibre.ebooks.oeb.polish.container.InvalidEpub: META-INF/container.xml contains no link to OPF file

There is an OPF file, and a META-INF file, and the container.xml seems to have a link to the OPF file

XML File

<?xml version="1.0" encoding="UTF-8"?><container xmlns="urnasis:names:tcpendocument:xmlns:conta iner" version="1.0">
<rootfiles xmlns="">
<rootfile full-path="OPS/package.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>

How to fix?
Opening the unzipped ePub to attempt to edit it will only work if you use Sigil with it's Folder In/Folder Out plugin. An ePub has a very specific structure.

Going by the spec, the mimetype file must be in the root of the archive and not compressed. The container.xml file must be in the META-INF directory. The other files can be in the root of the .zip container or in subdirectories. However the container.xml has the path to the .opf file. In your case, the package.ofp file must in the OPS directory which must be in the root of the .zip container.

I've attached some images from opening an ePub file using 7-Zip (first is the root of the .zip container then the contents of the OEBPS directory and then the container.xml file open in an editor.

If you manually re-zip an unzipped ePub, you will need to add the mimetype file uncompressed first and then the remainder of the files in the same directory structure as the original ePub since that structure will be used for all the paths.

Please do not tell us just where you got an ePub as an unzipped file.
Attached Thumbnails
Click image for larger version

Name:	Screenshot 2025-05-20 222912.png
Views:	16
Size:	4.2 KB
ID:	215780   Click image for larger version

Name:	Screenshot 2025-05-20 222928.png
Views:	14
Size:	6.3 KB
ID:	215781   Click image for larger version

Name:	Screenshot 2025-05-20 223037.png
Views:	13
Size:	11.2 KB
ID:	215782  

Last edited by DNSB; 05-21-2025 at 01:35 AM.
DNSB is offline   Reply With Quote
Old 05-21-2025, 01:44 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,242
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by Shane45666 View Post
I got the original as an extracted Epub file, so I am trying to turn it back into an epub file. When I try to add it to calibre with Multiple folders, it does not recognize the book properly
In a terminal run

ebook-convert /path/to/opf/file.opf output.epub


that should take care of it.
kovidgoyal is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error opening saved file helens Sigil 16 04-23-2023 12:41 PM
ePub3 to Mobi Error - Error(prcgen):E21027: Epub file has more than one opf file dtsmith Kindle Formats 4 01-30-2018 11:20 AM
error opening a LIT file mfsav2 Conversion 5 04-13-2013 09:16 PM
Keep getting "Page Error" on epub file when I open it on my PRS-300 (filesize > 25MB) ryancolm Sigil 6 09-03-2010 10:45 AM
Error when opening lit file thfc2008 Other formats 7 11-25-2008 06:55 PM


All times are GMT -4. The time now is 11:54 AM.


MobileRead.com is a privately owned, operated and funded community.