Skip to content

Commit c114adc

Browse files
changhiskhanwesm
authored andcommitted
BUG: problems with qtconsole and _repr_html #2275
1 parent 21f7a6b commit c114adc

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pandas/core/common.py

+11
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,17 @@ def in_interactive_session():
10981098
import __main__ as main
10991099
return not hasattr(main, '__file__')
11001100

1101+
def in_qtconsole():
1102+
"""
1103+
check if we're inside an IPython qtconsole
1104+
"""
1105+
try:
1106+
ip = get_ipython()
1107+
if ip.config['KernelApp']['parent_appname'] == 'ipython-qtconsole':
1108+
return True
1109+
except:
1110+
return False
1111+
11011112
# Unicode consolidation
11021113
# ---------------------
11031114
#

pandas/core/frame.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,10 @@ def _need_info_repr_(self):
585585
particular DataFrame.
586586
"""
587587

588-
terminal_width, terminal_height = get_terminal_size()
588+
if com.in_qtconsole():
589+
terminal_width, terminal_height = 10, 100
590+
else:
591+
terminal_width, terminal_height = get_terminal_size()
589592
max_rows = (terminal_height if get_option("print_config.max_rows") == 0
590593
else get_option("print_config.max_rows"))
591594
max_columns = get_option("print_config.max_columns")

0 commit comments

Comments
 (0)