Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #99418

readline and TAB-completion?

From Ulli Horlacher <framstag@rus.uni-stuttgart.de>
Newsgroups comp.lang.python
Subject readline and TAB-completion?
Date 2015-11-25 07:02 +0000
Organization University of Stuttgart, FRG
Message-ID <n33mde$bgg$1@news2.informatik.uni-stuttgart.de> (permalink)

Show all headers | View raw


I need an input function with GNU readline support. So far I have:

    import readline
    readline.parse_and_bind("tab: complete")

    file = raw_input('File to send: ')


Cursor keys are working, but TAB-completion works only in the current
directory. Example:


File to send: [TAB][TAB]
argv.py              error.py             md5b64.py            x.py
Python_Cookbook.pdf  bookmarks            fexit.py             murksigkeiten
_.py                 compile.py           https.py             wcp

File to send: /tmp/[TAB][TAB]
argv.py              error.py             md5b64.py            x.py
Python_Cookbook.pdf  bookmarks            fexit.py             murksigkeiten
_.py                 compile.py           https.py             wcp


Is there a way to make TAB-completion work for other directories, too?

-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum IZUS/TIK         E-Mail: horlacher@tik.uni-stuttgart.de
Universitaet Stuttgart         Tel:    ++49-711-68565868
Allmandring 30a                Fax:    ++49-711-682357
70550 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

readline and TAB-completion? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-11-25 07:02 +0000
  Re: readline and TAB-completion? Peter Otten <__peter__@web.de> - 2015-11-25 10:44 +0100
    Re: readline and TAB-completion? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-11-25 12:44 +0000

csiph-web