From f89d887c21a0e0e2ed176add94db134877f13b8b Mon Sep 17 00:00:00 2001 From: Lars Yencken Date: Thu, 22 Aug 2013 09:19:31 +1000 Subject: [PATCH] Add a check for posix environment for pygments. --- cheat | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/cheat b/cheat index 9f78aaa..210c251 100755 --- a/cheat +++ b/cheat @@ -2,14 +2,18 @@ import os import sys -try: - from pygments import highlight - from pygments.util import ClassNotFound - from pygments.lexers import get_lexer_for_filename, TextLexer - from pygments.formatters import TerminalFormatter - USE_PYGMENTS = True -except ImportError: - USE_PYGMENTS = False +USE_PYGMENTS = False + +# NOTE remove this check if it is confirmed to work on windows +if os.name == 'posix': + try: + from pygments import highlight + from pygments.util import ClassNotFound + from pygments.lexers import get_lexer_for_filename, TextLexer + from pygments.formatters import TerminalFormatter + USE_PYGMENTS = True + except ImportError: + pass def cheat_directories():