View Single Post
Old 02-11-2014, 09:25 PM   #1
twotails
Junior Member
twotails began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2013
Device: Kobo Glo HD
XML error when opening one particular book in Linux

I have a strange issue with a certain ebook. When I try to read it in Calibre, I get an Invalid Predicate error with the following output:

Code:
calibre, version 1.23.0
ERROR: Could not open ebook: Invalid predicate

Traceback (most recent call last):
  File "/usr/lib64/calibre/calibre/gui2/viewer/main.py", line 40, in run
    Thread.run(self)
  File "/usr/lib64/python2.7/threading.py", line 761, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib64/calibre/calibre/ebooks/oeb/iterator/book.py", line 99, in __enter__
    {}, self.base)
  File "/usr/lib64/calibre/calibre/customize/conversion.py", line 241, in __call__
    log, accelerators)
  File "/usr/lib64/calibre/calibre/ebooks/conversion/plugins/epub_input.py", line 208, in convert
    if not self.process_encryption(encfile, opf, log):
  File "/usr/lib64/calibre/calibre/ebooks/conversion/plugins/epub_input.py", line 39, in process_encryption
    idpf_key = opf.unique_identifier
  File "/usr/lib64/calibre/calibre/ebooks/metadata/opf2.py", line 1113, in unique_identifier
    matches = self.root.xpath('//*[@id=%r]'%uuid_elem)
  File "lxml.etree.pyx", line 1478, in lxml.etree._Element.xpath (src/lxml/lxml.etree.c:49895)
  File "xpath.pxi", line 318, in lxml.etree.XPathElementEvaluator.__call__ (src/lxml/lxml.etree.c:144232)
  File "xpath.pxi", line 238, in lxml.etree._XPathEvaluatorBase._handle_result (src/lxml/lxml.etree.c:143240)
  File "xpath.pxi", line 223, in lxml.etree._XPathEvaluatorBase._raise_eval_error (src/lxml/lxml.etree.c:143048)
XPathEvalError: Invalid predicate
This appears to be only on Linux (and possibly only on my distro, I don't know), since I've had friends on Windows test it out and it opens in Calibre for them. If I open it in ADE under Wine, the book opens but it says that the book contains errors and may not display properly (it looks fine to me though).

Because it gives an error in ADE I assume it has something to do with the book's formatting. I've never seen this error appear with another book, and Google doesn't seem to show anyone else with the error either.

I use Slackware Linux and Calibre is built from source, but there are two different build scripts for Calibre (from different sources) and the same error appears in both. Presumably it has something to do with lxml, but I really can't say for sure.

The problem has happened in every Calibre version I've tried it in, from the current build to at least five or six versions ago.

I would share the book for others to test, but it being a copyrighted ebook I don't know if that would be allowed here on the forum. The book came from an official source so I don't think it's a case of anyone tampering with the book.

Anyone have any thoughts on what might be causing this, or how to fix it? The error is preventing me from sending it to my reader, which is a little annoying.

Last edited by twotails; 02-11-2014 at 09:34 PM. Reason: fixing a typo
twotails is offline   Reply With Quote