View Single Post
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, 41 views)

Last edited by pdurrant; 03-21-2025 at 03:17 AM. Reason: spoilered
rgolubev is offline   Reply With Quote