Skip to content

Commit 7efc4e8

Browse files
TomAugspurgerjreback
authored andcommitted
BUG: Fixed tput output on windows (pandas-dev#16496)
1 parent e60dc4c commit 7efc4e8

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
@@ -37,6 +37,8 @@ Performance Improvements
3737
Bug Fixes
3838
~~~~~~~~~
3939

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

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)