|  05-17-2020, 01:03 PM | #346 | 
| Member  Posts: 12 Karma: 10 Join Date: May 2020 Device: Kobo H2O | |
|   |   | 
|  05-17-2020, 03:00 PM | #347 | 
| Generally Awesome Person            Posts: 1,100 Karma: 2191133 Join Date: Jan 2013 Location: /dev/kmem Device: Kobo Clara HD, Kindle Oasis | 
			
			Check the very first post, there's a link to a thread that explains how to manually install plugins.
		 | 
|   |   | 
| Advert | |
|  | 
|  05-27-2020, 03:22 PM | #348 | 
| Member  Posts: 12 Karma: 10 Join Date: May 2020 Device: Kobo H2O | 
				
				Worries
			 
			
			I don´t know. I have some worries to do that.   I will wait till you offer the newest STABLE version for download in calibre. | 
|   |   | 
|  06-02-2020, 04:42 PM | #349 | 
| Member  Posts: 12 Karma: 10 Join Date: May 2020 Device: Kobo H2O | 
			
			Hi, any thoughts when the new stable version will be ready for download in calibre?
		 | 
|   |   | 
|  06-05-2020, 10:05 AM | #350 | 
| Enthusiast  Posts: 25 Karma: 10 Join Date: Mar 2017 Device: Kobo Aura H2O | 
				
				Bug with a certain file
			 
			
			Hi, I think this might be a bug that's already been reported, but in Linux (MATE, #44~18.04.2-Ubuntu SMP) I'm getting an error I can't seem to fix with just one particular file. Copying and pasting the contents to a new file reproduces the error, but I have no clue what it is about these particular contents that causes this to happen. Tried in Calibre 4.15 and 4.18. KepubOutput 3.2.7. Any leads? Code: Convert book 1 of 1 (Unknown Title)
Conversion options changed from defaults:
  output_profile: u'tablet'
  read_metadata_from_opf: u'/tmp/calibre_4.15.0_tmp_EQAjKy/aD0VZc.opf'
  verbose: 2
Resolved conversion options
calibre version: 4.15.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': None,
 '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_toc_at_end': False,
 'epub_version': u'2',
 'expand_css': False,
 'extra_css': None,
 'extract_to': None,
 'filter_css': u'',
 '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 0x7fb4e7763490>,
 'insert_blank_line': False,
 'insert_blank_line_size': 0.5,
 'insert_metadata': False,
 'isbn': None,
 'italicize_common_cases': True,
 'keep_ligatures': False,
 'kepub_clean_markup': True,
 'kepub_disable_hyphenation': False,
 'kepub_hyphenate': True,
 '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_default_epub_cover': False,
 'no_inline_navbars': False,
 'no_svg_cover': False,
 'output_profile': <calibre.customize.profiles.TabletOutput object at 0x7fb4e777e0d0>,
 'page_breaks_before': u'/',
 'prefer_metadata_cover': False,
 'preserve_cover_aspect_ratio': False,
 'pretty_print': True,
 'pubdate': None,
 'publisher': None,
 'rating': None,
 'read_metadata_from_opf': u'/tmp/calibre_4.15.0_tmp_EQAjKy/aD0VZc.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,
 'toc_title': None,
 'transform_css_rules': '[]',
 'unsmarten_punctuation': False,
 'unwrap_lines': True,
 'use_auto_toc': False,
 'verbose': 2}
InputFormatPlugin: EPUB Input running
on /tmp/calibre_4.15.0_tmp_EQAjKy/0MCWho.epub
Parsing all content...
Parsing OEBPS/sections/section0002.xhtml ...
Parsing OEBPS/sections/section0003.xhtml ...
Parsing OEBPS/sections/section0004.xhtml ...
Parsing OEBPS/sections/section0013.xhtml ...
Parsing OEBPS/sections/section0007.xhtml ...
Parsing OEBPS/sections/section0006.xhtml ...
Parsing OEBPS/sections/section0001.xhtml ...
Parsing OEBPS/styles/stylesheet.css ...
Parsing OEBPS/sections/section0014.xhtml ...
Parsing OEBPS/sections/section0009.xhtml ...
Parsing OEBPS/sections/section0010.xhtml ...
Parsing OEBPS/sections/section0008.xhtml ...
Parsing OEBPS/sections/section0012.xhtml ...
Parsing OEBPS/toc.xhtml ...
Parsing OEBPS/sections/section0011.xhtml ...
Parsing OEBPS/sections/section0005.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 140 items of level: p_1
p_1  left margin stats: Counter({u'0': 128, u'0.5in': 12})
p_1  right margin stats: Counter({u'0': 140})
Cleaning up manifest...
Trimming unused files from manifest...
Trimming u'OEBPS/toc.ncx' from manifest
Trimming u'OEBPS/toc.xhtml' from manifest
Creating KePub Output...
2020-06-05 15:00:05 [DEBUG] Running ePub conversion
Splitting markup on page breaks and flow limits, if any...
	Looking for large trees in OEBPS/sections/section0002.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0003.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0004.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0013.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0007.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0006.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0001.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0014.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0009.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0010.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0008.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0012.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0011.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0005.xhtml...
	No large trees found
Traceback (most recent call last):
  File "site.py", line 77, in main
  File "site-packages/calibre/utils/ipc/worker.py", line 209, in main
  File "site-packages/calibre/gui2/convert/gui_conversion.py", line 43, in gui_convert_override
  File "site-packages/calibre/gui2/convert/gui_conversion.py", line 28, in gui_convert
  File "site-packages/calibre/ebooks/conversion/plumber.py", line 1275, in run
  File "calibre_plugins.kepubout.conversion.kepub_output", line 107, in convert
  File "site-packages/calibre/ebooks/conversion/plugins/epub_output.py", line 214, in convert
  File "site-packages/calibre/ebooks/oeb/transforms/cover.py", line 85, in __call__
  File "site-packages/calibre/ebooks/oeb/transforms/cover.py", line 137, in insert_cover
  File "site-packages/calibre/ebooks/oeb/transforms/cover.py", line 93, in default_cover
AttributeError: Logger instance has no __call__ method | 
|   |   | 
| Advert | |
|  | 
|  06-06-2020, 01:38 AM | #351 | 
| Grand Sorcerer            Posts: 24,905 Karma: 47303824 Join Date: Jul 2011 Location: Sydney, Australia Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos | 
				
				Beta - Fix issues with br's being added
			 
			
			Attached is a beta of the plugin. The code matches that in my beta of the extended driver that I posted a week or so ago. It should fix the issue with br tags being handled incorrectly. I'm pretty sure this is the cause of the weird font changes people have reported seeing. It think that it will also fix the problem that @Oolong has reported. That one I'm not sure how to test, but, from memory, there was a change in the logging that should fix this. Last edited by theducks; 06-06-2020 at 10:18 AM. Reason: removed superceded beta | 
|   |   | 
|  06-06-2020, 05:46 AM | #352 | 
| Enthusiast  Posts: 25 Karma: 10 Join Date: Mar 2017 Device: Kobo Aura H2O | 
			
			Disappointingly, it doesn't seem to fix my problem. Still getting this: Code: calibre, version 4.18.0 (linux2, embedded-python: True)
Conversion error: Failed: Convert book 1 of 1 (‘Ecological sainthood’ or toxic disorder: challenging the pathologisation of embodied difference in autism)
Convert book 1 of 1 (‘Ecological sainthood’ or toxic disorder: challenging the pathologisation of embodied difference in autism)
Conversion options changed from defaults:
  read_metadata_from_opf: u'/tmp/calibre_4.18.0_tmp_Q4X3Of/utGJ5M.opf'
  output_profile: u'tablet'
  verbose: 2
Resolved conversion options
calibre version: 4.18.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': None,
 '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_toc_at_end': False,
 'epub_version': u'2',
 'expand_css': False,
 'extra_css': None,
 'extract_to': None,
 'filter_css': u'',
 '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 0x7f3b8c9b2890>,
 'insert_blank_line': False,
 'insert_blank_line_size': 0.5,
 'insert_metadata': False,
 'isbn': None,
 'italicize_common_cases': True,
 'keep_ligatures': False,
 'kepub_clean_markup': True,
 'kepub_disable_hyphenation': False,
 'kepub_hyphenate': True,
 '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_default_epub_cover': False,
 'no_inline_navbars': False,
 'no_svg_cover': False,
 'output_profile': <calibre.customize.profiles.TabletOutput object at 0x7f3b8c9c14d0>,
 'page_breaks_before': u'/',
 'prefer_metadata_cover': False,
 'preserve_cover_aspect_ratio': False,
 'pretty_print': True,
 'pubdate': None,
 'publisher': None,
 'rating': None,
 'read_metadata_from_opf': u'/tmp/calibre_4.18.0_tmp_Q4X3Of/utGJ5M.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,
 'toc_title': None,
 'transform_css_rules': '[]',
 'unsmarten_punctuation': False,
 'unwrap_lines': True,
 'use_auto_toc': False,
 'verbose': 2}
InputFormatPlugin: EPUB Input running
on /tmp/calibre_4.18.0_tmp_Q4X3Of/sxZQyL.epub
Parsing all content...
Parsing OEBPS/sections/section0011.xhtml ...
Parsing OEBPS/sections/section0003.xhtml ...
Parsing OEBPS/sections/section0009.xhtml ...
Parsing OEBPS/sections/section0008.xhtml ...
Parsing OEBPS/toc.xhtml ...
Parsing OEBPS/sections/section0010.xhtml ...
Parsing OEBPS/sections/section0013.xhtml ...
Parsing OEBPS/sections/section0002.xhtml ...
Parsing OEBPS/sections/section0012.xhtml ...
Parsing OEBPS/sections/section0004.xhtml ...
Parsing OEBPS/sections/section0006.xhtml ...
Parsing OEBPS/sections/section0014.xhtml ...
Parsing OEBPS/sections/section0005.xhtml ...
Parsing OEBPS/sections/section0007.xhtml ...
Parsing OEBPS/sections/section0001.xhtml ...
Parsing OEBPS/styles/stylesheet.css ...
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 140 items of level: p_1
p_1  left margin stats: Counter({u'0': 128, u'0.5in': 12})
p_1  right margin stats: Counter({u'0': 140})
Cleaning up manifest...
Trimming unused files from manifest...
Trimming u'OEBPS/toc.ncx' from manifest
Trimming u'OEBPS/toc.xhtml' from manifest
Creating KePub Output...
2020-06-06 10:43:14 [DEBUG] Running ePub conversion
Splitting markup on page breaks and flow limits, if any...
	Looking for large trees in OEBPS/sections/section0011.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0003.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0009.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0008.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0010.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0013.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0002.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0012.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0004.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0006.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0014.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0005.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0007.xhtml...
	No large trees found
	Looking for large trees in OEBPS/sections/section0001.xhtml...
	No large trees found
Traceback (most recent call last):
  File "site.py", line 77, in main
  File "site-packages/calibre/utils/ipc/worker.py", line 209, in main
  File "site-packages/calibre/gui2/convert/gui_conversion.py", line 43, in gui_convert_override
  File "site-packages/calibre/gui2/convert/gui_conversion.py", line 28, in gui_convert
  File "site-packages/calibre/ebooks/conversion/plumber.py", line 1275, in run
  File "calibre_plugins.kepubout.conversion.kepub_output", line 107, in convert
  File "site-packages/calibre/ebooks/conversion/plugins/epub_output.py", line 214, in convert
  File "site-packages/calibre/ebooks/oeb/transforms/cover.py", line 85, in __call__
  File "site-packages/calibre/ebooks/oeb/transforms/cover.py", line 137, in insert_cover
  File "site-packages/calibre/ebooks/oeb/transforms/cover.py", line 93, in default_cover
AttributeError: Logger instance has no __call__ method | 
|   |   | 
|  06-06-2020, 05:58 AM | #353 | 
| Enthusiast  Posts: 25 Karma: 10 Join Date: Mar 2017 Device: Kobo Aura H2O | 
			
			Just ran epubcheck on the file, which confusingly reports a bunch of warnings and then says 'no errors or warnings detected.' Code: Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 422 column 41 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 422 column 41 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 422 column 41 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Warning at char 3 in xsl:param/@select on line 459 column 43 SXWN9000: The parent axis starting at a document node will never select anything Validating using EPUB version 3.0.1 rules. No errors or warnings detected. epubcheck completed | 
|   |   | 
|  06-06-2020, 07:15 AM | #354 | 
| Grand Sorcerer            Posts: 24,905 Karma: 47303824 Join Date: Jul 2011 Location: Sydney, Australia Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos | 
			
			Looking at the code, no, it wasn't fixed. But, I remember looking at where it is failing some time recently and doing something that I thought did fix this. Or that one of the other logging changes would fix it. Obviously not. I did work out how to reproduce it. I needed to convert a book that calibre didn't have a cover for, and there wasn't one in the book. Converting a TXT file worked to do it. The attached beta fixes it here. I changed the logging a little bit. Hopefully I didn't break something elsewhere. | 
|   |   | 
|  06-06-2020, 09:10 AM | #355 | 
| Enthusiast  Posts: 25 Karma: 10 Join Date: Mar 2017 Device: Kobo Aura H2O | 
			
			That's done the trick! Thanks so much David.
		 | 
|   |   | 
|  06-15-2020, 11:04 PM | #356 | 
| Generally Awesome Person            Posts: 1,100 Karma: 2191133 Join Date: Jan 2013 Location: /dev/kmem Device: Kobo Clara HD, Kindle Oasis | 
			
			A new version has been published which fixes issues with the conversion putting text in the wrong place. Calibre should start offering the update in the next couple hours. Sorry about the delay, life has been interesting.
		 | 
|   |   | 
|  06-16-2020, 12:56 PM | #357 | 
| BLAM!            Posts: 13,506 Karma: 26047202 Join Date: Jun 2010 Location: Paris, France Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E | 
			
			@jgoguen: I'm hitting another porting-induced quirk that I don't think anyone reported (Linux, Calibre 4.18.0, Py 2.7): Code: Trimming unused files from manifest...
Trimming u'item/toc.xhtml' from manifest
Creating KePub Output...
Traceback (most recent call last):
  File "/usr/bin/calibre-parallel", line 23, in <module>
    sys.exit(main())
  File "/usr/lib64/calibre/calibre/utils/ipc/worker.py", line 209, in main
    result = func(*args, **kwargs)
  File "/usr/lib64/calibre/calibre/gui2/convert/gui_conversion.py", line 43, in gui_convert_override
    override_input_metadata=True)
  File "/usr/lib64/calibre/calibre/gui2/convert/gui_conversion.py", line 28, in gui_convert
    plumber.run()
  File "/usr/lib64/calibre/calibre/ebooks/conversion/plumber.py", line 1275, in run
    self.opts, self.log)
  File "calibre_plugins.kepubout.conversion.kepub_output", line 103, in convert
  File "calibre_plugins.kepubout.common", line 113, in print_formatted_log
  File "calibre_plugins.kepubout.common", line 94, in _tag_args
  File "/usr/lib64/calibre/calibre/__init__.py", line 206, in prints
    file.write(arg)
TypeError: unicode argument expected, got 'str'Last edited by NiLuJe; 06-16-2020 at 06:59 PM. | 
|   |   | 
|  06-16-2020, 07:30 PM | #358 | 
| BLAM!            Posts: 13,506 Karma: 26047202 Join Date: Jun 2010 Location: Paris, France Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E | 
			
			Re: previous message. This fixes it for me, as well as another snafu that broke it later on. Code: diff --git a/common.py b/common.py
index 36a989d..fe8a98c 100644
--- a/common.py
+++ b/common.py
@@ -31,32 +31,23 @@ from calibre.ebooks.oeb.polish.container import EpubContainer
 from calibre.ebooks.oeb.polish.container import OPF_NAMESPACES
 from calibre.ptempfile import PersistentTemporaryFile
 from calibre.utils.logging import ANSIStream
+from polyglot.builtins import is_py3, unicode_type
+from polyglot.io import PolyglotStringIO
 
 from lxml.etree import _Element
 
-try:
-    # Python 3
-    from io import StringIO
+if is_py3:
     from typing import Dict
     from typing import List
     from typing import Optional
     from typing import Union
 
