[New-bugs-announce] [issue12833] raw_input misbehaves when readline is imported

Idan Kamara report at bugs.python.org
Wed Aug 24 19:00:12 CEST 2011

New submission from Idan Kamara <idankk86 at gmail.com>:

import sys, readline

sys.stdout.write('foo ')

When trying the above on Debian, 2.6.6 using gnome-terminal, typing a character then hitting backspace deletes "foo " as well.

I'm not sure if this is a bug or the expected behavior when writing to stdout directly rather than passing the string to raw_input() (for my particular use case that's not an option though).

One possible workaround seems to be to delete the trailing space from write() and move it to raw_input:

raw_input(' ')

Then backspace seems to work properly. This has something to do with readline because when it's not imported, it also works as expected (but other things break obviously).

components: Library (Lib)
messages: 142887
nosy: idank
priority: normal
severity: normal
status: open
title: raw_input misbehaves when readline is imported
type: behavior
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list