Created
January 12, 2017 00:37
-
-
Save lukem/45e24adf29f3481676def9e123386bda to your computer and use it in GitHub Desktop.
python readline 6.0 portability fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# readline 6.0 emits unexpected escape characters | |
# in rl_initialize() if TERM=xterm (and some variants). | |
# The python readline module calls rl_initialize() at | |
# module import, which triggers the issue. | |
# RHEL/CentOS 6.x uses readline 6.0. | |
# Workaround the issue by changing the TERM type if | |
# it starts with "xterm" before any module import. | |
# | |
# @see http://bugs.python.org/issue19884 | |
import os | |
if os.environ.get('TERM', '').startswith('xterm'): | |
os.environ['TERM'] = 'vt100' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment