Skip to content

Instantly share code, notes, and snippets.

@lukem
Created January 12, 2017 00:37
Show Gist options
  • Save lukem/45e24adf29f3481676def9e123386bda to your computer and use it in GitHub Desktop.
Save lukem/45e24adf29f3481676def9e123386bda to your computer and use it in GitHub Desktop.
python readline 6.0 portability fix
# 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