Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-17-2025, 12:27 AM   #1
rgolubev
Junior Member
rgolubev began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2025
Device: Android eBook Prestigio
Exclamation Valid epub file with com.apple.ibooks.display-options.xml fails to import

Hi fellow users,
I have an issue with import of a particular epub file. It can be unpacked in 7zip and is readable in eBook Prestigio Android reader app without any issues and appears with its cover image. However, when I try to import it into Calibre by using manual add with the default import options, and try to open it in the viewer, I get these errors indicating the ZIP file is damaged and container.xml is missing (it is indeed missing, there is only one file called com.apple.ibooks.display-options.xml in META-INF folder, if renamed to container.xml then everything works fine except that no cover image appears as a result of import but it is visible in the Calibre viewer):

calibre, version 7.26.0
ERROR: Loading book failed: Failed to open the book at C:\Users\Public\Documents\Calibre Library\The Code- Silicon Valley\Margaret O'Mara (1934)\Margaret O'Mara - The Code- Silicon Valley.epub. Click "Show details" for more info.

Spoiler:

Failed to convert book: C:\Users\Public\Documents\Calibre Library\The Code- Silicon Valley\Margaret O'Mara (1934)\Margaret O'Mara - The Code- Silicon Valley.epub with error:
Traceback (most recent call last):
File "calibre\customize\ui.py", line 482, in get_file_type_metadata
File "calibre\customize\builtins.py", line 176, in get_metadata
File "calibre\ebooks\metadata\epub.py", line 285, in get_quick_metadata
File "calibre\ebooks\metadata\epub.py", line 264, in get_metadata
File "calibre\ebooks\metadata\epub.py", line 184, in get_zip_reader
File "calibre\ebooks\metadata\epub.py", line 160, in __init__
File "calibre\ebooks\metadata\epub.py", line 104, in __init__
File "calibre\ebooks\metadata\epub.py", line 164, in open
File "calibre\utils\localunzip.py", line 277, in open
File "calibre\utils\localunzip.py", line 271, in _get_file_info
ValueError: This ZIP container has no file named: META-INF/container.xml
InputFormatPlugin: EPUB Input running
on C:\Users\Public\Documents\Calibre Library\The Code- Silicon Valley\Margaret O'Mara (1934)\Margaret O'Mara - The Code- Silicon Valley.epub
EPUB appears to be invalid ZIP file, trying a more forgiving ZIP parser
Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main()
Traceback (most recent call last):
File "calibre\ebooks\conversion\plugins\epub_input. py", line 265, in convert
File "calibre\utils\zipfile.py", line 777, in __init__
File "calibre\utils\zipfile.py", line 812, in _GetContents
File "calibre\utils\zipfile.py", line 827, in _RealGetContents
calibre.utils.zipfile.BadZipfile: File is not a zip file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "runpy.py", line 198, in _run_module_as_main
File "runpy.py", line 88, in _run_code
File "site.py", line 83, in <module>
File "site.py", line 78, in main
File "site.py", line 50, in run_entry_point
File "calibre\utils\ipc\worker.py", line 196, in main
File "<string>", line 1, in <module>
File "calibre\srv\render_book.py", line 845, in viewer_main
File "calibre\srv\render_book.py", line 836, in render_for_viewer
File "calibre\srv\render_book.py", line 813, in render
File "calibre\ebooks\oeb\iterator\book.py", line 64, in extract_book
File "calibre\customize\conversion.py", line 242, in __call__
File "calibre\ebooks\conversion\plugins\epub_input. py", line 272, in convert
File "calibre\utils\localunzip.py", line 254, in extractall
File "calibre\utils\localunzip.py", line 236, in _extractall
File "calibre\utils\localunzip.py", line 180, in copy_compressed_file
ValueError: Invalid ZIP file, local header is damaged

If I enable "Automatically convert added books to the preferred output format " and "When auto-converting, convert even if the format being added is the same as the output format" in Import/Export > Adding books preferences, Adding actions tab (default format being epub), I get these errors when importing:
calibre, version 7.26.0 (win32, embedded-python: True)
Conversion error: Failed: Convert book 1 of 1 (Margaret O'Mara)

Convert book 1 of 1 (Margaret O'Mara)
Conversion options changed from defaults:
output_profile: 'generic_eink'
verbose: 2
read_metadata_from_opf: 'C:\\Users\\ROMANG~1\\AppData\\Local\\Temp\\calibr e_cuhat0_u\\8o5aqk3l.opf'
Resolved conversion options
calibre version: 7.26.0
{'add_alt_text_to_img': False,
'asciiize': False,
'author_sort': None,
'authors': None,
'base_font_size': 0.0,
'book_producer': None,
'change_justification': 'original',
'chapter': "//*[((name()='h1' or name()='h2') and re:test(., "
"'\\s*((chapter|book|section|part)\\s+)|((prolog|p rologue|epilogue)(\\s+|$))', "
"'i')) or @class = 'chapter']",
'chapter_mark': 'pagebreak',
'comments': None,
'cover': None,
'debug_pipeline': None,
'dehyphenate': True,
'delete_blank_paragraphs': True,
'disable_font_rescaling': False,
'dont_split_on_page_breaks': False,
'duplicate_links_in_toc': False,
'embed_all_fonts': False,
'embed_font_family': None,
'enable_heuristics': False,
'epub_flatten': False,
'epub_inline_toc': False,
'epub_max_image_size': 'none',
'epub_toc_at_end': False,
'epub_version': '2',
'expand_css': False,
'extra_css': None,
'extract_to': None,
'filter_css': '',
'fix_indents': True,
'flow_size': 260,
'font_size_mapping': None,
'format_scene_breaks': True,
'html_unwrap_factor': 0.4,
'input_encoding': None,
'input_profile': <calibre.customize.profiles.InputProfile object at 0x000001D3EC14DB10>,
'insert_blank_line': False,
'insert_blank_line_size': 0.5,
'insert_metadata': False,
'isbn': None,
'italicize_common_cases': True,
'keep_ligatures': False,
'language': None,
'level1_toc': None,
'level2_toc': None,
'level3_toc': None,
'line_height': 0.0,
'linearize_tables': False,
'margin_bottom': 5.0,
'margin_left': 5.0,
'margin_right': 5.0,
'margin_top': 5.0,
'markup_chapter_headings': True,
'max_toc_links': 50,
'minimum_line_height': 120.0,
'no_chapters_in_toc': False,
'no_default_epub_cover': False,
'no_inline_navbars': False,
'no_svg_cover': False,
'output_profile': <calibre.customize.profiles.GenericEink object at 0x000001D3EC1594D0>,
'page_breaks_before': '/',
'prefer_metadata_cover': False,
'preserve_cover_aspect_ratio': False,
'pretty_print': True,
'pubdate': None,
'publisher': None,
'rating': None,
'read_metadata_from_opf': 'C:\\Users\\ROMANG~1\\AppData\\Local\\Temp\\calibr e_cuhat0_u\\8o5aqk3l.opf',
'remove_fake_margins': True,
'remove_first_image': False,
'remove_paragraph_spacing': False,
'remove_paragraph_spacing_indent_size': 1.5,
'renumber_headings': True,
'replace_scene_breaks': '',
'search_replace': '[]',
'series': None,
'series_index': None,
'smarten_punctuation': False,
'sr1_replace': None,
'sr1_search': None,
'sr2_replace': None,
'sr2_search': None,
'sr3_replace': None,
'sr3_search': None,
'start_reading_at': None,
'subset_embedded_fonts': False,
'tags': None,
'timestamp': None,
'title': None,
'title_sort': None,
'toc_filter': None,
'toc_threshold': 6,
'toc_title': None,
'transform_css_rules': '[]',
'transform_html_rules': '[]',
'unsmarten_punctuation': False,
'unwrap_lines': True,
'use_auto_toc': False,
'verbose': 2}
InputFormatPlugin: EPUB Input running
on C:\Users\ROMANG~1\AppData\Local\Temp\calibre_cuhat 0_u\fdhld4z_.epub
EPUB appears to be invalid ZIP file, trying a more forgiving ZIP parser
Traceback (most recent call last):
File "calibre\ebooks\conversion\plugins\epub_input. py", line 265, in convert
File "calibre\utils\zipfile.py", line 777, in __init__
File "calibre\utils\zipfile.py", line 812, in _GetContents
File "calibre\utils\zipfile.py", line 827, in _RealGetContents
calibre.utils.zipfile.BadZipfile: File is not a zip file

Traceback (most recent call last):
File "calibre\ebooks\conversion\plugins\epub_input. py", line 265, in convert
File "calibre\utils\zipfile.py", line 777, in __init__
File "calibre\utils\zipfile.py", line 812, in _GetContents
File "calibre\utils\zipfile.py", line 827, in _RealGetContents
calibre.utils.zipfile.BadZipfile: File is not a zip file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "runpy.py", line 198, in _run_module_as_main
File "runpy.py", line 88, in _run_code
File "site.py", line 83, in <module>
File "site.py", line 78, in main
File "site.py", line 50, in run_entry_point
File "calibre\utils\ipc\worker.py", line 215, in main
File "calibre\gui2\convert\gui_conversion.py", line 38, in gui_convert_override
File "calibre\gui2\convert\gui_conversion.py", line 25, in gui_convert
File "calibre\ebooks\conversion\plumber.py", line 1128, in run
File "calibre\customize\conversion.py", line 242, in __call__
File "calibre\ebooks\conversion\plugins\epub_input. py", line 272, in convert
File "calibre\utils\localunzip.py", line 254, in extractall
File "calibre\utils\localunzip.py", line 236, in _extractall
File "calibre\utils\localunzip.py", line 180, in copy_compressed_file
ValueError: Invalid ZIP file, local header is damaged.


It looks like Calibre isn't detecting com.apple.ibooks.display-options.xml as a valid container xml, but there is still a problem with extracting cover image file. Attached are com.apple.ibooks.display-options.xml renamed to contaner.xml and the repackaged with the renamed file epub book file

Cheers,
Roman
Attached Files
File Type: xml container.xml (160 Bytes, 23 views)

Last edited by pdurrant; 03-21-2025 at 03:17 AM. Reason: spoilered
rgolubev is offline   Reply With Quote
Old 03-17-2025, 05:52 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,171
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
container.xml is required by the EPUB standard and EPUB file without one isnt a valid EPUB file and wont work in calibre.
kovidgoyal is offline   Reply With Quote
Old 03-17-2025, 05:56 AM   #3
Martinoptic
Bibliolater
Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.
 
Martinoptic's Avatar
 
Posts: 6,608
Karma: 6000000
Join Date: Dec 2021
Location: England
Device: none
Shouldn't epubs have a container.xml file anyway and the com.apple.ibooks.display-options.xml be an adjunct (epub2)?
Your test file wont open for me in calibre viewer, nor books, nor readdle documents.
Havent run epubcheck - but that might throw some light on your problem?
I expect more epub-savvy people than I will be along shortly to offer help.

EDIT: Kovid beat me to reply.
Martinoptic is offline   Reply With Quote
Old 03-17-2025, 06:15 AM   #4
bustacap
PC Dev
bustacap turned on, tuned in, and dropped out.bustacap turned on, tuned in, and dropped out.bustacap turned on, tuned in, and dropped out.bustacap turned on, tuned in, and dropped out.bustacap turned on, tuned in, and dropped out.bustacap turned on, tuned in, and dropped out.bustacap turned on, tuned in, and dropped out.bustacap turned on, tuned in, and dropped out.bustacap turned on, tuned in, and dropped out.bustacap turned on, tuned in, and dropped out.bustacap turned on, tuned in, and dropped out.
 
bustacap's Avatar
 
Posts: 34
Karma: 35532
Join Date: Sep 2024
Device: Kindle Paperwhite (11th Gen), Lenovo Tab M10 (3rd Gen)
even when renaming its still not a valid container.xml file. it doesnt have the correct container tags and it doesnt point to the ebooks .opf file, which it should
bustacap is offline   Reply With Quote
Old 03-17-2025, 06:41 AM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,029
Karma: 144284074
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
@rgolubev go back to where you got this ePub and download it again. But this time do not use Android. If it has no DRM, then you'll get a .epub file. IF it has Adobe DRM, you'll get a .acsm file which needs to be used with Adobe Digital Editions or the ACSM plugin for calibre to then download the ePub.
JSWolf is offline   Reply With Quote
Old 03-17-2025, 06:04 PM   #6
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: 44,681
Karma: 168431851
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Looking at your test "epub", note that you MUST have the mimetype file in the root not in the rr directory (that is required by the ePub standard) and the OEBPS and META-INF directories should also be in the root of the ePub file. The container.xml file MUST point to the .opf document.

A sample container.xml would look like:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
    <rootfiles>
        <rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/>
   </rootfiles>
</container>
In your case, change the "OEBPS/content.opf" to "9780399562198.opf" since the ISBN is being used for the opf filename. I've made that change to the sample and it's in the container.zip file attached to this message.

Edit: I borrowed this book from the local library and the structure was correct. Also The Code is definitely still in copyright and I would strongly suggest removing the copy that you attached to the first message.
Attached Files
File Type: zip container.zip (351 Bytes, 31 views)

Last edited by DNSB; 03-17-2025 at 06:13 PM. Reason: Edit: Copyright infringement
DNSB is online now   Reply With Quote
Old 03-20-2025, 11:18 PM   #7
rgolubev
Junior Member
rgolubev began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2025
Device: Android eBook Prestigio
Quote:
Originally Posted by DNSB View Post
Looking at your test "epub", note that you MUST have the mimetype file in the root not in the rr directory (that is required by the ePub standard) and the OEBPS and META-INF directories should also be in the root of the ePub file. The container.xml file MUST point to the .opf document.

Edit: I borrowed this book from the local library and the structure was correct. Also The Code is definitely still in copyright and I would strongly suggest removing the copy that you attached to the first message.
I couldn't find how to delete my attachment or edit the post. Please
rgolubev is offline   Reply With Quote
Old 03-20-2025, 11:19 PM   #8
rgolubev
Junior Member
rgolubev began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2025
Device: Android eBook Prestigio
Quote:
Originally Posted by kovidgoyal View Post
container.xml is required by the EPUB standard and EPUB file without one isnt a valid EPUB file and wont work in calibre.
Thanks for clarification.
rgolubev is offline   Reply With Quote
Old 03-20-2025, 11:33 PM   #9
rgolubev
Junior Member
rgolubev began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Mar 2025
Device: Android eBook Prestigio
Thank you very much, David After I put your fixed file in, the import worked without any issues.
rgolubev is offline   Reply With Quote
Reply

Tags
container.xml, import, zip header


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Have Apple deprecated the display-options.xml file in ePub2? Oxford-eBooks ePub 6 11-27-2013 08:30 AM
Inserting com.apple.ibooks.display-options.xml file in EPUB roger64 ePub 30 02-28-2013 01:07 AM
com.apple.ibooks.display-options brewt Plugins 5 09-06-2012 09:57 AM
Presence of com.apple.ibooks.display-options.xml breaks Readium? rtmyers ePub 2 08-18-2012 05:01 AM
Valid ePub, but not valid enough for iBooks MichaelGray ePub 46 01-14-2011 08:22 AM


All times are GMT -4. The time now is 01:25 AM.


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