-    unicode_type = str
-except ImportError:
-    # Python 2
-    from cStringIO import StringIO
-
-    # Ignore flake8 F821 (undefined name): type checking is done exclusvely in Python 3
-    # which does not define 'unicode'.
-    unicode_type = unicode  # noqa: F821
-
 KOBO_JS_RE = re.compile(r".*/?kobo.*?\.js$", re.IGNORECASE)
 XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"
 CONFIGDIR = os.path.join(config_dir, "plugins")  # type: str
 REFERENCE_KEPUB = os.path.join(CONFIGDIR, "reference.kepub.epub")  # type: str
 PLUGIN_VERSION = (3, 2, 9)
-PLUGIN_MINIMUM_CALIBRE_VERSION = (2, 60, 0)
+PLUGIN_MINIMUM_CALIBRE_VERSION = (3, 42, 0)
 
 
 class Logger:
@@ -74,7 +65,7 @@ class Logger:
         self._lock = Lock()
         # According to Kovid, calibre always uses UTF-8 for the Python 3 version
         self.preferred_encoding = (
-            "UTF-8" if sys.version_info.major > 2 else preferred_encoding
+            "UTF-8" if is_py3 else preferred_encoding
         )
         self.outputs = [ANSIStream()]
 
@@ -88,7 +79,7 @@ class Logger:
 
     def _tag_args(self, level, *args):
         now = time.localtime()
-        buf = StringIO()
+        buf = PolyglotStringIO()
         tagged_args = []
         for arg in args:
             prints(time.strftime("%Y-%m-%d %H:%M:%S", now), file=buf, end=" ")
diff --git a/container.py b/container.py
index 0c74a3d..7bddbfe 100644
--- a/container.py
+++ b/container.py
@@ -29,16 +29,13 @@ from calibre.ebooks.conversion.plugins.epub_input import IDPF_OBFUSCATION
 from calibre.ebooks.conversion.utils import HeuristicProcessor
 from calibre.ebooks.oeb.polish.container import EpubContainer
 from calibre.utils.smartypants import smartyPants
+from polyglot.builtins import is_py3
 
 from lxml import etree
 
-try:
-    # Python 3
+if is_py3:
     from typing import Dict
     from typing import Set
-except ImportError:
-    # Python 2
-    pass
 
 # Support load_translations() without forcing calibre 1.9+
 try:
diff --git a/conversion/kepub_input.py b/conversion/kepub_input.py
index 93dd1ec..25342d9 100644
--- a/conversion/kepub_input.py
+++ b/conversion/kepub_input.py
@@ -12,6 +12,7 @@ import sys
 
 from calibre.customize.conversion import OptionRecommendation
 from calibre.ebooks.conversion.plugins.epub_input import EPUBInput
+from polyglot.builtins import is_py3
 
 from calibre_plugins.kepubin import common
 
@@ -66,7 +67,7 @@ class KEPUBInput(EPUBInput):
 
         try:
             zf = ZipFile(stream)
-            cwd = os.getcwdu() if sys.version_info.major == 2 else os.getcwd()
+            cwd = os.getcwdu() if not is_py3 else os.getcwd()
             zf.extractall(cwd)
         except Exception:
             log.exception(
@@ -100,7 +101,7 @@ class KEPUBInput(EPUBInput):
         if os.path.exists(encfile):
             raise DRMError(os.path.basename(path))
 
-        cwd = os.getcwdu() if sys.version_info.major == 2 else os.getcwd()
+        cwd = os.getcwdu() if not is_py3 else os.getcwd()
         opf = os.path.relpath(opf, cwd)
         parts = os.path.split(opf)
         opf = OPF(opf, os.path.dirname(os.path.abspath(opf)))
diff --git a/conversion/kepub_output.py b/conversion/kepub_output.py
index c9a185e..c33e704 100644
--- a/conversion/kepub_output.py
+++ b/conversion/kepub_output.py
@@ -18,6 +18,7 @@ from calibre.ebooks.metadata.book.base import Metadata
 from calibre.ebooks.metadata.book.base import NULL_VALUES
 
 from calibre_plugins.kepubout import common
+from calibre_plugins.kepubout.container import KEPubContainer
 
 
 # Support load_translations() without forcing calibre 1.9+
@@ -105,7 +106,7 @@ class KEPubOutput(OutputFormatPlugin):
             oeb_book, output, input_plugin, opts, common.log
         )
         common.log.debug("Done ePub conversion")
