Do not use the pygments based highlighter if the user does not have pygments (will happen on some linux distros and for people running from source who dont update the binary)

This commit is contained in:
Kovid Goyal 2014-11-20 22:58:44 +05:30
parent cabc1280f8
commit 66bfe1797b

View File

@ -40,8 +40,11 @@ def get_highlighter(syntax):
if ans is SyntaxHighlighter:
# Load these highlighters only on demand
if syntax == 'python':
try:
from calibre.gui2.tweak_book.editor.syntax.python import PythonHighlighter
ans = PythonHighlighter
except ImportError:
pass # For people running from source
return ans
_dff = None