Skip to content

Commit 1669a61

Browse files
committed
BUG: Fixed tput output on windows (pandas-dev#16496)
(cherry picked from commit 7efc4e8)
1 parent c58cd47 commit 1669a61

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

doc/source/whatsnew/v0.20.2.txt

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Performance Improvements
3838
Bug Fixes
3939
~~~~~~~~~
4040

41+
- Silenced a warning on some Windows environments about "tput: terminal attributes: No such device or address" when
42+
detecting the terminal size. This fix only applies to python 3 (:issue:`16496`)
4143
- Bug in using ``pathlib.Path`` or ``py.path.local`` objects with io functions (:issue:`16291`)
4244
- Bug in ``DataFrame.update()`` with ``overwrite=False`` and ``NaN values`` (:issue:`15593`)
4345
- Passing an invalid engine to :func:`read_csv` now raises an informative

pandas/io/formats/terminal.py

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from __future__ import print_function
1515

1616
import os
17+
import sys
18+
import shutil
1719

1820
__all__ = ['get_terminal_size']
1921

@@ -26,6 +28,10 @@ def get_terminal_size():
2628
IPython zmq frontends, or IDLE do not run in a terminal,
2729
"""
2830
import platform
31+
32+
if sys.version_info[0] >= 3:
33+
return shutil.get_terminal_size()
34+
2935
current_os = platform.system()
3036
tuple_xy = None
3137
if current_os == 'Windows':

0 commit comments

Comments
 (0)