Heisenberg strikes again!

John J. Lee jjl at pobox.com
Thu Sep 11 02:33:54 CEST 2003


"David C. Fox" <davidcfox at post.harvard.edu> writes:
[...]
> Apparently, readline treats an exception in the completer as
> equivalent to returning None.  In fact, you seem to be relying on this
[...]

That's pretty unpleasant.  Naked except:s (with no specific exception)
can cause about the weirdest bugs it's possible to get in Python.  I
think it's worth filing an SF documentation bug (or a patch, better)
about that: set_completer should mention it.

While debugging your completer function, try putting the whole content
of the function in a big try: except:, and use the traceback module:

from traceback import print_exc

def my_completer(text, state):
    try:
        # put everything here
        ...
    except:
        print_exc()


John




More information about the Python-list mailing list