Matheus Vieira Portela added the comment:
I could get readline.insert_text() to work, ish, without calling startup_hook. The script is attached to this message. Apparently, there is some need to call readline.redisplay() to update what's on screen.
However, I can't really understand what's happening... The script prints "Testing text" only when the input has exactly one character. Also, by calling redisplay() after insert_text(), the string is not on the command line buffer, but already printed on screen. I should take a look on the GNU Readline Library documentation to understand better how it works.
Anyway, I still think the documentation is unclear on these behaviours and should be updated.
----------
Added file: http://bugs.python.org/file34366/test_readline.py
_______________________________________
Python tracker