diff options
Diffstat (limited to 'pygments/formatters/terminal.py')
-rw-r--r-- | pygments/formatters/terminal.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pygments/formatters/terminal.py b/pygments/formatters/terminal.py index a78c5a33..dae00157 100644 --- a/pygments/formatters/terminal.py +++ b/pygments/formatters/terminal.py @@ -5,10 +5,12 @@ Formatter for terminal output with ANSI sequences. - :copyright: Copyright 2006-2011 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ +import sys + from pygments.formatter import Formatter from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Token, Whitespace @@ -86,7 +88,8 @@ class TerminalFormatter(Formatter): # hack: if the output is a terminal and has an encoding set, # use that to avoid unicode encode problems if not self.encoding and hasattr(outfile, "encoding") and \ - hasattr(outfile, "isatty") and outfile.isatty(): + hasattr(outfile, "isatty") and outfile.isatty() and \ + sys.version_info < (3,): self.encoding = outfile.encoding return Formatter.format(self, tokensource, outfile) |