2

When I start python in a new 14.04 LTS gnome-terminal it is 80 character wide:

$ python
>>> import os
>>> os.popen('stty size', 'r').read()
'24 80\n'

When I resize the gnome-terminal the new size is reported:

>>> os.popen('stty size', 'r').read()
'23 170\n'

However, the input python prompt does not see the resizing and begins to overwrite the beginning of the line when I write long lines:

nm> 1234567890qwertyuiopåasdfghjklæøzxcvbnm1234567890qwertyuiopåasdfghjklæøzxcvb

Here 'nm' is wrapped.

A reset from the menu of the gnome-terminal does not help. Is there a way to inform the python interpreter that the window is resized?

2
  • Does IPython or python3 suffer from this?
    – muru
    Apr 15, 2016 at 16:21
  • Yes. Ipython and python3 also have the problem. Apr 15, 2016 at 17:02

1 Answer 1

3

This is a bug in Python that has appeared since readline version 6.3 was released. Ubuntu 14.04 has libreadline6 version 6.3-4ubuntu2, so 14.04 and all later Ubuntu releases are affected.

The bug has been fixed in Python, but the fix is not yet in any official release. Refer to the upstream bug report here.

The latest releases as of the time of this writing are 2.7.11 and 3.5.1, so the next releases 2.7.12, 3.5.2, and 3.6.0 should be fixed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .