After today's python updates, I'm getting an error in calibre converting to .mobi. I have the python2-cssutils package installed, am I missing another package?
File "/usr/lib/python2.7/site-packages/lxml/cssselect.py", line 18, in <module> raise ImportError('cssselect seems not to be installed.
Last edited by Scimmia (2012-10-18 01:02:07)
Well, installed the python2-cssselect package from the AUR, now getting an error from the .py file that's calling cssselect.py
File "/usr/lib/calibre/calibre/ebooks/oeb/stylizer.py", line 23, in <module> from lxml.cssselect import css_to_xpath, ExpressionError, SelectorSyntaxError ImportError: cannot import name css_to_xpath
Maybe you should file a bug report?
Maybe. I usually try to figure out what's going on before filing a bug report. I would hate to do that when it was caused by something stupid I did. I'm going to keep looking, if I don't find anything, I'll file one.
Last edited by Scimmia (2012-10-18 00:13:40)
OK, found it. Downgrading python2-lxml fixed it; it appears that the cssselect.py in this package was converted from a full blown module to a wrapper for CSSSelect in the upgrade to 3.0. As such, this is mostly an upstream bug in Calibre. On the other hand, python2-lxml now would depend on CSSSelect for this wrapper to function, which is in the AUR. I'll file the appropriate bug both places.
Last edited by Scimmia (2012-10-18 00:29:28)
Could you post links here when you do to enable others to locate the bugs easily? Thanks.
Calibre will only support their own binaries, which include the necessary python libs. Bug report filed for Arch's Calibre package:
For a temp solution I recommend changing line 23 in /usr/lib/calibre/calibre/ebooks/oeb/stylizer.py
from lxml.cssselect import css_to_xpath, ExpressionError, SelectorSyntaxError
from cssselect import GenericTranslator
Patch is short so I'm posting it here:
--- stylizer.py 2012-10-18 23:27:41.205984029 +0200 +++ stylizer.py.patched 2012-10-18 23:27:07.442641381 +0200 @@ -20,7 +20,8 @@ from cssutils import (profile as cssprofiles, parseString, parseStyle, log as cssutils_log, CSSParser, profiles, replaceUrls) from lxml import etree -from lxml.cssselect import css_to_xpath, ExpressionError, SelectorSyntaxError +#from lxml.cssselect import css_to_xpath, ExpressionError, SelectorSyntaxError +from cssselect import GenericTranslator from calibre import force_unicode from calibre.ebooks import unit_convert from calibre.ebooks.oeb.base import XHTML, XHTML_NS, CSS_MIME, OEB_STYLES
b3niup, you would want to leave the ExpressionError and SelectorSyntaxError in the import statement as well.
If you check the bug reports, you'll see that I posted a sed statement to add to the PKGBUILD that does exactly that. This fixes the bug in Calibre itself, but still relies on a package from the AUR, which is a bug in itself.
OK, it appears that 0.9.3 did fix Calibre's issue, so now all that people need to do to get Calibre running right is installs python2-cssselect from the AUR.
python2-cssselect now seems to be in extra but still needs to be installed manually.