View Single Post
Old 05-08-2024, 07:10 AM   #4
Peter Blaise
Member
Peter Blaise began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Dec 2016
Device: mobi
Thanks for considering this, let's play ...

After 18 successful conversions of other EPUB to MOBI with this Calibre Ebook installation software through versions 7.7, 7.9, and 7.10, from April to now, about a month, ( and I successfully test-converted an additional EPUB to MOBI after this error ) here are some error contents for this particular EPUB:

CONVERT EPUB TO MOBI ERROR:

Quote:
Convert book 1 of 1 (... epub title ...)
Conversion options changed from defaults:
change_justification: 'left'
asciiize: True
linearize_tables: True
cover: 'C:\\Temp\\calibre_eta7esml\\jx1cst3l.jpeg'
verbose: 2
filter_css: 'margin-bottom,,background,padding-right,padding-bottom,color,background-color,margin-left,font-family,margin-right,margin,padding,padding-left,float,margin-top,padding-top'
unsmarten_punctuation: True
output_profile: 'kindle_voyage'
expand_css: True
read_metadata_from_opf: 'C:\\Temp\\calibre_eta7esml\\r2w04x3z.opf'
Resolved conversion options
calibre version: 7.10.0
{'asciiize': True,
'author_sort': None,
'authors': None,
'base_font_size': 0.0,
'book_producer': None,
'change_justification': 'left',
'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': 'C:\\Temp\\calibre_eta7esml\\jx1cst3l.jpeg',
'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': True,
'extra_css': None,
'extract_to': None,
'filter_css': 'margin-bottom,,background,padding-right,padding-bottom,color,background-color,margin-left,font-family,margin-right,margin,padding,padding-left,float,margin-top,padding-top',
'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 0x000002079F4DF9D0>,
'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': True,
'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.KindleVoyageOutput object at 0x000002079F4F3450>,
'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:\\Temp\\calibre_eta7esml\\r2w04x3z.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': True,
'unwrap_lines': True,
'use_auto_toc': False,
'verbose': 2}
InputFormatPlugin: EPUB Input running
on C:\Temp\calibre_eta7esml\wtir915l.epub
Found HTML cover cov.xhtml
Parsing all content...
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 1132, in run
File "calibre\ebooks\conversion\plumber.py", line 1336, in create_oebbook
File "calibre\ebooks\oeb\reader.py", line 97, in __call__
File "calibre\ebooks\oeb\reader.py", line 722, in _all_from_opf
File "calibre\ebooks\oeb\reader.py", line 164, in _metadata_from_opf
File "calibre\ebooks\metadata\opf2.py", line 694, in to_book_metadata
File "calibre\ebooks\metadata\opf3.py", line 1067, in read_metadata
File "calibre\ebooks\metadata\book\base.py", line 444, in set_user_metadata
AttributeError: Custom field name '' must begin with '#'
====================================

So let's try re-editing it:


ERROR OPENING EPUB FOR EDITING:

Quote:
calibre, version 7.10.0
ERROR: Unhandled exception: <b>AttributeError</b>:Custom field name '' must begin with '#'

calibre 7.10 embedded-python: True
Windows-10-10.0.22621-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.22621')
Python 3.11.5
Windows: ('10', '10.0.22621', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: C:\Program Files\Calibre7\calibre-parallel.exe
Traceback (most recent call last):
File "calibre\gui2\__init__.py", line 801, in dispatch
File "calibre\gui2\tweak_book\job.py", line 84, in job_done
File "calibre\gui2\tweak_book\boss.py", line 398, in book_opened
File "calibre\ebooks\oeb\polish\container.py", line 655, in mi
File "calibre\ebooks\metadata\opf2.py", line 694, in to_book_metadata
File "calibre\ebooks\metadata\opf3.py", line 1067, in read_metadata
File "calibre\ebooks\metadata\book\base.py", line 444, in set_user_metadata
AttributeError: Custom field name '' must begin with '#'
==========================================

Let's try embedding metadata:

Quote:
calibre, version 7.10.0
WARNING: Failed for some files: Failed to embed metadata into some book files. Click "Show details" for details.

The EPUB format of (... epub title ...):

Traceback (most recent call last):
File "calibre\customize\ui.py", line 500, in set_file_type_metadata
File "calibre\customize\builtins.py", line 449, in set_metadata
File "calibre\ebooks\metadata\epub.py", line 259, in set_metadata
File "calibre\ebooks\metadata\opf.py", line 108, in set_metadata
File "calibre\ebooks\metadata\opf.py", line 95, in set_metadata_opf3
File "calibre\ebooks\metadata\opf3.py", line 1080, in apply_metadata
File "calibre\ebooks\metadata\opf3.py", line 1067, in read_metadata
File "calibre\ebooks\metadata\book\base.py", line 444, in set_user_metadata
AttributeError: Custom field name '' must begin with '#'
============================================

OK, let's polish the book:

Quote:
calibre, version 7.10.0 (win32, embedded-python: True)
Conversion error: Failed: (...epub name...)

Polish (...epub name...)
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\ebooks\oeb\polish\main.py", line 300, in gui_polish
File "calibre\ebooks\oeb\polish\main.py", line 278, in polish
File "calibre\ebooks\oeb\polish\main.py", line 181, in polish_one
File "calibre\ebooks\oeb\polish\main.py", line 158, in update_metadata
File "calibre\ebooks\metadata\opf.py", line 108, in set_metadata
File "calibre\ebooks\metadata\opf.py", line 95, in set_metadata_opf3
File "calibre\ebooks\metadata\opf3.py", line 1080, in apply_metadata
File "calibre\ebooks\metadata\opf3.py", line 1067, in read_metadata
File "calibre\ebooks\metadata\book\base.py", line 444, in set_user_metadata
AttributeError: Custom field name '' must begin with '#'
==============================================

Now, if I were to look for:

File "calibre\ebooks\metadata\book\base.py"

... where would I look?

Windows File Explorer found:

C:\Program Files\LibreOffice\program\python-core-3.8.19\lib\email\mime\base.py

Quote:
# Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org

"""Base class for MIME specializations."""

__all__ = ['MIMEBase']

import email.policy

from email import message



class MIMEBase(message.Message):
"""Base class for MIME specializations."""

def __init__(self, _maintype, _subtype, *, policy=None, **_params):
"""This constructor adds a Content-Type: and a MIME-Version: header.

The Content-Type: header is taken from the _maintype and _subtype
arguments. Additional parameters for this header are taken from the
keyword arguments.
"""
if policy is None:
policy = email.policy.compat32
message.Message.__init__(self, policy=policy)
ctype = '%s/%s' % (_maintype, _subtype)
self.add_header('Content-Type', ctype, **_params)
self['MIME-Version'] = '1.0'
What would I do with it?

But somehow I suspect that's not the problem, it's just the complainer, the problem is somewhere else, somewhere earlier.

More important to me as an end user . . . . why present me with an error I cannot fix INSTEAD of just going ahead and fixing the error and moving on?

Saying "Note, fixed an error by adding # in front of custom field name, if this auto-repaired EPUB misbehaves, please reload the original and try again".

Considering that Amazon had no problem converting this supposedly now uneditable by Calibre Ebook EPUB, I'd think that, yes, an auto fix is quite possible.

What to do now?

Thanks for exploring what might be going wrong here.

Post script: I tried deleting all user medatada, no difference, same errors for this EPUB. I have ONE custom column that works for everything else, even for this EPUB, but toggled off or on, empty or with something in the column, same errors:





.



.

Last edited by Peter Blaise; 05-08-2024 at 07:30 AM.
Peter Blaise is offline   Reply With Quote