classification
Title: Cmd module doesn't support readline completion on OSX Leopard
Type: behavior
Components: Library (Lib) Versions: Python 2.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ronaldoussoren, ruben
Priority: Keywords:

Created on 2008-05-02 18:05 by ruben, last changed 2008-05-03 11:35 by ruben.

Messages
msg66101 (view) Author: Ruben Kerkhof (ruben) Date: 2008-05-02 18:05
Hi,

Leopard ships with libedit, which is almost the same as readline, but 
has another way to configure completion keys. To enable tab completion 
you have to use rl.parse_and_bind("bind ^I complete") instead of rl.parse_and_bind("bind ^I rl_complete") instead of rl.parse_and_bind("tab: complete").

The guys from IPython patched around it, see http://ipython.scipy.org/moin/InstallationOSXLeopard/LeopardPythonReadli
ne, but is seems to me this is better solved in the python readline 
module itself.
msg66147 (view) Author: Ronald Oussoren (ronaldoussoren) Date: 2008-05-03 08:21
I don't really agree. Libedit's configuration is different from that of GN 
U readline. It might be useful to document this issue in the documentation 
of the readline module (and of rlcompleter).

Another alternative would be to add code to the readline module that 
emulates the GNU syntax when compeling using libedit, but I don't think 
that's worth the effort.

I would be willing to review such a patch though.
msg66153 (view) Author: Ruben Kerkhof (ruben) Date: 2008-05-03 11:35
Documenting this would be great, since it caught me by surprise and took 
a while to figure out.

To get the Cmd module to work, atm you have to override the call to 
parse_and_bind, setting self.completekey isn't enough, so that one is 
broken on Leopard.

Patching the readline module is indeed a lot of work, you need to 
convert readline names like 'Tab' to integers to pass them to libedit, 
and convert  the syntax as well. It would be better if libedit would 
just accept readline syntax, but that's outside the scope of Python.
History
Date User Action Args
2008-05-03 11:35:49rubensetmessages: + msg66153
2008-05-03 08:21:06ronaldoussorensetnosy: + ronaldoussoren
messages: + msg66147
2008-05-02 18:05:39rubencreate