From e1fb536634017c90ff0fd57ed8e9b272de607d24 2015-03-31 10:28:10 From: Volker Braun Date: 2015-03-31 10:28:10 Subject: [PATCH] Catch termios.error in pager This error is raised by termios.tcgetattr on really old Linux versions (here: Ubuntu 8.04.4) in doctests, that is, without a real stdout. --- diff --git a/IPython/core/page.py b/IPython/core/page.py index 2a0305e..067b540 100644 --- a/IPython/core/page.py +++ b/IPython/core/page.py @@ -100,7 +100,10 @@ def _detect_screen_size(screen_lines_def): # flags each time), we just save the initial terminal state and # unconditionally reset it every time. It's cheaper than making # the checks. - term_flags = termios.tcgetattr(sys.stdout) + try: + term_flags = termios.tcgetattr(sys.stdout) + except termios.error as err: + raise TypeError # Curses modifies the stdout buffer size by default, which messes # up Python's normal stdout buffering. This would manifest itself