You are not logged in.

#1 2012-10-17 23:37:04

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,178

[solved - bug reports filed]python cssselect missing

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)

Online

#2 2012-10-17 23:55:22

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,178

Re: [solved - bug reports filed]python cssselect missing

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

Online

#3 2012-10-18 00:09:05

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [solved - bug reports filed]python cssselect missing

Maybe you should file a bug report?

Offline

#4 2012-10-18 00:13:12

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,178

Re: [solved - bug reports filed]python cssselect missing

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)

Online

#5 2012-10-18 00:27:27

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,178

Re: [solved - bug reports filed]python cssselect missing

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)

Online

#6 2012-10-18 00:32:35

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,152

Re: [solved - bug reports filed]python cssselect missing

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

#7 2012-10-18 00:54:05

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,178

Re: [solved - bug reports filed]python cssselect missing

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

Online

#8 2012-10-18 04:12:13

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,178

Re: [solved - bug reports filed]python cssselect missing

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

Online

#9 2012-10-18 21:29:28

b3niup
Member
Registered: 2012-07-26
Posts: 13

Re: [solved - bug reports filed]python cssselect missing

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

#10 2012-10-18 23:46:41

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,178

Re: [solved - bug reports filed]python cssselect missing

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.

Online

#11 2012-10-19 08:33:36

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,178

Re: [solved - bug reports filed]python cssselect missing

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.

Online

#12 2012-10-19 23:58:15

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,152

Re: [solved - bug reports filed]python cssselect missing

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

Board footer

Powered by FluxBB