two small issues with effbot's windows console module

Alex Martelli aleaxit at yahoo.com
Mon May 28 08:45:17 EDT 2001


Unnice following up to myself, but...:

"Alex Martelli" <aleaxit at yahoo.com> wrote in message
news:9etek203dq at enews1.newsguy.com...
> I tested the module under Win/NT SP4, and it has two
> strange issues.

Actually, both issues are with readline.py, not
with Console.py itself.

> It disables Ctrl-Z in an interactive
> session (workaround: raise SystemExit, or equivalent).

...because it does no test for it whatsoever (I think).

> After the interactive session is finished, the text
> cursor disappears from the Command box, making normal

...because it keeps .cursor(0) normally, with a .cursor(1)
only while the line-reading loop is active, and there is
no .cursor(1) at the end to restore things.

Both issues are worked around by adding an extra case:
            elif e.char == "\032":
                c.cursor(1)
                return ''
to the while 1: loop in method readline().

As I was at it, I also added rudimentary history with
up/down arrow (the class did keep a history but offered
no way to navigate in it, that I could see).  I included
both tiny fixes in the already-mentioned
    http://aleax.supereva.it/Python/cons0528.zip
(downloadable, as mentioned before, only by navigating
to this URL in your browser then clicking on the link
which displays the same URL).

> command-prompt work pretty hard.  Are there easy and/or
> known fixes I'm missing, or shall I look deeper into
> these myself...?  Thanks!

I'd still be interested in better known fixes...


Alex






More information about the Python-list mailing list