Skip to content
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

is it possible to disable the pager, or to tell specific magics not to use the pager? #5410

Closed
gregcaporaso opened this issue Mar 22, 2014 · 3 comments
Milestone

Comments

@gregcaporaso
Copy link
Contributor

Hello,
Not sure if you guys handle support questions through the issue tracker or elsewhere, but if elsewhere and you can point me there I'm happy to repost.

I'm trying to get the output of %psource to print following the cell, rather than have the output run through the pager in the HTML Notebook. I've poked around the documentation, did some googling, and poked through the issue tracker (most related issue I found is #1947) and source code, but I'm having a hard time figuring out how to do this. Is it possible? If not, I think that would be a really useful feature.

My specific use case is that I'm putting bioinformatics educational materials together using the Notebook, and want to display source code for some key functions inline, so they display nicely e.g. via nbviewer as features of the source code are discussed in the surrounding text.

Thanks for the help with this!
Greg

@minrk
Copy link
Member

minrk commented Mar 23, 2014

Yup, you can just replace the pager call with print: http://nbviewer.ipython.org/gist/minrk/7715212

@gregcaporaso
Copy link
Contributor Author

Worked perfectly, thank you!

@chbrown
Copy link
Contributor

chbrown commented Jan 30, 2017

It's a bit more complex these days, since page() is called with a dict of mime-type-keyed documents. Here's what disabled the pager for my IPython 5.1.0 installation:

In ~/.ipython/profile_default/startup/no-pager.py:

from __future__ import print_function

def page_printer(data, start=0, screen_lines=0, pager_cmd=None):
    if isinstance(data, dict):
        data = data['text/plain']
    print(data)

import IPython.core.page
IPython.core.page.page = page_printer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants