Readline and unwanted filename completion
Simon Budig
Simon.Budig at unix-ag.org
Thu Jan 31 14:36:11 EST 2002
Hi all.
Something is broken with the completion of readline:
simon at ping-pong:~$ python
Python 2.1.1+ (#1, Jan 8 2002, 00:37:12)
[GCC 2.95.4 20011006 (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import rlcompleter
>>> rlcompleter.readline.parse_and_bind ("tab: complete")
>>> foo<TAB><TAB>
foo.gif foo.txt foo2.gif foobar.jpg
>>> foo.gif
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name 'foo' is not defined
[the "foo.gif", "foo.txt", "foo2.gif" and "foobar.jpg" are files
in my current working directory]
It seems that readline has a fallback to filename completion when
no matches are available. Even if I use my own completion function:
>>> def nullcompleter (text, state):
... print "\nBuh!"
... return None
...
>>> rlcompleter.readline.set_completer(nullcompleter)
>>> foo<TAB>
Buh!
<TAB>
Buh!
foo.gif foo.txt foo2.gif foobar.jpg foot
>>> foo
there is this filename fallback.
Is this a known Problem? Is there an evil hack to avoid this?
Thanks,
Simon
--
Simon.Budig at unix-ag.org http://www.home.unix-ag.org/simon/
More information about the Python-list
mailing list