diff --git a/dpaste/highlight.py b/dpaste/highlight.py index 84306b5..dc418fa 100644 --- a/dpaste/highlight.py +++ b/dpaste/highlight.py @@ -107,6 +107,9 @@ class NakedHtmlFormatter(HtmlFormatter): yield i, t def pygmentize(code_string, lexer_name=LEXER_DEFAULT): - lexer = lexer_name and get_lexer_by_name(lexer_name) \ - or PythonLexer() + try: + lexer = lexer_name and get_lexer_by_name(lexer_name) \ + or PythonLexer() + except Exception as e: + lexer = PythonLexer() return highlight(code_string, lexer, NakedHtmlFormatter())