[issue8243] curses writing to window's bottom right position raises: `_curses.error: addstr() returned ERR'

Charles Merriam report at bugs.python.org
Fri May 23 20:42:13 CEST 2014


Charles Merriam added the comment:

Some more information to just nail this thing that's been here forever.

1.  This has been an issue in Python since at least 2001.
2.  It is a duplicate of the item 441129 which was closed as won't fix.
3.  It is bug in curses implementations.
4.  This occurs whenever the lower-right character of a screen or window is written.  The writing, via addch() or addstr(), causes the cursor to advance outside the window and triggers the error.  It triggers the same error as attempting to write beyond the edge of the screen, window, or pad.   
5.  This occurs with the main windows, sub windows, and pads.
6.  There are two work-arounds for users:
    a.   Don't do that.  Make your window bigger.
    b.   Catch and ignore the error.  The library does the right thing but 
    is trying to be too smart about raising errors.
7.  There are two good resolutions to the problem:
    a.  Document it.  Add a note to addch() and addstr() to the effect:
        "Writing outside the pad, window, or subwindow will cause a curses.error Exception.  Also, attempting to write the lower right corner of a pad, window, or sub window will cause an exception to be raised after the character is printed.  You may safely ignore the error in this case."
    b.  Document it as above and add an example.
    c.  Wrap it so it works on Python if no other curses implementation.  Many long discussions can be arguments before agreeing why this a bad idea.
                 
This is an annoying, obscure bug that deserves a couple lines in the documentation.  If you need sample code, I can provide.

----------
nosy: +Charles.Merriam

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8243>
_______________________________________


More information about the Python-bugs-list mailing list