This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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

Created on 2008-05-02 18:05 by ruben, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
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) * (Python committer) 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.
msg83148 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-03-04 22:07
I intend to close this as won't fix. The issue is caused by Apple's build 
of Python, the generic Python.org build won't even compile when using 
libedit.
msg92316 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-09-06 13:21
As mentioned before I'm closing this as "won't fix" because this is an 
issue with Apple's copy of Python, not the one shipped by us (the generic 
Python tree doesn't even compile correctly when using libedit)
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46989
2009-09-06 13:21:17ronaldoussorensetstatus: open -> closed
resolution: wont fix
messages: + msg92316
2009-03-04 22:07:44ronaldoussorensetmessages: + msg83148
2008-05-03 11:35:49rubensetmessages: + msg66153
2008-05-03 08:21:06ronaldoussorensetnosy: + ronaldoussoren
messages: + msg66147
2008-05-02 18:05:39rubencreate