Questions tagged [ipython-magic]

A set of pre-defined "magic functions" of IPython that used with the command-line syntax.

A set of pre-defined "magic functions" of that used with the command-line syntax. There are two types of magic functions line-oriented and cell-oriented. The lines start with a magic % and executed from the command line. They get into an argument the rest of the line, where the arguments are passed without parentheses and quotation marks. Cell magic begins with the double %%, and they are functions that get in an argument not only the rest of the line, but the line below it in a separate argument.

169 questions
0
votes
1 answer

lost ipython history - database locked

Was playing with ipython history commands, experimenting with combining -l and -g to search a limited amount of history, and using -n to see which session a command came from. Suddenly I got an error (I wish I still had the exact text on my…
Daniel Goldfarb
  • 6,937
  • 5
  • 29
  • 61
0
votes
1 answer

Can I define magic_arguments for my ipython magic without using the decorator approach?

I have defined a custom iPython magic like this: %%writefile pymagic.py from IPython.core import magic_arguments @magic_arguments.magic_arguments() @magic_arguments.argument('--include', '-i', nargs='+', help='Pass file patterns to…
0
votes
1 answer

How to get interactive R output in Jupyter (IPython, rpy2), e.g. for a progress bar?

I am trying to use the built-in R progress-bar (txtProgressBar) with %%R magic in Jupyter. While it does produce a nice animation when executed in the R console or RStudio, it does not produce the desired output in the Jupyter (notebook or lab) with…
krassowski
  • 13,598
  • 4
  • 60
  • 92
0
votes
0 answers

running bash shell code in IPython notebook

I am trying to run a code in jupyter notebook Python3 see below: %% bash rm rvd2.txt rm rvd22.txt rm lsfdout.lsf cat wrench.txt | sed 's/[[:space:]]/\n/g' | sed 's/^[ \t]*//' | sed 's/[ \t]*$//' | \ sed '/^$/d'| tr -cd '[:alnum:] [:space:]'…
ambrish dhaka
  • 689
  • 7
  • 27
0
votes
1 answer

Running gvmagic extension on jupyter notebook returning FileNotFounError

I am developing Python 3.5.3 using the jupyter notebook in Anaconda 2.5.0 (64-bit) on a Windows 10 machine. I am trying to use an extension called 'gvmagic', which is used for viewing graphs. The extension seems to load, but returns a…
gwilymh
  • 415
  • 1
  • 7
  • 20
0
votes
1 answer

IPython error executing system commands

If i execute any system commend in ipython2/3 on my ubuntu 16.04 machine, I get permission denied error as follows: In [1]: ls -------------------------------------------------------------------------- PermissionError …
Imran
  • 642
  • 6
  • 25
0
votes
1 answer

%R magic no longer works in IPython or Jupyter following update to Canopy Ver 1.7.4.3348

Previously %R and %%R magics were working in IPython and Jupyter python notebooks. The R terminal version is: R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 The R Foundation for Statistical Computing Platform:…
Time Lord
  • 331
  • 2
  • 5
  • 12
0
votes
1 answer

Getting argparse documentation as string

I am using argparse to create an ipython magic. The library is nicely printing some documentation when calling parser.print_doc(). However, is there a way to get the documentation as a string instead, so that I can attach it to __doc__ of my ipython…
cphyc
  • 440
  • 5
  • 16
0
votes
0 answers

iPython Magic Commands Unicode Error and Issue with 'str'

I am trying to use iPython magics in my IPython 4.0.3 with a Python 2.7.11. However, using a magic command, e.g.: %load_ext pep8_magic leads to the following error. TypeError: unicode argument expected, got 'str' Does anyone have an idea of…
coltsfan
  • 21
  • 1
0
votes
1 answer

Library to identify the MIME Type of InDesign files in Python

Anybody knows a library that helps to identify InDesign files? I was trying python-magic, but i got application/octet-stream for .indd files and application/zip for .idml files (I know this is a zip file indeed). I'm aware there is no official…
trinchet
  • 6,753
  • 4
  • 37
  • 60
0
votes
1 answer

How to insert a variable in href link in iPython markup

I am using Ipython Notebook 2 I have a file name in variable which dynamically calculates the location and file name of file located in current directory, And I want to insert that variable in my markup to download it below is the code: …
user3482218
  • 1
  • 1
  • 2
0
votes
1 answer

How can I define custom magics in jupyter on pip install

This is an extension of this question I want to install my SAS Magic when I install my SAS Kernel through pip. It will register if I import the package from sas_kernel.magics import sas_magic but I want it to be available without needing the…
Jared
  • 63
  • 6
0
votes
2 answers

How to Use PyEDA to visualize BDDs? Probably very simple

I'm following the tutorial at http://pyeda.readthedocs.org/en/latest/bdd.html to visualize a majority function BDD. I've done the following : In [1]: %install_ext https://raw.github.com/cjdrake/ipython-magic/master/gvmagic.py In [2]: %load_ext…
S2C
  • 53
  • 1
  • 12
0
votes
0 answers

unsupported operand type(s) for /: 'str' and 'str'- unable to understand this ( i tried float() function also

I am unable to calculate another columns by diving or multiplying through below code- csv_data["male Turnout"]=csv_data["Male Voters"]/csv_data["Male Electors"] male turnout- New column name male voters- existing column male electors- existing…
Sanchit Aluna
  • 455
  • 2
  • 6
  • 20
0
votes
2 answers

IPython notebook: define a dummy cell magic that simply runs the cell as usual

How can I define a simple cell magic that just executes the cell as if the %%mymagic wasn't there? The context is that we are using the wonderful IPython parallel framework. In some places, we also use its defined %%px magic. But sometimes we'd…
Pierre D
  • 24,012
  • 7
  • 60
  • 96