From fe5ff5137711e6f8799e3e635543e75ad8fbe331 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Thu, 15 Jan 2015 18:55:25 +0100 Subject: [PATCH] [mod] pygments dependency warning --- searx/webapp.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/searx/webapp.py b/searx/webapp.py index cf58c55d9..877e40ddc 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -33,9 +33,6 @@ from flask import ( redirect, send_from_directory ) from flask.ext.babel import Babel, gettext, format_date -from pygments import highlight -from pygments.lexers import get_lexer_by_name -from pygments.formatters import HtmlFormatter from searx import settings, searx_dir from searx.engines import ( categories, engines, get_engines_stats, engine_shortcuts @@ -51,6 +48,14 @@ from searx.search import Search from searx.query import Query from searx.autocomplete import searx_bang, backends as autocomplete_backends from searx import logger +try: + from pygments import highlight + from pygments.lexers import get_lexer_by_name + from pygments.formatters import HtmlFormatter +except: + logger.critical("cannot import dependency: pygments") + from sys import exit + exit(1) logger = logger.getChild('webapp')