I run portable calibre on Windows. The database holds about 400 book records. Calibre conversion from any format to mobi (and to other formats) always fails with this kind of log:
Quote:
Python function terminated unexpectedly
'bool' object is not iterable (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 186, 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 1049, in run
File "site-packages\calibre\ebooks\oeb\transforms\structure.p y", line 33, in __call__
File "site-packages\calibre\ebooks\oeb\transforms\structure.p y", line 124, in detect_chapters
TypeError: 'bool' object is not iterable
full log
Spoiler:
Quote:
calibre Debug log
calibre 0.9.8 Portable isfrozen: True
Windows-7-6.1.7601-SP1 Windows
('Windows', '7', '6.1.7601')
Python 2.7.3
Windows: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free')
Starting up...
Started up in 28.96 seconds with 243 books
Worker Launch took: 1.30099987984
Job: 1 Convert book 1 of 1 (Testing Conversion) finished
Convert book 1 of 1 (Testing Conversion)
Resolved conversion options
calibre version: 0.9.8
{'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|kap|liber|sek)\\s +)|((prolog|prologue|epilogue|prol|epyl)(\\s+|$))' , 'i')) or @class = 'chapter'] or name() = 'chapter'",
'chapter_mark': u'pagebreak',
'comments': None,
'cover': u'C:\\Users\\user\\AppData\\Local\\Temp\\calibre_0 .9.8_tmp_enxnik\\sujxlz.jpeg',
'debug_pipeline': None,
'dehyphenate': True,
'delete_blank_paragraphs': True,
'disable_font_rescaling': False,
'dont_compress': False,
'duplicate_links_in_toc': False,
'embed_font_family': None,
'enable_heuristics': 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 0x04654050>,
'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': u'//h:h1',
'level2_toc': u'//h:h2',
'level3_toc': u'//h:h3',
'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,
'mobi_file_type': u'old',
'mobi_ignore_margins': False,
'mobi_keep_original_images': False,
'mobi_toc_at_start': False,
'new_pdf_engine': False,
'no_chapters_in_toc': False,
'no_images': False,
'no_inline_navbars': True,
'no_inline_toc': False,
'output_profile': <calibre.customize.profiles.KindleOutput object at 0x04654390>,
'page_breaks_before': u"//*[name()='h1' or name()='h2']",
'personal_doc': u'[PDOC]',
'prefer_author_sort': False,
'prefer_metadata_cover': True,
'pretty_print': False,
'pubdate': None,
'publisher': None,
'rating': None,
'read_metadata_from_opf': u'C:\\Users\\user\\AppData\\Local\\Temp\\calibre_0 .9.8_tmp_enxnik\\ghri7w.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,
'share_not_sync': False,
'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,
'unsmarten_punctuation': False,
'unwrap_factor': 0.45,
'unwrap_lines': True,
'use_auto_toc': False,
'verbose': 2}
InputFormatPlugin: PDF Input running
on C:\Users\user\AppData\Local\Temp\calibre_0.9.8_tmp _enxnik\llbqlh.pdf
Converting file to html...
Retrieving document metadata...
Generating manifest...
Rendering manifest...
Parsing all content...
Parsing index.html ...
Initial parse failed, using more forgiving parsers
Parsing index.html as HTML
Generating default TOC from spine...
Merging user specified metadata...
Detecting structure...
Python function terminated unexpectedly
'bool' object is not iterable (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 186, 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 1049, in run
File "site-packages\calibre\ebooks\oeb\transforms\structure.p y", line 33, in __call__
File "site-packages\calibre\ebooks\oeb\transforms\structure.p y", line 124, in detect_chapters
TypeError: 'bool' object is not iterable
Convert book 1 of 1 (Testing Conversion)
Resolved conversion options
calibre version: 0.9.8
{'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|kap|liber|sek)\\s +)|((prolog|prologue|epilogue|prol|epyl)(\\s+|$))' , 'i')) or @class = 'chapter'] or name() = 'chapter'",
'chapter_mark': u'pagebreak',
'comments': None,
'cover': u'C:\\Users\\user\\AppData\\Local\\Temp\\calibre_0 .9.8_tmp_enxnik\\sujxlz.jpeg',
'debug_pipeline': None,
'dehyphenate': True,
'delete_blank_paragraphs': True,
'disable_font_rescaling': False,
'dont_compress': False,
'duplicate_links_in_toc': False,
'embed_font_family': None,
'enable_heuristics': 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 0x04654050>,
'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': u'//h:h1',
'level2_toc': u'//h:h2',
'level3_toc': u'//h:h3',
'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,
'mobi_file_type': u'old',
'mobi_ignore_margins': False,
'mobi_keep_original_images': False,
'mobi_toc_at_start': False,
'new_pdf_engine': False,
'no_chapters_in_toc': False,
'no_images': False,
'no_inline_navbars': True,
'no_inline_toc': False,
'output_profile': <calibre.customize.profiles.KindleOutput object at 0x04654390>,
'page_breaks_before': u"//*[name()='h1' or name()='h2']",
'personal_doc': u'[PDOC]',
'prefer_author_sort': False,
'prefer_metadata_cover': True,
'pretty_print': False,
'pubdate': None,
'publisher': None,
'rating': None,
'read_metadata_from_opf': u'C:\\Users\\user\\AppData\\Local\\Temp\\calibre_0 .9.8_tmp_enxnik\\ghri7w.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,
'share_not_sync': False,
'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,
'unsmarten_punctuation': False,
'unwrap_factor': 0.45,
'unwrap_lines': True,
'use_auto_toc': False,
'verbose': 2}
InputFormatPlugin: PDF Input running
on C:\Users\user\AppData\Local\Temp\calibre_0.9.8_tmp _enxnik\llbqlh.pdf
Converting file to html...
Retrieving document metadata...
Generating manifest...
Rendering manifest...
Parsing all content...
Parsing index.html ...
Initial parse failed, using more forgiving parsers
Parsing index.html as HTML
Generating default TOC from spine...
Merging user specified metadata...
Detecting structure...
Python function terminated unexpectedly
'bool' object is not iterable (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 186, 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 1049, in run
File "site-packages\calibre\ebooks\oeb\transforms\structure.p y", line 33, in __call__
File "site-packages\calibre\ebooks\oeb\transforms\structure.p y", line 124, in detect_chapters
TypeError: 'bool' object is not iterable
This portable calibre, let's call it calibre1, has a few extra plugins installed, and a custom column (of type 'date').
I downloaded and expanded another portable calibre, let's call it calibre2, added the same pdf file to the database, and successfully converted that pdf file to mobi.
At this point I pointed calibre2 to use calibre1's database and attempted to convert another pdf file. This time also calibre2 failed converting the file and output exactly the same error log.
So I'm thinking that calibre1's database is somehow corrupted to the point that no file can be converted to another format.
Questions/Help Req:
1) How can I fix calibre1 so that I can successfully convert ebooks?
2) If fixing calibre1 entails rebuilding the whole ebook database, what's the best/quickest way to do it? Will I lose any metadata in doing so? Will the library folder structure change?
3) Where does calibre keep all those .py files that are referenced in the error log, like site.py, etc. I searched through calibre1's folder but couldn''t find any of them.
Select all your books, edit metadata in bulk, remove stored conversion settings. Then go to preferences->conversion Options->Common Options and click restore defaults and apply. Then your conversions will work.
Sweet, fix accomplished. Thank you very much! But your instruction didn't suffice to fix this issue, so let me complete them for anyone else who might need similar help in the future.
First of all, let me remark that in your instructions preferences->conversion Options->Common Options opens a dialog with five tabs, and that one needs applying Restore Defaults to each tab, as the tabs change independently of one another.
After applying your instructions exactly, and repeating them and restarting calibre several times, I was still getting the same error message. In particular, it still showed the non-default values of Structure Detection and Table Of Contents that I had changed. So those values must be stored somewhere else. Then I noticed that the right side of the Convert Books>Convert Individually dialog in the main window includes several tabs that are also found in the preferences->conversion Options->Common Options dialog. In particular, selecting input-format=PDF and the Structure Detection and Table of Contents tabs I found where the duplicated non-defaults values were hiding. There's a Restore Defaults button at the bottom of that dialog for some reason!
Thanks again for your help and especially for writing and maintaining Calibre, it's wonderful!