Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-20-2020, 04:49 AM   #1
Sheeba
Junior Member
Sheeba began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2020
Device: none
Converting to EPUB results in files that Calibre can't read

When I convert AZW files to EPUB, Calibre throws an error when I try to open them:

-------------------------------------------------------------------
Spoiler:

calibre, version 4.8.0
ERROR: Loading book failed: Failed to open the book at C:\eBdata\Test.epub. Click "Show details" for more info.

Traceback (most recent call last):
File "site-packages\calibre\gui2\viewer\ui.py", line 371, in _load_ebook_worker
File "site-packages\calibre\gui2\viewer\convert_book.py", line 234, in prepare_book
File "site-packages\calibre\gui2\viewer\convert_book.py", line 191, in do_convert
ConversionFailure: Failed to convert book: C:\eBdata\Test.epub with error:
Traceback (most recent call last):
File "site-packages\calibre\customize\ui.py", line 428, in get_file_type_metadata
File "site-packages\calibre\customize\builtins.py", line 194, in get_metadata
File "site-packages\calibre\ebooks\metadata\epub.py", line 238, in get_quick_metadata
File "site-packages\calibre\ebooks\metadata\epub.py", line 219, in get_metadata
File "site-packages\calibre\ebooks\metadata\opf.py", line 43, in get_metadata
File "site-packages\calibre\ebooks\metadata\utils.py", line 46, in parse_opf
File "site-packages\calibre\utils\xml_parse.py", line 31, in safe_xml_fromstring
File "src/lxml/etree.pyx", line 3222, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1877, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1758, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1068, in lxml.etree._BaseParser._parseUnicodeDoc
File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError
XMLSyntaxError: Char 0x0 out of allowed range, line 21, column 50 (line 21)
InputFormatPlugin: EPUB Input running
on C:\eBdata\Test.epub
Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main()
Python function terminated unexpectedly
Char 0x0 out of allowed range, line 21, column 50 (line 21) (Error Code: 1)
Traceback (most recent call last):
File "site.py", line 114, in main
File "site.py", line 88, in run_entry_point
File "site-packages\calibre\utils\ipc\worker.py", line 189, in main
File "<string>", line 1, in <module>
File "site-packages\calibre\srv\render_book.py", line 848, in viewer_main
File "site-packages\calibre\srv\render_book.py", line 841, in render_for_viewer
File "site-packages\calibre\srv\render_book.py", line 816, in render
File "site-packages\calibre\ebooks\oeb\iterator\book.py", line 64, in extract_book
File "site-packages\calibre\customize\conversion.py", line 246, in __call__
File "site-packages\calibre\ebooks\conversion\plugins\epub_in put.py", line 285, in convert
File "site-packages\calibre\ebooks\metadata\opf2.py", line 589, in __init__
File "site-packages\calibre\ebooks\metadata\utils.py", line 46, in parse_opf
File "site-packages\calibre\utils\xml_parse.py", line 31, in safe_xml_fromstring
File "src/lxml/etree.pyx", line 3222, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1877, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1758, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1068, in lxml.etree._BaseParser._parseUnicodeDoc
File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError
File "<string>", line 21
lxml.etree.XMLSyntaxError: Char 0x0 out of allowed range, line 21, column 50

-------------------------------------------------------------------


I also can't open those EPUB files in Microsoft Edge either - *however*, I can open them just fine on Android.

So what is Calibre doing that's not standard, and how can I make these EPUB files universally openable?

Last edited by theducks; 01-20-2020 at 10:26 AM. Reason: addes SPOILER tags
Sheeba is offline   Reply With Quote
Old 01-20-2020, 10:33 AM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,054
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
you are blaming Calibre for choking on a a file with a defect
( XMLSyntaxError: Char 0x0 out of allowed range, line 21, column 50 (line 21) ) << FWIW that is a NUL, and has no useful purpose in any ebook

It is a fairly well known fact that many render engines tolerate some defects (because they are so stupidly common ), including the viewer used with Calibre or Sigil. Which is the reason we tell folk VALIDATE to EPUB standards and not rely on 'it worked in Calibre'
theducks is online now   Reply With Quote
Advert
Old 01-20-2020, 11:22 AM   #3
Sheeba
Junior Member
Sheeba began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2020
Device: none
Okay, so that being the case, how do I validate a file to EPUB standards?

I don't see an obvious method of doing that in Calibre.
Sheeba is offline   Reply With Quote
Old 01-20-2020, 01:23 PM   #4
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
1- Install the Run EpubCheck plugin.
2- Open the epub in the editor.
3- Run the plugin.
jbacelar is offline   Reply With Quote
Old 01-20-2020, 03:10 PM   #5
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
If the viewer won't read the EPUB it's possible the editor won't either

In that case the OP can use the stand alone version of EPUBCHECK ==>> Releases · w3c/epubcheck

It needs Java (as do the calibre and sigil plugins).

BR
BetterRed is offline   Reply With Quote
Advert
Old 01-20-2020, 03:14 PM   #6
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,752
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 Sheeba View Post
When I convert AZW files to EPUB, Calibre throws an error when I try to open them:

-------------------------------------------------------------------
Spoiler:

calibre, version 4.8.0
ERROR: Loading book failed: Failed to open the book at C:\eBdata\Test.epub. Click "Show details" for more info.

Traceback (most recent call last):
File "site-packages\calibre\gui2\viewer\ui.py", line 371, in _load_ebook_worker
File "site-packages\calibre\gui2\viewer\convert_book.py", line 234, in prepare_book
File "site-packages\calibre\gui2\viewer\convert_book.py", line 191, in do_convert
ConversionFailure: Failed to convert book: C:\eBdata\Test.epub with error:
Traceback (most recent call last):
File "site-packages\calibre\customize\ui.py", line 428, in get_file_type_metadata
File "site-packages\calibre\customize\builtins.py", line 194, in get_metadata
File "site-packages\calibre\ebooks\metadata\epub.py", line 238, in get_quick_metadata
File "site-packages\calibre\ebooks\metadata\epub.py", line 219, in get_metadata
File "site-packages\calibre\ebooks\metadata\opf.py", line 43, in get_metadata
File "site-packages\calibre\ebooks\metadata\utils.py", line 46, in parse_opf
File "site-packages\calibre\utils\xml_parse.py", line 31, in safe_xml_fromstring
File "src/lxml/etree.pyx", line 3222, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1877, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1758, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1068, in lxml.etree._BaseParser._parseUnicodeDoc
File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError
XMLSyntaxError: Char 0x0 out of allowed range, line 21, column 50 (line 21)
InputFormatPlugin: EPUB Input running
on C:\eBdata\Test.epub
Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main()
Python function terminated unexpectedly
Char 0x0 out of allowed range, line 21, column 50 (line 21) (Error Code: 1)
Traceback (most recent call last):
File "site.py", line 114, in main
File "site.py", line 88, in run_entry_point
File "site-packages\calibre\utils\ipc\worker.py", line 189, in main
File "<string>", line 1, in <module>
File "site-packages\calibre\srv\render_book.py", line 848, in viewer_main
File "site-packages\calibre\srv\render_book.py", line 841, in render_for_viewer
File "site-packages\calibre\srv\render_book.py", line 816, in render
File "site-packages\calibre\ebooks\oeb\iterator\book.py", line 64, in extract_book
File "site-packages\calibre\customize\conversion.py", line 246, in __call__
File "site-packages\calibre\ebooks\conversion\plugins\epub_in put.py", line 285, in convert
File "site-packages\calibre\ebooks\metadata\opf2.py", line 589, in __init__
File "site-packages\calibre\ebooks\metadata\utils.py", line 46, in parse_opf
File "site-packages\calibre\utils\xml_parse.py", line 31, in safe_xml_fromstring
File "src/lxml/etree.pyx", line 3222, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1877, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1758, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1068, in lxml.etree._BaseParser._parseUnicodeDoc
File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError
File "<string>", line 21
lxml.etree.XMLSyntaxError: Char 0x0 out of allowed range, line 21, column 50

-------------------------------------------------------------------


I also can't open those EPUB files in Microsoft Edge either - *however*, I can open them just fine on Android.

So what is Calibre doing that's not standard, and how can I make these EPUB files universally openable?
Where did these eBooks come from and can you give us some of the titles? Thanks.
JSWolf is offline   Reply With Quote
Old 01-20-2020, 03:15 PM   #7
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by theducks View Post
you are blaming Calibre for choking on a a file with a defect
Blaming calibre seems reasonable to me, given that the EPUB was created by a calibre AZW3->EPUB conversion.

BR
BetterRed is offline   Reply With Quote
Old 01-20-2020, 08:34 PM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,349
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That looks like some metadata from the mobi file has null bytes in it. calibre tries to sanitize all such but I might have missed something. Open a bug report and attach the aw3 file.
kovidgoyal is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Converting from epub to mobi results in loss of *all* images and font data Spankeh Conversion 12 10-17-2019 07:45 PM
help in converting epub to mobi in calibre to read in kindle paperwhite prashantsingh Conversion 6 04-14-2018 10:09 PM
No Privacy Policy? Can I use Calibre to read epub files? kkklll Introduce Yourself 1 09-17-2017 04:13 AM
Converting epub to epub results in 2 pages in book deback Conversion 13 01-31-2016 03:06 PM
Windows Explorer v Calibre - same files, different results Sondar Library Management 15 06-11-2011 07:24 AM


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


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