IPython buffer and pagination in Enthought Canopy

二次信任 提交于 2019-12-06 07:45:22

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)

Let me add to Puneeth's answer that our macro framework allows you to script parts of the application itself. To create a new macro with this code,

  1. Select Tools > Edit macros... and click the "Create a new macro" button in the menu of the new macro window.

  2. Choose and a name, and in the file describing the macro, replace the run function by the one given by Puneeth.

  3. You will also need to create a shortcut combination in the bottom right panel. Click in the Keybinding text box, and type in a short cut of your choice: it will be recorded and stored there.

Save and you are good to go.

Jonathan

Sharing my own solution... if you want to see output that is larger than the iPython buffer, and you're more interested (as I was) in looking output later anyway, you can use the session logging feature of iPython.

In []: %logstart -or filename

and later

In []: %logstop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!