-
-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qtconsole + _repr_html_ bug #2275
Comments
Besides the qtconsole this is also the case in the ipython notebook (i thought there was an issue about this one too, but can`t find it). Idle #1714, has a similar problem. Sounds like you have a solution for the qtconsole, can you elaborate? I added the |
IPython zmq front ends run in a seperate process from the kernel, and I couldn't locate any interface for Though, It's possible to detect whether the code is running under IPython and under what specific front-end. |
The easiest solution might be to always use the HTML representation if within a qtconsole or IPython notebook. |
Reason not always For reference also mentioning #829 (no means to get ipython notbook size). |
What's the best way to test whether the code is running under terminal or some graphical frontend? just check whether get_ipython returns ZMQInteractiveShell? |
yes, And: get_ipython().config['KernelApp']['parent_appname'] gets you the specific front-end since at least 0.12 I believe. |
hmmm...how do you test this? |
inject into globals()/context manager? |
yeah, can't think of anything better. |
you could also wrap |
probably fine for now. |
In addition to Chang's PR, I disabled HTML output altogether until there's a way to get the window size in characters |
…ain. Where it belongs. pandas-dev#2275 (comment) It'll probably never happen that QTconsole will report it's width, let alone in characters (variable-width font and all). Best let the user decide.
Printing a
pandas.DataFrame
in IPython's qtconsole tries to use_repr_html_
. This method returnsNone
if the terminal window that started the IPython session is too small.I'm not sure this behaviour is right. When you're in the qtconsole,
_repr_html_
should check the size of the qtconsole window and not the the size of the terminal that started the session.Here are some steps to reproduce the issue:
ipython qtconsole
.pandas.DataFrame
calleddf
.df.head()
in IPython. You should notice that the HTML representation of the table is not used.df.head()
in IPython. The HTML representation is now used.I would guess the easiest way to fix this would be to add a qtconsole "os" in
get_terminal_size
inutil/terminal.py
and use Qt hooks to figure out the dimensions of the qtconsole.The text was updated successfully, but these errors were encountered: