Warning
This documentation is for an old version of IPython. You can find docs for newer versions here.
Magic functions for running cells in various scripts.
Bases: IPython.core.magic.Magics, IPython.config.configurable.Configurable
Magics for talking to scripts
This defines a base %%script cell magic for running a cell with a program in a subprocess, and registers a few top-level magics that call %%script with common interpreters.
Kill all BG processes which are still running.
Kill all BG processes started by %%script and its family.
%shebang [–proc PROC] [–bg] [–err ERR] [–out OUT]
Run a cell via a shell command
The %%script line is like the #! line of script, specifying a program (bash, perl, ruby, etc.) with which to run.
The rest of the cell is run by that program.
Examples
In [1]: %%script bash
...: for i in 1 2 3; do
...: echo $i
...: done
1
2
3
--proc PROC | The variable in which to store Popen instance. This is used only when –bg option is given. |
--bg | Whether to run the script in the background. If given, the only way to see the output of the command is with –out/err. |
--err ERR | The variable in which to store stderr from the script. If the script is backgrounded, this will be the stderr pipe, instead of the stderr text itself. |
--out OUT | The variable in which to store stdout from the script. If the script is backgrounded, this will be the stdout pipe, instead of the stderr text itself. |