pyreadline, InteractiveConsole, and tab completion on Windows
Thomas Heller
theller at python.net
Fri Apr 3 04:36:12 EDT 2009
I have installed pyreadline, and get nice tab completion in
the normal interactive interpreter:
<snip>
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import rlcompleter
>>> import readline
>>> readline.parse_and_bind("tab: complete")
>>> <I hit the TAB key, and get this:>
and oct UserWarning ArithmeticError
assert SystemExit filter str
break StandardError range property
[...]
>>> import sys
>>> sys. <I hit the TAB key again, and get this:>
sys.__displayhook__ sys.call_tracing sys.getfilesystemencoding sys.ps1
sys.__doc__ sys.callstats sys.getrecursionlimit sys.ps2
[...]
>>> sys.
</snip>
However, in 'code.interact()', the behaviour is different. Hitting TAB
at the top level works as before, but hitting TAB after entering 'sys.' for example
doesn't show any completions:
<snip>
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import rlcompleter
>>> import readline
>>> readline.parse_and_bind("tab: complete")
>>> import code
>>> code.interact()
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> <I hit the TAB key, and get this:>
and oct UserWarning ArithmeticError
assert SystemExit filter str
break StandardError range property
[...]
>>> import sys
>>> sys. <I hit the TAB key, and get nothing>
</snip>
How can I get the same tab-completion?
Thanks,
Thomas
More information about the Python-list
mailing list