You are not logged in.
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)
Offline
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
Offline
Maybe you should file a bug report?
Offline
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)
Offline
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)
Offline
Could you post links here when you do to enable others to locate the bugs easily? Thanks.
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Sure. Looks like I had somehow missed an already filed bug here:
https://bugs.archlinux.org/task/31857
But calibre doesn't work with lxml 3.0 even with the right packages, that bug is here:
https://bugs.launchpad.net/calibre/+bug/1067942
Offline
Calibre will only support their own binaries, which include the necessary python libs. Bug report filed for Arch's Calibre package:
https://bugs.archlinux.org/task/32051
Offline
For a temp solution I recommend changing line 23 in /usr/lib/calibre/calibre/ebooks/oeb/stylizer.py
from:
from lxml.cssselect import css_to_xpath, ExpressionError, SelectorSyntaxError
to:
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
Offline
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.
Offline
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.
Offline
python2-cssselect now seems to be in extra but still needs to be installed manually.
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline