Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 09-26-2020, 09:42 AM   #1411
susanpr
Member
susanpr began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Nov 2011
Device: generic android 4.0
Here is the error message I get when trying to replace the cover on my epub. Thank you for all your work on these issues.

calibre, version 5.0.1
ERROR: Modify ePub failed: No ePub files were updated

Modify ePubs
Logfile for book ID 12789 (Batnesia / Qui)
12789

Modifying: C:\Users\Susan\AppData\Local\Temp\calibre_wxix24e5 \7gmx70w7_modify_epub\12789.epub

Batnesia - ERROR: Traceback (most recent call last):

File "calibre_plugins.modify_epub.modify", line 78, in process_book

File "calibre_plugins.modify_epub.container", line 86, in __init__

File "src/lxml/etree.pyx", line 3237, in lxml.etree.fromstring

File "src/lxml/parser.pxi", line 1891, in lxml.etree._parseMemoryDocument

ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.



ePub not changed after 0.15 seconds
susanpr is offline   Reply With Quote
Old 09-26-2020, 10:40 AM   #1412
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,756
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by susanpr View Post
Here is the error message I get when trying to replace the cover on my epub. Thank you for all your work on these issues.

calibre, version 5.0.1
ERROR: Modify ePub failed: No ePub files were updated

Modify ePubs
Logfile for book ID 12789 (Batnesia / Qui)
12789

Modifying: C:\Users\Susan\AppData\Local\Temp\calibre_wxix24e5 \7gmx70w7_modify_epub\12789.epub

Batnesia - ERROR: Traceback (most recent call last):

File "calibre_plugins.modify_epub.modify", line 78, in process_book

File "calibre_plugins.modify_epub.container", line 86, in __init__

File "src/lxml/etree.pyx", line 3237, in lxml.etree.fromstring

File "src/lxml/parser.pxi", line 1891, in lxml.etree._parseMemoryDocument

ValueError: Unicode strings with encoding declaration are not supported. Please use bytes input or XML fragments without declaration.



ePub not changed after 0.15 seconds
Which version Modify ePub did you install?

Last edited by JSWolf; 09-26-2020 at 10:48 AM.
JSWolf is offline   Reply With Quote
Advert
Old 09-26-2020, 11:14 AM   #1413
susanpr
Member
susanpr began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Nov 2011
Device: generic android 4.0
Quote:
Originally Posted by JSWolf View Post
Which version Modify ePub did you install?
The most recent one Modify ePub_1_5_2.zip
susanpr is offline   Reply With Quote
Old 09-26-2020, 11:41 AM   #1414
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Yet another test version. V1.5.2 could bork the ebook's OPF. It isn't clear exactly when it happened but I was able to reliably reproduce it with "delete cover". That operation didn't fail but it left the ebook unusable. Modify epub would blow up if executed again. I suspect that all ebook readers/editors would as well.

If you have damaged an ebook then you should be able to fix it using the base calibre polish tool, re-embedding metadata.

My apologies for all the waffing around. I have never encountered code that messes so extensively with encodings like this plugin.

Last edited by chaley; 09-28-2020 at 11:03 AM. Reason: Remove broken beta release
chaley is offline   Reply With Quote
Old 09-26-2020, 11:55 AM   #1415
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I ran Modify ePub on my test book with everything enabled. I ended up getting this log, although I'm not sure which option caused the error.

Code:
  Modifying:  C:\Users\[user]\AppData\Local\Temp\calibre_dpjv3o3j\bm1nikge_modify_epub\5036.epub

	Updating metadata and cover

Parsing xml file: content.opf

Parsing xml file: toc.ncx

	Looking for redundant entries in manifest

	Looking for unmanifested files

	Looking for NCX to flatten

	  No nested navPoints

	Looking for broken links in the NCX

	Looking for Adobe xpgt files and links to remove

	Looking for pagemaps

	Looking for Google Play pagemaps

	Looking for Google Play pagemaps

	Looking for Adobe DRM meta tags to remove

	Looking for all jackets

	 Jacket removed:  jacket.xhtml

	  Manifest item removed: jacket.xhtml (calibre_jacket)

	  Spine itemref removed: calibre_jacket

	Adding or updating jacket

	  Manifest item added: jacket.xhtml (calibre_jacket)

	  Spine item inserted: calibre_jacket at pos: -1

	Looking for html pages containing only broken image links

	Looking for non dc: elements in manifest

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc6c0>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc8c0>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc9c0>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc940>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc840>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc600>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc780>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc680>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc740>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdce00>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcc80>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdca00>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc440>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcdc0>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcd80>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcc00>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcb80>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcb00>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcec0>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcf00>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcbc0>

	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcc40>

	Looking for html files to remove charset meta tags/encode to utf-8

	  Switched to UTF-8 encoding for: text/part0000.html

	  Switched to UTF-8 encoding for: text/part0001.html

	  Switched to UTF-8 encoding for: text/part0002.html

	  Switched to UTF-8 encoding for: text/part0003.html

	  Switched to UTF-8 encoding for: text/part0004.html

	  Switched to UTF-8 encoding for: text/part0005.html

	  Switched to UTF-8 encoding for: text/part0006.html

	  Switched to UTF-8 encoding for: text/part0007.html

	  Switched to UTF-8 encoding for: text/part0008.html

	  Switched to UTF-8 encoding for: text/part0009.html

	  Switched to UTF-8 encoding for: text/part0010.html

	  Switched to UTF-8 encoding for: text/part0011.html

	  Switched to UTF-8 encoding for: text/part0012.html

	  Switched to UTF-8 encoding for: text/part0013.html

	  Switched to UTF-8 encoding for: text/part0014.html

	  Switched to UTF-8 encoding for: text/part0015.html

	  Switched to UTF-8 encoding for: text/part0016.html

	  Switched to UTF-8 encoding for: text/part0017.html

	  Switched to UTF-8 encoding for: text/part0018.html

	  Switched to UTF-8 encoding for: text/part0019.html

	  Switched to UTF-8 encoding for: text/part0020.html

	  Switched to UTF-8 encoding for: text/part0021.html

	  Switched to UTF-8 encoding for: text/part0022.html

	  Switched to UTF-8 encoding for: text/part0023.html

	  Switched to UTF-8 encoding for: text/part0024.html

	  Switched to UTF-8 encoding for: text/part0025.html

	  Switched to UTF-8 encoding for: text/part0026.html

	  Switched to UTF-8 encoding for: text/part0027.html

	  Switched to UTF-8 encoding for: text/part0028.html

	  Switched to UTF-8 encoding for: text/part0029.html

	  Switched to UTF-8 encoding for: text/part0030.html

	  Switched to UTF-8 encoding for: text/part0031.html

	  Switched to UTF-8 encoding for: text/part0032.html

	  Switched to UTF-8 encoding for: text/part0033.html

	  Switched to UTF-8 encoding for: text/part0034.html

	  Switched to UTF-8 encoding for: text/part0035.html

	  Switched to UTF-8 encoding for: text/part0036.html

	  Switched to UTF-8 encoding for: text/part0037.html

	  Switched to UTF-8 encoding for: text/part0038.html

	  Switched to UTF-8 encoding for: text/part0039.html

	  Switched to UTF-8 encoding for: text/part0040.html

	  Switched to UTF-8 encoding for: text/part0041.html

	  Switched to UTF-8 encoding for: text/titlepage.xhtml

	Looking for embedded fonts

	Looking for css @font-face style declarations

	Looking for inline @font-face style declarations

	Looking for CSS margins

	  Modified CSS margins in: page_styles.css

	  Modified CSS margins in: stylesheet.css

No Cats Allowed - ERROR: Traceback (most recent call last):

  File "calibre_plugins.modify_epub.modify", line 79, in process_book

  File "calibre_plugins.modify_epub.modify", line 175, in _process_book

  File "calibre_plugins.modify_epub.modify", line 423, in _rewrite_css_margins

  File "calibre_plugins.modify_epub.margins", line 170, in rewrite_css_margins

  File "calibre_plugins.modify_epub.container", line 217, in get_raw

  File "codecs.py", line 322, in decode

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte



ePub not changed after 0.70 seconds
ownedbycats is offline   Reply With Quote
Advert
Old 09-26-2020, 12:17 PM   #1416
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,756
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by chaley View Post
Thank you.

Attached is a version that eliminates one possibility of incompatibility
Version 5.1.2 with just the options in HTML & Styles selected
Code:
calibre, version 4.23.0
ERROR: Modify ePub failed: No ePub files were updated

Modify ePubs
Logfile for book ID 2243 (The Eye of the World / Robert Jordan)
2243
  Modifying:  C:\Users\help\AppData\Local\Temp\calibre_paxpnh\yncehy_modify_epub\2243.epub
Parsing xml file: OPS/package.opf
Parsing xml file: OPS/toc.ncx
	Looking for html files to remove charset meta tags/encode to utf-8
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter42.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter37.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter10.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter12.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter18.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter30.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter16.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter03.html
	  Switched to UTF-8 encoding for: OPS/xhtml/copyright.html
	  Switched to UTF-8 encoding for: OPS/xhtml/backmatter02-ch.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter24.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter05.html
	  Switched to UTF-8 encoding for: OPS/xhtml/frontmatter02.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter28.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter17.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter26.html
	  Switched to UTF-8 encoding for: OPS/xhtml/frontmatter03.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter46.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter25.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter43.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter06.html
	  Switched to UTF-8 encoding for: OPS/xhtml/package_notice.html
	  Switched to UTF-8 encoding for: OPS/xhtml/frontmatter01.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter04.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter53.html
	  Switched to UTF-8 encoding for: OPS/xhtml/adcard.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter50.html
	  Switched to UTF-8 encoding for: OPS/xhtml/contents.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter41.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter29.html
	  Switched to UTF-8 encoding for: OPS/xhtml/backmatter02.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter27.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter22.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter08.html
	  Switched to UTF-8 encoding for: OPS/xhtml/cover.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter14.html
	  Switched to UTF-8 encoding for: OPS/xhtml/backmatter01.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter52.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter02.html
	  Switched to UTF-8 encoding for: OPS/xhtml/backmatter03.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter33.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter09.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter11.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter07.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter40.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter23.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter35.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter13.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter47.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter20.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter51.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter34.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter49.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter44.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter38.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter39.html
	  Switched to UTF-8 encoding for: OPS/xhtml/title.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter31.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter19.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter01.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter36.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter45.html
	  Switched to UTF-8 encoding for: OPS/xhtml/dedication.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter15.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter21.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter32.html
	  Switched to UTF-8 encoding for: OPS/xhtml/chapter48.html
	Looking for embedded fonts
	Looking for css @font-face style declarations
	Looking for inline @font-face style declarations
	Looking for CSS margins
The Eye of the World - ERROR: Traceback (most recent call last):
  File "calibre_plugins.modify_epub.modify", line 79, in process_book
  File "calibre_plugins.modify_epub.modify", line 175, in _process_book
  File "calibre_plugins.modify_epub.modify", line 423, in _rewrite_css_margins
  File "calibre_plugins.modify_epub.margins", line 170, in rewrite_css_margins
  File "calibre_plugins.modify_epub.container", line 217, in get_raw
  File "codecs.py", line 314, in decode
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: invalid start byte

ePub not changed after 1.23 seconds
From within HTML & Styles, I found what caused the previous error. I selected just Modify @page and body margin styles.
Code:
calibre, version 4.23.0
ERROR: Modify ePub failed: No ePub files were updated

Modify ePubs
Logfile for book ID 2243 (The Eye of the World / Robert Jordan)
2243
  Modifying:  C:\Users\help\AppData\Local\Temp\calibre_paxpnh\k2v2mo_modify_epub\2243.epub
Parsing xml file: OPS/package.opf
Parsing xml file: OPS/toc.ncx
	Looking for CSS margins
The Eye of the World - ERROR: Traceback (most recent call last):
  File "calibre_plugins.modify_epub.modify", line 79, in process_book
  File "calibre_plugins.modify_epub.modify", line 175, in _process_book
  File "calibre_plugins.modify_epub.modify", line 423, in _rewrite_css_margins
  File "calibre_plugins.modify_epub.margins", line 170, in rewrite_css_margins
  File "calibre_plugins.modify_epub.container", line 217, in get_raw
  File "codecs.py", line 314, in decode
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: invalid start byte

ePub not changed after 1.11 seconds

I've attached a scrambled ePub that shows the error.
Attached Files
File Type: epub The Eye of the World - Jordan, Robert.epub (1.52 MB, 263 views)

Last edited by JSWolf; 09-26-2020 at 12:20 PM.
JSWolf is offline   Reply With Quote
Old 09-26-2020, 12:22 PM   #1417
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,756
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by ownedbycats View Post
I ran Modify ePub on my test book with everything enabled. I ended up getting this log, although I'm not sure which option caused the error.

Code:
  Modifying:  C:\Users\[user]\AppData\Local\Temp\calibre_dpjv3o3j\bm1nikge_modify_epub\5036.epub
	Updating metadata and cover
Parsing xml file: content.opf
Parsing xml file: toc.ncx
	Looking for redundant entries in manifest
	Looking for unmanifested files
	Looking for NCX to flatten
	  No nested navPoints
	Looking for broken links in the NCX
	Looking for Adobe xpgt files and links to remove
	Looking for pagemaps
	Looking for Google Play pagemaps
	Looking for Google Play pagemaps
	Looking for Adobe DRM meta tags to remove
	Looking for all jackets
	 Jacket removed:  jacket.xhtml
	  Manifest item removed: jacket.xhtml (calibre_jacket)
	  Spine itemref removed: calibre_jacket
	Adding or updating jacket
	  Manifest item added: jacket.xhtml (calibre_jacket)
	  Spine item inserted: calibre_jacket at pos: -1
	Looking for html pages containing only broken image links
	Looking for non dc: elements in manifest
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc6c0>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc8c0>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc9c0>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc940>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc840>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc600>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc780>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc680>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc740>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdce00>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcc80>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdca00>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdc440>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcdc0>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcd80>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcc00>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcb80>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcb00>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcec0>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcf00>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcbc0>
	  Removing child: <Element {http://www.idpf.org/2007/opf}meta at 0x16ff4cdcc40>
	Looking for html files to remove charset meta tags/encode to utf-8
	  Switched to UTF-8 encoding for: text/part0000.html
	  Switched to UTF-8 encoding for: text/part0001.html
	  Switched to UTF-8 encoding for: text/part0002.html
	  Switched to UTF-8 encoding for: text/part0003.html
	  Switched to UTF-8 encoding for: text/part0004.html
	  Switched to UTF-8 encoding for: text/part0005.html
	  Switched to UTF-8 encoding for: text/part0006.html
	  Switched to UTF-8 encoding for: text/part0007.html
	  Switched to UTF-8 encoding for: text/part0008.html
	  Switched to UTF-8 encoding for: text/part0009.html
	  Switched to UTF-8 encoding for: text/part0010.html
	  Switched to UTF-8 encoding for: text/part0011.html
	  Switched to UTF-8 encoding for: text/part0012.html
	  Switched to UTF-8 encoding for: text/part0013.html
	  Switched to UTF-8 encoding for: text/part0014.html
	  Switched to UTF-8 encoding for: text/part0015.html
	  Switched to UTF-8 encoding for: text/part0016.html
	  Switched to UTF-8 encoding for: text/part0017.html
	  Switched to UTF-8 encoding for: text/part0018.html
	  Switched to UTF-8 encoding for: text/part0019.html
	  Switched to UTF-8 encoding for: text/part0020.html
	  Switched to UTF-8 encoding for: text/part0021.html
	  Switched to UTF-8 encoding for: text/part0022.html
	  Switched to UTF-8 encoding for: text/part0023.html
	  Switched to UTF-8 encoding for: text/part0024.html
	  Switched to UTF-8 encoding for: text/part0025.html
	  Switched to UTF-8 encoding for: text/part0026.html
	  Switched to UTF-8 encoding for: text/part0027.html
	  Switched to UTF-8 encoding for: text/part0028.html
	  Switched to UTF-8 encoding for: text/part0029.html
	  Switched to UTF-8 encoding for: text/part0030.html
	  Switched to UTF-8 encoding for: text/part0031.html
	  Switched to UTF-8 encoding for: text/part0032.html
	  Switched to UTF-8 encoding for: text/part0033.html
	  Switched to UTF-8 encoding for: text/part0034.html
	  Switched to UTF-8 encoding for: text/part0035.html
	  Switched to UTF-8 encoding for: text/part0036.html
	  Switched to UTF-8 encoding for: text/part0037.html
	  Switched to UTF-8 encoding for: text/part0038.html
	  Switched to UTF-8 encoding for: text/part0039.html
	  Switched to UTF-8 encoding for: text/part0040.html
	  Switched to UTF-8 encoding for: text/part0041.html
	  Switched to UTF-8 encoding for: text/titlepage.xhtml
	Looking for embedded fonts
	Looking for css @font-face style declarations
	Looking for inline @font-face style declarations
	Looking for CSS margins
	  Modified CSS margins in: page_styles.css
	  Modified CSS margins in: stylesheet.css
No Cats Allowed - ERROR: Traceback (most recent call last):
  File "calibre_plugins.modify_epub.modify", line 79, in process_book
  File "calibre_plugins.modify_epub.modify", line 175, in _process_book
  File "calibre_plugins.modify_epub.modify", line 423, in _rewrite_css_margins
  File "calibre_plugins.modify_epub.margins", line 170, in rewrite_css_margins
  File "calibre_plugins.modify_epub.container", line 217, in get_raw
  File "codecs.py", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

ePub not changed after 0.70 seconds
Just don't select Modify @page and body margin styles.
JSWolf is offline   Reply With Quote
Old 09-26-2020, 12:55 PM   #1418
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,251
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Quote:
Originally Posted by chaley View Post
I have never encountered code that messes so extensively with encodings like this plugin.
At the risk of me trying to "teach Granny how to suck eggs" ...

When I was migrating my own plugins to python3 I found these 2 items from polyglot.builtins very useful: as_unicode, as_bytes

After I'd finished I don't think I had any .encode(...) or .decode(...) code left to go wrong. However, (full disclosure) I only ever use calibre's current container class to do everything related to epub-wrangling, so it's quite likely Kovid has already catered for everything that's likely to go wrong encoding-wise.
jackie_w is offline   Reply With Quote
Old 09-26-2020, 01:38 PM   #1419
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,587
Karma: 14328510
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by ownedbycats View Post
I ran Modify ePub on my test book with everything enabled. I ended up getting this log, although I'm not sure which option caused the error.

Code:
 ...
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
There are pages on the python site about how to convert python 2 to python 3 and things that will need to be fixed. One of the items was about how with python 2 the code could treat characters as binary data, but you can no longer do that with python 3. I suspect that this error is due to that.
hobnail is offline   Reply With Quote
Old 09-26-2020, 01:39 PM   #1420
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,587
Karma: 14328510
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by JSWolf View Post
Just don't select Modify @page and body margin styles.
That would merely obscure/hide the underlying bug in the plugin's code, not fix it.
hobnail is offline   Reply With Quote
Old 09-26-2020, 01:42 PM   #1421
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by jackie_w View Post
At the risk of me trying to "teach Granny how to suck eggs" ...

When I was migrating my own plugins to python3 I found these 2 items from polyglot.builtins very useful: as_unicode, as_bytes

After I'd finished I don't think I had any .encode(...) or .decode(...) code left to go wrong. However, (full disclosure) I only ever use calibre's current container class to do everything related to epub-wrangling, so it's quite likely Kovid has already catered for everything that's likely to go wrong encoding-wise.
Thanks, but the problem arises elsewhere. The 'etree' package does strange things with encoding, returning byte strings sometimes and unicode other times. Same thing is true when opening files: now sometimes you need 'rb' and sometimes 'r', and sometimes the "newline=" argument. The code made no provision for getting images vs text. And so on.

Also, the plugin has a reimplemented container. I tried to go back to calibre's but that opened more cans than I could handle.
chaley is offline   Reply With Quote
Old 09-26-2020, 01:44 PM   #1422
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Yet another test version. This one corrects problems caused image files.

Last edited by chaley; 09-26-2020 at 03:02 PM. Reason: Removed wrong zipfile
chaley is offline   Reply With Quote
Old 09-26-2020, 01:47 PM   #1423
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by hobnail View Post
There are pages on the python site about how to convert python 2 to python 3 and things that will need to be fixed. One of the items was about how with python 2 the code could treat characters as binary data, but you can no longer do that with python 3. I suspect that this error is due to that.
Yes, indirectly. The existing code used a common function to read and cache items with no provision for the difference between reading images and text.

I already fixed a similar problem when writing.
chaley is offline   Reply With Quote
Old 09-26-2020, 01:47 PM   #1424
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,587
Karma: 14328510
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by chaley View Post
Thanks, but the problem arises elsewhere. The 'etree' package does strange things with encoding, returning byte strings sometimes and unicode other times. Same thing is true when opening files: now sometimes you need 'rb' and sometimes 'r', and sometimes the "newline=" argument. The code made no provision for getting images vs text. And so on.

See if this helps: https://docs.python.org/3/howto/pypo...us-binary-data
hobnail is offline   Reply With Quote
Old 09-26-2020, 01:49 PM   #1425
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by JSWolf View Post
Version 5.1.2 with just the options in HTML & Styles selected
I am 95% sure that this is what I just fixed in V1.5.4.
chaley is offline   Reply With Quote
Reply

Tags
modify epub


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Quality Check kiwidude Plugins 1251 07-07-2025 09:13 PM
[GUI Plugin] Open With kiwidude Plugins 404 02-21-2025 05:42 AM
[GUI Plugin] Manage Series kiwidude Plugins 167 07-28-2024 03:07 PM
Modify ePub plugin dev thread kiwidude Development 346 09-02-2013 05:14 PM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 07:07 PM.


MobileRead.com is a privately owned, operated and funded community.