execute Bash command from IPython

Fernando Perez, creator of IPython, suggests this: In [1]: %%bash . ~/.bashrc <my_fancy_bash_function> <function_argument> This works on the current stable version (0.13.2). He admits that’s a bit clunky, and welcomes pull requests. . .

ipython: how to set terminal width

You can see your current line width with numpy.get_printoptions()[‘linewidth’] and set it with numpy.set_printoptions(linewidth=160) Automatically set printing width If you’d like the terminal width to be set automatically, you can have Python execute a startup script. So create a file ~/.python_startup.py or whatever you want to call it, with this inside it: # Set the … Read more

How to display line numbers in IPython Notebook code cell by default

(For Jupyter 4+) In the latest Jupyter versions, they have documented the place to make config changes. So basically, in the Jupyter update, they’ve removed the concept of profiles, so the custom.js file location is now .jupyter/custom/custom.js, depending on where your .jupyter folder is. So if you don’t have a custom folder or the custom.js … Read more

How can I launch ipython from shell, by running ‘python …’?

To start IPython shell directly in Python: from IPython import embed a = “I will be accessible in IPython shell!” embed() Or, to simply run it from command line: $ python -c “from IPython import embed; embed()” embed will use all local variables inside shell. If you want to provide custom locals (variables accessible in … Read more

Where should I place my settings and profiles for use with IPython/Jupyter 4.0?

First of all, check what’s in your ~/.jupyter/ folder. Some of the comments under the question mention you have a file named “MIGRATED” that contains only a timestamp. If you are in this state, run the command: jupyter notebook –generate-config which will create a new file ~/.jupyter/jupyter_notebook_config.py. If you already have this file, you don’t … Read more

Multiple directories and/or subdirectories in IPython Notebook session?

The IPython documentation pages suggest that opening several different sessions of IPython notebook is the only way to interact with saved notebooks in different directories or subdirectories, but this is not explicitly confirmed anywhere. Yes, this is a current (temporary) limitation of the Notebook server. Multi-directory support is very high on the notebook todo list … Read more

How to display print statements interlaced with matplotlib plots inline in Ipython?

There is simple solution, use matplotlib.pyplot.show() function after plotting. this will display graph before executing next line of the code %matplotlib inline import matplotlib.pyplot as plt i = 0 for data in manydata: fig, ax = plt.subplots() print “data number i =”, i ax.hist(data) plt.show() # this will load image to console before executing next … Read more

How to open IPython interpreter in emacs?

I don’t know what Prelude is, but if you can install the latest Emacs (i.e, Emacs with Fabian’s python-mode included), then you can use the following to let Python mode know your preferred choice of interpreter. Then you just need to call M-x run-python: — (when (executable-find “ipython”) (setq python-shell-interpreter “ipython”)) —

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)