FAQ
I would like to run this minimal example: I get the prompt
(Question?), but not the 'default editable signal'. Please ?any hints?
(Windows XP-SP3, Python 2.6, pyreadline 1.5)

import readline

def input_default(prompt, default):
def startup_hook():
readline.insert_text(default)
readline.set_startup_hook(startup_hook)
try:
return raw_input(prompt)
finally:
readline.set_startup_hook(None)

print input_default("Question?", default="default editable answer")

Search Discussions

  • Tim Roberts at Jun 14, 2010 at 3:54 am

    rbenit68 wrote:
    I would like to run this minimal example: I get the prompt
    (Question?), but not the 'default editable signal'. Please ?any hints?
    (Windows XP-SP3, Python 2.6, pyreadline 1.5)
    PyReadline on Windows is not identical to readline on Linux, in part
    because the low-level operating system interfaces are quite different.
    raw_input in the Windows implementation bypasses any readline hooks. You'll
    have to use a different method.
    --
    Tim Roberts, timr at probo.com
    Providenza & Boekelheide, Inc.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJun 12, '10 at 7:31a
activeJun 14, '10 at 3:54a
posts2
users2
websitepython.org

2 users in discussion

Tim Roberts: 1 post Rbenit68: 1 post

People

Translate

site design / logo © 2022 Grokbase