views:

281

answers:

1

I use a terminal (9term) that does command-line editing itself - programs that use readline just get in its way. It's fully utf-8 aware. How can I make an interactive python session disable readline while retaining utf-8 input and output?

Currently I use:

LANG=en_GB.UTF-8 export LANG
cat | python -i

however this causes sys.stdin.encoding to be None, which implies Ascii (the system default encoding, which doesn't seem to be changeable)

TERM=dumb python

doesn't disable readline (and it mangles utf-8 input also).

I'm new to python, so apologies if this is an obvious question.

+2  A: 

In the past, I've disabled Python readline by rebuilding it from source: configure --disable-readline

This might be overkill, though, for your situation.

Jeff Bauer
that could be an option, but if it was possible, i'd prefer an approach that i could use with anybody's installed python. a quick look in the source suggested that a dynamically loaded C extension might be able to do it, but i'm not sure.
rog
`--disable-readline` still creates a lib-dynload/readline.so that links to system readline. What gives?
Sridhar Ratnakumar