Readline functionality on windows with python 2.7

Franz Payer picture Franz Payer · May 17, 2011 · Viewed 23.7k times · Source

I need to import the readline functionality in a program written in python. I am currently using version 2.7 and the 3rd party packages I have seen only work up to version 2.6. Does anyone know of a 3rd party readline package for Windows with Python 2.7?

Answer

Ben Burns picture Ben Burns · May 17, 2011

I believe pyreadline was designed just for this.

easy_install pyreadline
or:
pip install pyreadline

http://pypi.python.org/pypi/pyreadline

Also, use the following for forward/reverse compatibility:

try:
  import readline
except ImportError:
  import pyreadline as readline