EPUB to DOCX conversion fails when text-indent value is invalid

Bug #1618869 reported by Daniel James on 2016-08-31
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Hi, Calibre was downloaded from http://calibre-ebook.com/download_linux and installed on Debian jessie amd64. Conversion of the attached EPUB to DOCX failed with the following output.

Thanks for a great tool!

Daniel

calibre, version 2.65.1 (linux2, embedded-python: True)
Conversion Error: Failed: Convert book 1 of 1 (Alice im Wunderland)

Convert book 1 of 1 (Alice im Wunderland)
Resolved conversion options
calibre version: 2.65.1
{'asciiize': False,
 'author_sort': None,
 'authors': None,
 'base_font_size': 0.0,
 'book_producer': None,
 'change_justification': u'original',
 'chapter': u"//*[((name()='h1' or name()='h2') and re:test(., '\\s*((chapter|book|section|part)\\s+)|((prolog|prologue|epilogue)(\\s+|$))', 'i')) or @class = 'chapter']",
 'chapter_mark': u'pagebreak',
 'comments': None,
 'cover': u'/tmp/calibre_2.65.1_tmp_9qxxof/JWwhdX.jpeg',
 'debug_pipeline': None,
 'dehyphenate': True,
 'delete_blank_paragraphs': True,
 'disable_font_rescaling': False,
 'docx_custom_page_size': None,
 'docx_no_cover': False,
 'docx_no_toc': False,
 'docx_page_size': u'letter',
 'duplicate_links_in_toc': False,
 'embed_all_fonts': False,
 'embed_font_family': None,
 'enable_heuristics': False,
 'expand_css': False,
 'extra_css': None,
 'extract_to': None,
 'filter_css': u'',
 'fix_indents': True,
 'font_size_mapping': None,
 'format_scene_breaks': True,
 'html_unwrap_factor': 0.4,
 'input_encoding': None,
 'input_profile': <calibre.customize.profiles.InputProfile object at 0x7fd7233c2510>,
 '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': 72.0,
 'margin_left': 72.0,
 'margin_right': 72.0,
 'margin_top': 72.0,
 'markup_chapter_headings': True,
 'max_toc_links': 50,
 'minimum_line_height': 120.0,
 'no_chapters_in_toc': False,
 'no_inline_navbars': False,
 'output_profile': <calibre.customize.profiles.TabletOutput object at 0x7fd7233d5110>,
 'page_breaks_before': '/',
 'prefer_metadata_cover': False,
 'pretty_print': False,
 'pubdate': None,
 'publisher': None,
 'rating': None,
 'read_metadata_from_opf': u'/tmp/calibre_2.65.1_tmp_9qxxof/3DCk9g.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': u'',
 '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,
 'transform_css_rules': '[]',
 'unsmarten_punctuation': False,
 'unwrap_lines': True,
 'use_auto_toc': False,
 'verbose': 2}