-        container = common.KEPubContainer(output, common.log)
+        container = KEPubContainer(output, common.log)
 
         if container.is_drm_encumbered:
             common.log.error("DRM-encumbered container, skipping conversion")
diff --git a/device/driver.py b/device/driver.py
index 203de39..8c69901 100644
--- a/device/driver.py
+++ b/device/driver.py
@@ -17,10 +17,11 @@ import re
 import shutil
 from datetime import datetime
 
-try:
-    # Python 3
+from polyglot.builtins import is_py3
+
+if is_py3:
     from configparser import SafeConfigParser
-except ImportError:
+else:
     from ConfigParser import SafeConfigParser
 
 from calibre.constants import config_dir
@@ -28,6 +29,7 @@ from calibre.devices.kobo.driver import KOBOTOUCH
 from calibre.ebooks.oeb.polish.errors import DRMError
 
 from calibre_plugins.kobotouch_extended import common
+from calibre_plugins.kobotouch_extended.container import KEPubContainer
 
 # Support load_translations() without forcing calibre 1.9+
 try:
@@ -212,7 +214,7 @@ class KOBOTOUCHEXTENDED(KOBOTOUCH):
         is_encumbered_book = False
         try:
             if container is None:
-                container = common.KEPubContainer(infile, common.log)
+                container = KEPubContainer(infile, common.log)
             else:
                 is_encumbered_book = container.is_drm_encumbered
         except DRMError:
diff --git a/metadata/writer.py b/metadata/writer.py
index a1903d6..9f59f9f 100644
--- a/metadata/writer.py
+++ b/metadata/writer.py
@@ -8,13 +8,7 @@ __docformat__ = "markdown en"
 
 import os
 
-try:
-    # Python 3
-    from io import StringIO
-except ImportError:
-    # Python 2
-    from cStringIO import StringIO
-
+from polyglot.io import PolyglotStringIO
 
 from calibre.customize.builtins import EPUBMetadataWriter
 from calibre.ebooks.metadata.epub import get_zip_reader
@@ -97,7 +91,7 @@ class KEPUBMetadataWriter(EPUBMetadataWriter):
                             found_cover = True
 
             if found_cover:
-                newopf = StringIO(reader.opf.render().decode("UTF-8"))
+                newopf = PolyglotStringIO(reader.opf.render().decode("UTF-8"))
                 if isinstance(reader.archive, LocalZipFile):
                     reader.archive.safe_replace(reader.container[OPF.MIMETYPE], newopf)
                 else:Last edited by NiLuJe; 06-16-2020 at 07:52 PM. Reason: And with even more Polyglot usage | 
|   |   | 
|  06-17-2020, 12:03 AM | #359 | 
| Generally Awesome Person            Posts: 1,100 Karma: 2191133 Join Date: Jan 2013 Location: /dev/kmem Device: Kobo Clara HD, Kindle Oasis | 
			
			Thank you! Want to make a PR on Github?    | 
|   |   | 
|  06-17-2020, 12:08 AM | #360 | 
| BLAM!            Posts: 13,506 Karma: 26047202 Join Date: Jun 2010 Location: Paris, France Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E | 
			
			@jgoguen: Untested on anything else than Linux/Py2, but, sure   . | 
|   |   | 
|  | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| catalogue builder output columns are not in the same order in the output | KWhytte | Library Management | 5 | 12-04-2012 02:03 AM | 
| Plugin not customizable: Plugin: HTML Output does not need customization | flyingfoxlee | Conversion | 2 | 02-24-2012 02:24 AM | 
| Plugin which uses net as input and output | medve | Development | 0 | 12-04-2011 03:20 PM | 
| Creat new Output plugin (LaTeX and/or txt2tags) | Lebewesen | Development | 3 | 11-22-2011 11:10 AM | 
| AZW Conversion Output Plugin | tylau0 | Plugins | 59 | 08-14-2011 10:36 PM |