Block Ctrl+S while running Python script at Windows console?

Peter J. Holzer hjp-python at hjp.at
Tue Mar 19 16:07:51 EDT 2019


On 2019-03-19 14:22:10 -0000, Grant Edwards wrote:
> On 2019-03-18, Malcolm Greene <python at bdurham.com> wrote:
> > Wondering if there's a way to have my Python scripts ignore these
> > Ctrl+S signals or if this behavior is outside of my Python script's
> > control.
> 
> This has nothing to do with Python does it?
> 
> Isn't Python is just writing to stdout and those write calls are
> blocking due because the terminal emulator has stopped reading the
> other end of the pipe/pty/queue/buffer/whatever-it's-called-in-windows?

Yes, but there might be a way to control this behaviour from Python. On
Unix systems you can use the termios functions to turn flow control on
and off. This doesn't help you on Windows, but curses also has raw() and
noraw() functions which do that (among other things) and might work on
Windows, too. However, curses does a lot more than just control flow
control, so it may not be appropriate for the OP's problem.

        hp

-- 
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp at hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20190319/3e332382/attachment.sig>


More information about the Python-list mailing list