InputFormatPlugin: EPUB Input running
on /tmp/calibre_2.65.1_tmp_9qxxof/uNw2hX.epub
Parsing all content...
Parsing OEBPS/Text/sechstes-kapitel-ferkel-und-pfeffer.xhtml ...
Parsing OEBPS/Styles/theme.css ...
PropertyValue: Missing token for production Choice(ColorValue, Dimension, URIValue, Value, variable, MSValue, CSSCalc, function): ('CHAR', u'%', 2, 16)
No content to parse.
PropertyValue: Unknown syntax or no value: %
CSSStyleDeclaration: Syntax Error in Property: line-height: %
No content to parse.
PropertyValue: Unknown syntax or no value:
CSSStyleDeclaration: Syntax Error in Property: text-align:
PropertyValue: Missing token for production Choice(ColorValue, Dimension, URIValue, Value, variable, MSValue, CSSCalc, function): ('CHAR', u'%', 40, 16)
No content to parse.
PropertyValue: Unknown syntax or no value: %
CSSStyleDeclaration: Syntax Error in Property: font-size: %
No content to parse.
PropertyValue: Unknown syntax or no value:
CSSStyleDeclaration: Syntax Error in Property: color:
PropertyValue: Missing token for production Choice(ColorValue, Dimension, URIValue, Value, variable, MSValue, CSSCalc, function): ('CHAR', u'%', 45, 16)
No content to parse.
PropertyValue: Unknown syntax or no value: %
CSSStyleDeclaration: Syntax Error in Property: font-size: %
PropertyValue: Missing token for production Choice(ColorValue, Dimension, URIValue, Value, variable, MSValue, CSSCalc, function): ('CHAR', u'%', 49, 16)
No content to parse.
PropertyValue: Unknown syntax or no value: %
CSSStyleDeclaration: Syntax Error in Property: font-size: %
PropertyValue: Missing token for production Choice(ColorValue, Dimension, URIValue, Value, variable, MSValue, CSSCalc, function): ('CHAR', u'%', 54, 16)
No content to parse.
PropertyValue: Unknown syntax or no value: %
CSSStyleDeclaration: Syntax Error in Property: font-size: %
PropertyValue: Missing token for production Choice(ColorValue, Dimension, URIValue, Value, variable, MSValue, CSSCalc, function): ('CHAR', u'%', 59, 16)
No content to parse.
PropertyValue: Unknown syntax or no value: %
CSSStyleDeclaration: Syntax Error in Property: font-size: %
PropertyValue: Missing token for production Choice(ColorValue, Dimension, URIValue, Value, variable, MSValue, CSSCalc, function): ('CHAR', u'%', 68, 16)
No content to parse.
PropertyValue: Unknown syntax or no value: %
CSSStyleDeclaration: Syntax Error in Property: line-height: %
Parsing OEBPS/Text/widmung.xhtml ...
Parsing OEBPS/Text/impressum.xhtml ...
Parsing OEBPS/Text/drittes-kapitel-caucus-rennen-und-was-daraus-wird.xhtml ...
Parsing OEBPS/Text/viertes-kapitel-die-wohnung-des-kaninchens.xhtml ...
Parsing OEBPS/Text/funftes-kapitel-guter-rath-von-einer-raupe.xhtml ...
Parsing OEBPS/Text/siebentes-kapitel-die-tolle-theegesellschaft.xhtml ...
Parsing OEBPS/Text/achtes-kapitel-das-croquetfeld-der-konigin.xhtml ...
Parsing OEBPS/Text/nav.xhtml ...
Parsing OEBPS/Text/neuntes-kapitel-die-geschichte-der-falschen-schildkrote.xhtml ...
Parsing OEBPS/Text/erstes-kapitel-hinunter-in-den-kaninchenbau.xhtml ...
Parsing OEBPS/Text/zehntes-kapitel-das-hummerballet.xhtml ...
Parsing OEBPS/Text/elftes-kapitel-wer-hat-die-kuchen-gestohlen.xhtml ...
Parsing OEBPS/Text/zwolftes-kapitel-alice-ist-die-klugste.xhtml ...
Parsing OEBPS/Text/zweites-kapitel-der-thranenpfuhl.xhtml ...
Reading TOC from NCX...
Merging user specified metadata...
Detecting structure...
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Found 770 items of level: p_2
Found 19 items of level: p_6
Found 4 items of level: div_6
Found 4 items of level: div_7
Found 36 items of level: div_2
Found 36 items of level: div_3
Found 27 items of level: div_1
Ignoring level div_6
Ignoring level div_7
Ignoring level p_6
p_2 left margin stats: Counter({u'0': 770})
p_2 right margin stats: Counter({u'0': 770})
div_2 left margin stats: Counter()
div_2 right margin stats: Counter()
div_3 left margin stats: Counter({u'': 36})
div_3 right margin stats: Counter({u'': 36})
div_1 left margin stats: Counter({u'': 14})
div_1 right margin stats: Counter({u'': 14})
Cleaning up manifest...
Trimming unused files from manifest...
Trimming u'OEBPS/Images/alice010.jpg' from manifest
Trimming u'OEBPS/Images/alice104.jpg' from manifest
Trimming u'OEBPS/Images/alice101.jpg' from manifest
Trimming u'OEBPS/Images/alice086.jpg' from manifest
Trimming u'OEBPS/Images/alice096.jpg' from manifest
Trimming u'OEBPS/Images/alice093.jpg' from manifest
Trimming u'OEBPS/Images/alice088.jpg' from manifest
Trimming u'OEBPS/Images/alice077.jpg' from manifest
Trimming u'OEBPS/Images/alice082.jpg' from manifest
Trimming u'OEBPS/Images/alice080.jpg' from manifest
Trimming u'OEBPS/Images/alice074.jpg' from manifest
Trimming u'OEBPS/Images/alice072.jpg' from manifest
Trimming u'OEBPS/Images/alice070.jpg' from manifest
Trimming u'OEBPS/Images/alice066.jpg' from manifest
Trimming u'OEBPS/Images/alice063.jpg' from manifest
Trimming u'OEBPS/Images/alice060.jpg' from manifest
Trimming u'OEBPS/Images/alice058.jpg' from manifest
Trimming u'OEBPS/Images/alice057.jpg' from manifest
Trimming u'OEBPS/Images/alice054.jpg' from manifest
Trimming u'OEBPS/Images/alice051.jpg' from manifest
Trimming u'OEBPS/Images/alice046.jpg' from manifest
Trimming u'OEBPS/Images/alice045.jpg' from manifest
Trimming u'OEBPS/Images/alice044.jpg' from manifest
Trimming u'OEBPS/Images/alice043.jpg' from manifest
Trimming u'OEBPS/Images/alice039.jpg' from manifest
Trimming u'OEBPS/Images/alice036.jpg' from manifest
Trimming u'OEBPS/Images/alice033.jpg' from manifest
Trimming u'OEBPS/Images/alice026.jpg' from manifest
Trimming u'OEBPS/Images/alice019.jpg' from manifest
Trimming u'OEBPS/Images/alice015.jpg' from manifest
Trimming u'OEBPS/Images/alice011.jpg' from manifest
Trimming u'OEBPS/toc.ncx' from manifest
Trimming u'OEBPS/Images/alice007.jpg' from manifest
Trimming u'OEBPS/Images/alice041.jpg' from manifest
Trimming u'OEBPS/Images/alice034.jpg' from manifest
Trimming u'OEBPS/Images/alice113.jpg' from manifest
Trimming u'OEBPS/Images/alice022.jpg' from manifest
Trimming u'OEBPS/Images/alice108.jpg' from manifest
Trimming u'OEBPS/Images/alice115.jpg' from manifest
Trimming u'OEBPS/Images/alice017.jpg' from manifest
Trimming u'OEBPS/Images/alice106.jpg' from manifest
Creating DOCX Output...
Rasterizing SVG images...
Processing OEBPS/Text/nav.xhtml
Processing OEBPS/Text/impressum.xhtml
Traceback (most recent call last):
  File "site.py", line 66, in main
  File "site-packages/calibre/utils/ipc/worker.py", line 190, in main
  File "site-packages/calibre/gui2/convert/gui_conversion.py", line 31, in gui_convert_override
  File "site-packages/calibre/gui2/convert/gui_conversion.py", line 25, in gui_convert
  File "site-packages/calibre/ebooks/conversion/plumber.py", line 1222, in run
  File "site-packages/calibre/ebooks/conversion/plugins/docx_output.py", line 65, in convert
  File "site-packages/calibre/ebooks/docx/writer/from_html.py", line 416, in __call__
  File "site-packages/calibre/ebooks/docx/writer/from_html.py", line 458, in process_item
  File "site-packages/calibre/ebooks/docx/writer/from_html.py", line 509, in process_tag
  File "site-packages/calibre/ebooks/docx/writer/from_html.py", line 509, in process_tag
  File "site-packages/calibre/ebooks/docx/writer/from_html.py", line 506, in process_tag
  File "site-packages/calibre/ebooks/docx/writer/from_html.py", line 538, in add_block_tag
  File "site-packages/calibre/ebooks/docx/writer/from_html.py", line 278, in start_new_block
  File "site-packages/calibre/ebooks/docx/writer/from_html.py", line 146, in __init__
  File "site-packages/calibre/ebooks/docx/writer/styles.py", line 622, in create_block_style
  File "site-packages/calibre/ebooks/docx/writer/styles.py", line 488, in __init__
ValueError: invalid literal for int() with base 10: 'emememememememememememememememememememem'

Daniel James (daniel-64studio) wrote :
Daniel James (daniel-64studio) wrote :

Converting EPUB to MOBI first, then converting MOBI to DOCX, does work for this file on the same machine.

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released

Hi Kovid, that was fast :-) Your fix in https://github.com/kovidgoyal/calibre/commit/d6c3a1b1e193b6e54a9dd15b10670959c2bba4c1 helped us identify a bug in our EPUB generation.

Cheers!

Daniel

summary: - EPUB to DOCX conversion fails
+ EPUB to DOCX conversion fails when text-indent value is invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers