logo
Header graphic 6 of 9

Categories

Archives

Other stuff

Other sites

I wish this site were powered by Django

October 02nd, 2007

Tab-completion with ActiveState Python 2.5 in the interactive shell on Windows

Filed under: Python, Technology — jm @ 19:52

The default documentation tells you that this will only work on Unix, because the readline library is not available on Windows, or at least not included in ActiveState’s Python distribution.

In fact, there’s a ctypes based version of the readline library developed here: PyReadline on SciPy. You can use this easily to enable tab-completion on a Windows system:

ActivePython 2.5.1.1 (ActiveState Software Inc.)
1. >>> import readline, rlcompleter
2. >>> readline.parse_and_bind('tab: complete')

IronPython (for people not knowing already: IronPython is Python for the .NET CLR/DLR) has tab-completion built-in in the shell, ipy.exe. You enable it like this:

c:\>ipy.exe -X:TabCompletion -X:ColorfulConsole

I’m currently upgrading this weblog (read: I’ve been at it for 3 months now ;-) ), but I needed to write this down. I hope this helps someone else out there…

Update (10/16/2007): I’ve moved this weblog to a new server… it only took me three months :-). Time sure flies around here.

Comments are closed.