Can someone point me to a working setup for using babel with IPython?
I'm witnessing strange indentation behavior when I try to define functions. This happens whether or not I specify the --classic
flag in org-babel-python-command
. My current command (running linux with Emacs 24.4):
(setq org-babel-python-command
"ipython --pylab=qt4 --pdb --nosep --classic --no-banner --no-confirm-exit")
This doesn't work with function definitions.
#+BEGIN_SRC python :session *Broken IPython* :results output pp
def g(x, lst):
if isinstance(x, float):
x = x + 0
return [item + x for item in lst]
#+END_SRC
This doesn't seem related to --classic
either as I get the same error:
Bonus points if you have a working setup that doesn't force me to use --classic
as I do like the formatting of "modern" interface.
Update
Using the magic command lets me define functions and evaluate a session, but I can't get a value output without one. Instead, I get:
#+BEGIN_SRC python :results output
def f(x):
return x + 2
f(2)
#+END_SRC
#+RESULTS:
: >>> ... ... >>> 4
: >>>
#+BEGIN_SRC python :results value
def f(x):
return x + 2
f(2)
#+END_SRC
#+RESULTS:
No results are returned, seemingly because of all the >>>
in the output not being parsed correctly.