Skip to content

Commit

Permalink
Changes to terminal.py to work on Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
shane-kerr committed Dec 28, 2014
1 parent 4613bf7 commit 75968f0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions terminal/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,15 @@
logging.error(
"...or download it from http://pypi.python.org/pypi/ordereddict")
sys.exit(1)
from itertools import imap, izip
try:
from itertools import imap, izip
except ImportError: # Python 3 doesn't have imap or izip in itertool
imap = map
izip = zip
if 'xrange' not in dir(__builtins__): # Python 3 doesn't have xrange()
xrange = range
if 'unichr' not in dir(__builtins__): # Python 3 doesn't have unichr()
unichr = chr

# Inernationalization support
_ = str # So pyflakes doesn't complain
Expand Down Expand Up @@ -2811,7 +2819,7 @@ def write(self, chars, special_checks=True):
else:
logging.warning(_(
"Warning: No ESC sequence handler for %s"
% `self.esc_buffer`
% repr(self.esc_buffer)
))
self.esc_buffer = ''
continue # We're done here
Expand Down

0 comments on commit 75968f0

Please sign in to comment.