New submission from Idan Kamara <idank...@gmail.com>:

import sys, readline

sys.stdout.write('foo ')
raw_input()

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:

sys.stdout.write('foo')
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 <rep...@bugs.python.org>
<http://bugs.python.org/issue12833>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to