[New-bugs-announce] [issue2675] Curses terminal resize problems when Python is in interactive mode
report at bugs.python.org
Wed Apr 23 17:41:40 CEST 2008
New submission from Pavel Bazant <maxplanck at seznam.cz>:
When python is in interactive mode, curses does not react to resize
When this is run directly, everything is ok. When it is called via
execfile() from the interactive prompt, it shows the right screen size
after the first keypress, but behaves oddly after the resize.
IMHO, the following happens:
For some reason, env. variables LINES and COLUMNS are set but they are
not reflected in the os.environ structure nor they respond to screen
size changes. If these variables are set then the ncurses library (see
man pages) uses their values instead of getting the term size via
The ncurses library receives a SIGWINCH and sees that LINES
and COLUMNS are set. However, their values are same as the
screen dimensions before the resize, so it is perplexed why there is
a SIGWINCH if the screen did not change and it just ungetchs an ERR
and ncurses internal structures are not changed appropriately.
>From the resizeterm man page:
"If the environment variables LINES or COLUMNS are set, this overrides
the library's use of the window size obtained from the operating
system. Thus, even if a SIGWINCH is received, no screen size change may
be recorded. In that case, no KEY_RESIZE is queued for the next call to
getch; an ERR will be returned instead."
solves the problem for me.
Perhaps the problem has sth to do with python using readline
in interactive mode???
title: Curses terminal resize problems when Python is in interactive mode
versions: Python 2.4
Tracker <report at bugs.python.org>
More information about the New-bugs-announce