Error converting from EPUB to PDF

Bug #1689192 reported by Sameer on 2017-05-07
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Hello,

Tried to convert EPUB to PDF using all default settings in the latest Calibre version 2.84.0 (Windows x64).

I am trying to convert on my Windows 10 x64 Home Desktop, so no e-reader devices are involved or connected.

This is the error log I get after the failed conversion attempt:-

=======================================================
calibre, version 2.84.0 (win32, embedded-python: True)
Conversion error: Failed: Convert book 1 of 1 (Superintelligence: Paths, Dangers, Strategies)

Convert book 1 of 1 (Superintelligence: Paths, Dangers, Strategies)
Conversion options changed from defaults:
  read_metadata_from_opf: u'C:\\Users\\username\\AppData\\Local\\Temp\\calibre_jwfibf\\colve5.opf'
  pdf_sans_family: u'Segoe UI'
  use_profile_size: True
  disable_font_rescaling: True
  pdf_page_numbers: True
  preserve_cover_aspect_ratio: True
  embed_all_fonts: True
  output_profile: 'generic_eink'
  cover: u'C:\\Users\\username\\AppData\\Local\\Temp\\calibre_jwfibf\\hdqugd.jpeg'
  subset_embedded_fonts: True
  verbose: 2
Resolved conversion options
calibre version: 2.84.0
{'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'C:\\Users\\username\\AppData\\Local\\Temp\\calibre_jwfibf\\hdqugd.jpeg',
 'custom_size': None,
 'debug_pipeline': None,
 'dehyphenate': True,
 'delete_blank_paragraphs': True,
 'disable_font_rescaling': True,
 'duplicate_links_in_toc': False,
 'embed_all_fonts': True,
 'embed_font_family': None,
 'enable_heuristics': False,
 'expand_css': False,
 'extra_css': 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 0x00000000028595F8>,
 '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_inline_navbars': False,
 'output_profile': <calibre.customize.profiles.GenericEink object at 0x0000000002859978>,
 'page_breaks_before': u'/',
 'paper_size': u'letter',
 'pdf_add_toc': False,
 'pdf_default_font_size': 20,
 'pdf_footer_template': None,
 'pdf_header_template': None,
 'pdf_mark_links': False,
 'pdf_mono_family': u'Courier New',
 'pdf_mono_font_size': 16,
 'pdf_page_margin_bottom': 72.0,
 'pdf_page_margin_left': 72.0,
 'pdf_page_margin_right': 72.0,
 'pdf_page_margin_top': 72.0,
 'pdf_page_numbers': True,
 'pdf_sans_family': u'Segoe UI',
 'pdf_serif_family': u'Times New Roman',
 'pdf_standard_font': u'serif',
 'prefer_metadata_cover': False,
 'preserve_cover_aspect_ratio': True,
 'pretty_print': False,
 'pubdate': None,
 'publisher': None,
 'rating': None,
 'read_metadata_from_opf': u'C:\\Users\\username\\AppData\\Local\\Temp\\calibre_jwfibf\\colve5.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': True,
 'tags': None,
 'timestamp': None,
 'title': None,
 'title_sort': None,
 'toc_filter': None,
 'toc_threshold': 6,
 'toc_title': None,
 'transform_css_rules': '[]',
 'uncompressed_pdf': False,
 'unit': u'inch',
 'unsmarten_punctuation': False,
 'unwrap_lines': True,
 'use_auto_toc': False,
 'use_profile_size': True,
 'verbose': 2}
InputFormatPlugin: EPUB Input running
on C:\Users\username\AppData\Local\Temp\calibre_jwfibf\brkmlf.epub
Found HTML cover titlepage.xhtml
Parsing all content...
Parsing titlepage.xhtml ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_023.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_014.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_024.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_015.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_001.html ...
Parsing stylesheet.css ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_000.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_016.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_002.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_025.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_003.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_017.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_004.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_005.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_018.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_006.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_007.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_019.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_026.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_008.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_009.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_020.html ...
Parsing page_styles.css ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_010.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_011.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_021.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_012.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_013.html ...
Parsing CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_022.html ...
Reading TOC from NCX...
Merging user specified metadata...
Detecting structure...
 Detected chapter: CHAPTER 1Past developments and present capabilitie
 Detected chapter: CHAPTER 2Paths to superintelligence
 Detected chapter: CHAPTER 3Forms of superintelligence
 Detected chapter: CHAPTER 4The kinetics of an intelligence explosion
 Detected chapter: CHAPTER 5Decisive strategic advantage
 Detected chapter: CHAPTER 6Cognitive superpowers
 Detected chapter: CHAPTER 7The superintelligent will
 Detected chapter: CHAPTER 8Is the default outcome doom?
 Detected chapter: CHAPTER 9The control problem
 Detected chapter: CHAPTER 10Oracles, genies, sovereigns, tools
 Detected chapter: CHAPTER 11Multipolar scenarios
 Detected chapter: CHAPTER 12Acquiring values
 Detected chapter: CHAPTER 13Choosing the criteria for choosing
 Detected chapter: CHAPTER 14The strategic picture
 Detected chapter: CHAPTER 15Crunch time
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Found 708 items of level: p_3
Found 2017 items of level: p_2
Found 45 items of level: p_6
Found 166 items of level: p_5
Found 51 items of level: p_4
Found 26 items of level: div_1
Found 331 items of level: div_2
Found 82 items of level: div_3
Negative text indent detected at level p_3, ignoring this level
Negative text indent detected at level p_2, ignoring this level
p_6 left margin stats: Counter({u'0': 45})
p_6 right margin stats: Counter({u'0': 45})
Negative text indent detected at level p_5, ignoring this level
Negative text indent detected at level p_4, ignoring this level
div_1 left margin stats: Counter()
div_1 right margin stats: Counter()
div_2 left margin stats: Counter({u'': 14})
div_2 right margin stats: Counter({u'': 14})
div_3 left margin stats: Counter({u'': 82})
div_3 right margin stats: Counter({u'': 82})
Cleaning up manifest...
Trimming unused files from manifest...
Trimming u'titlepage.xhtml' from manifest
Creating PDF Output...
Splitting markup on page breaks and flow limits, if any...
Converting input as a text based book...
Serializing oeb input to disk for processing...
The cover image has an id != "cover". Renaming to work around bug in Nook Color
Rendering pages to PDF...
Processing C:\Users\username\AppData\Local\Temp\calibre_jwfibf\hxafjv_pdf_out\CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_000.html...
Loading font: family_name=Times New Roman full_name=Times New Roman postscript_name=TimesNewRomanPSMT subfamily_name=Regular
Processing C:\Users\username\AppData\Local\Temp\calibre_jwfibf\hxafjv_pdf_out\CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_001.html...
Loading font: family_name=Times New Roman full_name=Times New Roman Bold postscript_name=TimesNewRomanPS-BoldMT subfamily_name=Bold
Loading font: family_name=Times New Roman full_name=Times New Roman Italic postscript_name=TimesNewRomanPS-ItalicMT subfamily_name=Italic
Processing C:\Users\username\AppData\Local\Temp\calibre_jwfibf\hxafjv_pdf_out\CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_002.html...
Processing C:\Users\username\AppData\Local\Temp\calibre_jwfibf\hxafjv_pdf_out\CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_003.html...
Processing C:\Users\username\AppData\Local\Temp\calibre_jwfibf\hxafjv_pdf_out\CR!WRXXYATSYN7Q733PS9VMQYQC3QBZ_split_004.html...
Rendering failed
Traceback (most recent call last):
  File "site-packages\calibre\ebooks\pdf\render\from_html.py", line 286, in render_html
  File "site-packages\calibre\ebooks\pdf\render\from_html.py", line 416, in do_paged_render
  File "site-packages\calibre\ebooks\pdf\render\engine.py", line 331, in add_links
TypeError: 'NoneType' object has no attribute '__getitem__'

Python function terminated unexpectedly
  PDF Output failed, see log for details (Error Code: 1)
Traceback (most recent call last):
  File "site.py", line 132, in main
  File "site.py", line 109, in run_entry_point
  File "site-packages\calibre\utils\ipc\worker.py", line 195, in main
  File "site-packages\calibre\gui2\convert\gui_conversion.py", line 33, in gui_convert_override
  File "site-packages\calibre\gui2\convert\gui_conversion.py", line 26, in gui_convert
  File "site-packages\calibre\ebooks\conversion\plumber.py", line 1252, in run
  File "site-packages\calibre\ebooks\conversion\plugins\pdf_output.py", line 177, in convert
  File "site-packages\calibre\ebooks\conversion\plugins\pdf_output.py", line 256, in convert_text
  File "site-packages\calibre\ebooks\conversion\plugins\pdf_output.py", line 282, in write
  File "site-packages\calibre\ebooks\pdf\render\from_html.py", line 242, in dump
Exception: PDF Output failed, see log for details
=================================================

Upon searching online for the error "TypeError: 'NoneType' object has no attribute '__getitem__'" online, it seems like a coding bug, see this link:-

https://www.odoo.com/forum/help-1/question/how-to-fix-nonetype-object-has-no-attribute-getitem-68070

Please advise how to proceed.

Attach an EPUB file demonstrating/reproducing the problem to this bug report. You can do that by clicking the "Add attachment or patch" link at the bottom of the bug's page. If the file you are attaching is copyrighted, mark the bug as private. You can do this by clicking the tiny lock icon next to "This report contains Public information" in the top right area of the bug's page.

 status incomplete

Changed in calibre:
status: New → Incomplete
Sameer (spremji) wrote :

EPUB File attached.

information type: Public → Private

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

 status fixreleased

Changed in calibre:
status: Incomplete → Fix Released
Sameer (spremji) wrote :

Cool, thanks!

Kovid Goyal (kovid) on 2017-05-09
information type: Private → Public
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers