Sometimes you want to use several magics at the same time. Now I know you can use
%%time
%%bash
ls
But when I make my own commands this chaining doesn't work...
from IPython.core.magic import register_cell_magic
@register_cell_magic
def accio(line, cell):
print('accio')
exec(cell)
results in an error when using
%%accio
%%bash
ls
What should I use rather than exec?
from Is it possible to combine magics in IPython / Jupyter?
No comments:
Post a Comment