Conversion Error - TypeError: select_nth_last_child() takes exactly 3 arguments (2 given)

Bug #1440278 reported by Victor Hooi on 2015-04-04
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

I am using Calibre 2.23.0 on OSX.

I am trying to convert an AZW3 to MOBI format (filetype "both").

When I try to convert it, I get the following error (Gistfile at https://gist.github.com/victorhooi/bde910678b83e63ef870):

Convert book 1 of 1 (Beginning Python Programming: Learn Python Programming in 7 Days (Treading on Python Book 1))
Resolved conversion options
calibre version: 2.23.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'/var/folders/60/978ptjj52xd_zz4dm8j35ckc0000gn/T/calibre_2.23.0_tmp_2kS6vx/9pWjWH.jpeg',
 'debug_pipeline': None,
 'dehyphenate': True,
 'delete_blank_paragraphs': True,
 'disable_font_rescaling': False,
 'dont_compress': False,
 '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 0x1143eb050>,
 '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,
 'mobi_file_type': u'both',
 'mobi_ignore_margins': False,
 'mobi_keep_original_images': False,
 'mobi_toc_at_start': False,
 'no_chapters_in_toc': False,
 'no_inline_navbars': False,
 'no_inline_toc': False,
 'output_profile': <calibre.customize.profiles.OutputProfile object at 0x1143eb410>,
 'page_breaks_before': u"//*[name()='h1' or name()='h2']",
 'personal_doc': u'[EBOK]',
 'prefer_author_sort': False,
 'prefer_metadata_cover': False,
 'pretty_print': False,
 'pubdate': None,
 'publisher': None,
 'rating': None,
 'read_metadata_from_opf': u'/var/folders/60/978ptjj52xd_zz4dm8j35ckc0000gn/T/calibre_2.23.0_tmp_2kS6vx/Bp5KTy.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_lines': True,
 'use_auto_toc': False,
 'verbose': 2}
InputFormatPlugin: MOBI Input running
on /var/folders/60/978ptjj52xd_zz4dm8j35ckc0000gn/T/calibre_2.23.0_tmp_2kS6vx/9KI7g1.azw3
Found KF8 MOBI of type 'standalone'
Extracting text...
Parsing all content...
Parsing text/part0033.html ...
Parsing text/part0018.html ...
Parsing text/part0026.html ...
Parsing text/part0013.html ...
Parsing text/part0006.html ...
Parsing text/part0000.html ...
Parsing text/part0032.html ...
Parsing text/part0007.html ...
Parsing text/part0017.html ...
Parsing styles/0001.css ...
Parsing text/part0016.html ...
Parsing text/part0024.html ...
Parsing text/part0012.html ...
Parsing text/part0008.html ...
Parsing text/part0023.html ...
Parsing text/part0009.html ...
Parsing text/part0031.html ...
Parsing text/part0025.html ...
Parsing text/part0003.html ...
Parsing text/part0014.html ...
Parsing text/part0022.html ...
Parsing text/part0030.html ...
Parsing text/part0010.html ...
Parsing text/part0002.html ...
Parsing text/part0027.html ...
Parsing text/part0011.html ...
Parsing text/part0021.html ...
Parsing text/part0029.html ...
Parsing text/part0020.html ...
Parsing text/part0028.html ...
Parsing text/part0004.html ...
Parsing text/part0001.html ...
Parsing text/part0034.html ...
Parsing text/part0015.html ...
Parsing text/part0005.html ...
Parsing text/part0019.html ...
Referenced file u'styles/XXXXXXXXXXXXXXXX' not found
Reading TOC from NCX...
Merging user specified metadata...
Detecting structure...
 Detected chapter: Ebook Formatting: KF8, Mobi & EPUB
Python function terminated unexpectedly: select_nth_last_child() takes exactly 3 arguments (2 given)
Flattening CSS and remapping font sizes...
Traceback (most recent call last):
  File "/Applications/calibre.app/Contents/Resources/Python/lib/python2.7/site.py", line 209, in main
    return run_entry_point()
  File "/Applications/calibre.app/Contents/Resources/Python/lib/python2.7/site.py", line 114, in run_entry_point
    return getattr(pmod, func)()
  File "site-packages/calibre/utils/ipc/worker.py", line 193, 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 1155, in run
  File "site-packages/calibre/ebooks/oeb/transforms/flatcss.py", line 185, in __call__
  File "site-packages/calibre/ebooks/oeb/transforms/flatcss.py", line 264, in stylize_spine
  File "site-packages/calibre/ebooks/oeb/stylizer.py", line 183, in __init__
  File "site-packages/css_selectors/select.py", line 177, in __call__
  File "site-packages/css_selectors/select.py", line 195, in iterparsedselector
  File "site-packages/css_selectors/select.py", line 556, in select_pseudo
TypeError: select_nth_last_child() takes exactly 3 arguments (2 given)

Attach the AZW3 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

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

 status fixreleased

Changed in calibre:
status: Incomplete → Fix Released
Victor Hooi (victorhooi) wrote :

Aha, cool, that was fast =).

So I'm guessing you don't need me to upload the AZW3 file anymore (I'm happy to, however, my understanding is that you've magically managed to fix it with out...lol).

I'm still trying to understand how the whole Calibre -> Send-to-Kindle thing works with cover images and Docs versus Books, but that's probably better covered in a separate ticket, or on the MobileRead forums.

Thanks for all your work on Calibre!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers