up arrow with raw_input

Michael Hudson mwh at python.net
Thu Oct 31 16:29:45 CET 2002

<kevin at exstor.com> writes:

>   I've been trying to trap an up-arrow response when using
> raw_input() and its not going well. I've tried doing an ord() on the
> response to get the ASCII value, but a string of length three is
> produced by the up-arrow event (^[OA) rather than the single
> character that ord() expects. I've also tried using GNU
> readline. This only works from the python prompt (>>>) and not while
> waiting for input using raw_input().

raw_input() certainly *should* use readline if available.

> Does anyone have any ideas?

My pyrepl package is designed for developing command-line interactive


It's probably still a bit rough around the edges, but it might suit.


  Need to Know is usually an interesting UK digest of things that
  happened last week or might happen next week. [...] This week,
  nothing happened, and we don't care.
                           -- NTK Now, 2000-12-29, http://www.ntk.net/

More information about the Python-list mailing list