IGN:Another MOBI output fix

This commit is contained in:
Kovid Goyal 2009-03-16 02:40:26 -07:00
parent 28ade81a03
commit 64b017d12c
2 changed files with 5 additions and 4 deletions

View File

@ -19,7 +19,7 @@ from cssutils.css import CSSStyleRule, CSSPageRule, CSSStyleDeclaration, \
CSSValueList, cssproperties
from cssutils.profiles import profiles as cssprofiles
from lxml import etree
from lxml.cssselect import css_to_xpath, ExpressionError
from lxml.cssselect import css_to_xpath, ExpressionError, SelectorSyntaxError
from calibre.ebooks.oeb.base import XHTML, XHTML_NS, CSS_MIME, OEB_STYLES
from calibre.ebooks.oeb.base import XPNSMAP, xpath, urlnormalize
from calibre.ebooks.oeb.profile import PROFILES
@ -159,7 +159,9 @@ class Stylizer(object):
for _, _, cssdict, text, _ in rules:
try:
selector = CSSSelector(text)
except (AssertionError, ExpressionError, etree.XPathSyntaxError):
except (AssertionError, ExpressionError, etree.XPathSyntaxError,\
NameError, # gets thrown on OS X instead of SelectorSyntaxError
SelectorSyntaxError):
continue
for elem in selector(tree):
self.style(elem)._update_cssdict(cssdict)

View File

@ -1,9 +1,8 @@
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
''' Post installation script for linux '''
import sys, os, re, shutil
import sys, os, shutil
from subprocess import check_call, call
from tempfile import NamedTemporaryFile
from calibre import __version__, __appname__
from calibre.devices import devices