Search code examples
pythonwindowsipythonenthoughtcanopy

IPython buffer and pagination in Enthought Canopy


I'm using Enthought's beta distribution of Python Canopy 0.9.1 on Windows 7. How do I increase the size of my IPython buffer. Also how do I pipe the output of a command through a paginator; output is currently unpaginated.

If existing answers like How to increase the ipython qtconsole scrollback buffer limit or How to use Pipe in ipython will work, I don't know how to apply them to Windows.

Thank you!


Solution

  • There's currently no preference or config option to increase the buffer limit currently, but you could create a macro with the following code, and run it.

    def run():
        code_task = get_active_task()
        python_pane = code_task.python_pane
        python_pane.frontend.control.buffer_size = 1000
    

    Setting the buffer_size to a non-positive value, will turn off clipping of the buffer, but this option is "not recommended" by the IPython devs.

    To create a new macro,

    1. go to Tools (Menu) > Edit Macros ...
    2. Click on the "Create a new macro" button and give the macro a suitable name.
    3. Copy the code above, into your macro
    4. Optionally, you can add a keyboard shortcut for running this macro, by clicking on the keybinding text box in the bottom right, and pressing the desired key-combination. If you choose not to set a keyboard shortcut, you can run the macro from Tools > Run Macro > (your macro)