From 64b017d12c64ee8acd6b348c2a5701c0158f3fa5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 16 Mar 2009 02:40:26 -0700 Subject: [PATCH] IGN:Another MOBI output fix --- src/calibre/ebooks/oeb/stylizer.py | 6 ++++-- src/calibre/linux.py | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/oeb/stylizer.py b/src/calibre/ebooks/oeb/stylizer.py index 7644bfc0c4..3b5c3e19d0 100644 --- a/src/calibre/ebooks/oeb/stylizer.py +++ b/src/calibre/ebooks/oeb/stylizer.py @@ -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) diff --git a/src/calibre/linux.py b/src/calibre/linux.py index 039d52985a..d46041b828 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -1,9 +1,8 @@ __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' ''' 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