ipython

Control ipython history length

馋奶兔 提交于 2019-12-10 17:25:47
问题 The title pretty much says what I want. I want to have more than 1000 lines of input in my ipython-history; which means that pressing arrow-up commands older are showing up. Is this possible? (probably somewhere in ipython-config()?) Thanks 回答1: In http://2sn.org/python/ipython_config.py there is a # c.TerminalInteractiveShell.history_length = 10000 Does it work? 来源: https://stackoverflow.com/questions/26061049/control-ipython-history-length

Using Anaconda Distribution, how to use bokeh plotting?

心已入冬 提交于 2019-12-10 17:12:32
问题 Note from maintainers: This question concerns the obsolete first generation Bokeh server. For details about modern Bokeh server applications, see: https://docs.bokeh.org/en/latest/docs/user_guide/server.html OBSOLETE: I downloaded the Anaconda installer for Windows 32 bit from https://www.anaconda.com/distribution/ In my Jupyter Notebook, I inserted code from here: https://github.com/bokeh/bokeh/blob/demo/examples/plotting/server/remotedata.py Executing in the notebook draws that error: -----

Changing the IPython interpreter

五迷三道 提交于 2019-12-10 17:10:56
问题 I'm using Python with kdb+. To do this I'm using PyQ, which brings Python and kdb+/Q to the same process and allows both languages to operate on the same set of data/memory space. After some effort, I am able to load Python into the kdb+/Q process on OS X using the instructions from here, i.e. running q python.q [-<python option>@ <python option value>]* python-script This is all good, but I would like to use the above command as interpreter in IPython (Notebook for research, etc.). So, how

IPython ignores object's __repr__ when printing it

旧城冷巷雨未停 提交于 2019-12-10 17:10:51
问题 I have written a subclass of defaultdict , and I gave it its own __repr__ method in order to customize its look in an interactive session. In a regular Python session this works as expected: Python 3.5.0 (default, Sep 20 2015, 11:28:25) [GCC 5.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from collections import defaultdict >>> class Foo(defaultdict): ... def __repr__(self): ... return 'foo_repr' ... >>> foo = Foo() >>> foo foo_repr ... but in

Configure IPython to show warnings all the time

半世苍凉 提交于 2019-12-10 17:06:49
问题 The first time I do something that raises a warning in the IPython shell, I see it. But subsequent times I do not. For example, In [1]: import numpy as np In [2]: np.uint8(250) * np.uint8(2) /Users/me/anaconda/envs/py33/bin/ipython:1: RuntimeWarning: overflow encountered in ubyte_scalars #!/bin/bash /Users/me/anaconda/envs/py33/bin/python.app Out[2]: 244 In [3]: np.uint8(250) * np.uint8(2) Out[3]: 244 # No warning! How do I configure IPython to always show warnings? I've tried: import

IPython notebook does not launch after installing IPython dev version

二次信任 提交于 2019-12-10 16:55:06
问题 I tried today to install the dev version of IPython, but when i run "ipython notebook --pylab=inline" I get an empty notebook opens (no dash board, just a whit blank page) and the command line says: WARNING:tornado.access:404 GET /static/components/jquery-ui/themes/smoothness/jquery-ui.min.css (127.0.0.1) 0 2013-08-05 16:49:57.365 [tornado.access] WARNING | 404 GET /static/components/jquery/jquery.min.js (127.0.0.1 WARNING:tornado.access:404 GET /static/components/jquery/jquery.min.js (127.0

ID of an array element changes in IPython [duplicate]

隐身守侯 提交于 2019-12-10 16:12:30
问题 This question already has answers here : Why the elements of numpy array not same as themselves? (1 answer) Why does id({}) == id({}) and id([]) == id([]) in CPython? (4 answers) Closed 2 years ago . Why does ID of array element keeps on changing? In [43]: x = np.array([[1,2,3],[4,5,6],[7,8,9]]) In [44]: print id(x[0]) 30836416 In [45]: print id(x[0]) 31121344 In [46]: print id(x[0]) 31471808 IPython Screenshot This is not the case when it is written in a python script When written in python

What is “_ipython_canary_method_should_not_exist_”?

痴心易碎 提交于 2019-12-10 15:59:52
问题 I implemented my own __getattr__() to loosely handle any non-existent attributes. I just so happened to define this class in a Jupyter notebook to experiment with it interactively. IPython creates _ipython_canary_method_should_not_exist_ due to this __getattr__ implementation – and I'd like to understand what this is and how to "clean it up" is possible. There is this issue opened about it, but it's not clear to my why – if it checks for permissive handling within __getattr__ – it doesn't

How to reload Django models without losing my locals in an interactive session?

荒凉一梦 提交于 2019-12-10 15:53:36
问题 I'm doing some research with an interactive shell and using a Django app (shell_plus) for storing data and browsing it using the convenient admin. Occasionally I add or change some of the app models, and run a syncdb (or South migration when changing a model). The changes to the models don't take effect in my interactive session even if I re-import the app models. Thus I'm forced to restart the shell_plus and lose my precious locals() in the process. Is there any way to reload the models

Jupyter notebook keeps reconnecting to kernel

前提是你 提交于 2019-12-10 15:24:23
问题 I get to open the Jupyter console without any problems, but when I create a new notebook it keeps connecting to and disconnecting from the kernel (the messages "Connecting to Kernel" / "Connected" keep showing in the upper right corner). This is what Chrome's console spits out (it's the same in Firefox): Untitled3.ipynb?kernel_name=python3:121 loaded custom.js default.js:48Default extension for cell metadata editing loaded. rawcell.js:82Raw Cell Format toolbar preset loaded. slideshow.js