How to use gnu readline library in program?

Grant Edwards grante at
Tue Jul 1 17:22:03 CEST 2008

I'm trying to figure out how to use the gnu readline library so
that when my program is prompting the user for input there is
line editing and history support.

I've read and re-read the documentation for the "readline"
module in the standard library and I still can't figure out how
to use the module or even if the module is intended to do what
I want.  The example code all seems to be about on how to
modify the behavior of an interactive Python interpreter
session so you have things like auto-completion of Python

What I want to do is replace sys.stdin.readline() with
something that will provide the user with line editing and
history recall.  In other languages, one uses the Gnu readline
library to do that, but my reading of the Python library
documentation is that's not what the Python readline module is
for. Am I wrong?

Grant Edwards                   grante             Yow! On the road, ZIPPY
                                  at               is a pinhead without a
                                 purpose, but never without
                                                   a POINT.

More information about the Python-list mailing list