[Python-modules-team] Bug#865359: python-backports-shutil-get-terminal-size: ipython invocation of module shutil_get_terminal_size broken

Tore Ferner torfer at pvv.org
Sat May 5 16:08:00 BST 2018


Hello,

I can confirm that the package python-backports-shutil-get-terminal-size
breaks ipython in stretch with a traceback as described in initial bug
report. It also breaks the sagemath package (the CLI sage command) for
the same reason.

I quick-fixed it thusly (diff -u):

-------[ begin patch ]-----------------
---
/usr/lib/python2.7/dist-packages/IPython/utils/terminal.py-backup-orig
2016-08-13 14:56:43.000000000 +0200
+++ /usr/lib/python2.7/dist-packages/IPython/utils/terminal.py
2018-05-05 16:25:36.734613218 +0200
@@ -19,7 +19,11 @@
     from shutil import get_terminal_size as _get_terminal_size
 except ImportError:
     # use backport on Python 2
-    from backports.shutil_get_terminal_size import get_terminal_size as
_get_terminal_size
+    try:
+        sys.path.append('/usr/lib/python2.7/dist-packages/backports')
+        from shutil_get_terminal_size import get_terminal_size as
_get_terminal_size
+    except ImportError:
+        from backports.shutil_get_terminal_size import
get_terminal_size as _get_terminal_size

 from . import py3compat
-------[ end   patch ]-----------------


Then both ipython and sage can start without a traceback.


Some package versions:

ii  ipython                                                     5.1.0-3
ii  python-backports-abc                                        0.5-1
ii  python-backports-shutil-get-terminal-size                   1.0.0-3
ii  python-backports.ssl-match-hostname                       3.5.0.1-1
ii  python-ipython                                              5.1.0-3
ii  python3-ipython                                             5.1.0-3
ii  sagemath:amd64                                              7.4-9
ii  sagemath-common                                             7.4-9


Best regards
Tore



More information about the Python-modules-team mailing list