Yep, I agree. This is a wart in the vanilla python REPL, and org-mode can't
really do much about it. Except maybe warn people.
As John noted, this is less of a problem if you use ipython as your REPL.
I think it is enough to just do
#+BEGIN_SRC emacs-lisp
(setq org-babel-python-command
Hello,
John Kitchin writes:
> I am not sure it makes sense to change anything for this.
Noted. Thank you for the feedback.
Regards,
--
Nicolas Goaziou
I am not sure it makes sense to change anything for this. There is
different behavior with scripts and the interpreter independently of
org-mode, e.g. with python -i:
>>> for i in range(3):
... print(i)
... i
File "", line 3
i
^
SyntaxError: invalid syntax
Vanilla python sessions
Hello,
William Henney writes:
> I can reproduce your problem. This is (arguably) a bug in ob-python when
> using the vanilla python interpreter together with the :session argument.
> You can work around it by putting a blank line after the for-loop in your
> second code
Hi Florian
I can reproduce your problem. This is (arguably) a bug in ob-python when
using the vanilla python interpreter together with the :session argument.
You can work around it by putting a blank line after the for-loop in your
second code block.
I say that it is arguable that this is a bug
Hello,
I have an org file:
* Overview of available basis functions
#+BEGIN_SRC python :session generateBFpics :exports results :results file
import matplotlib.pyplot as plt
import numpy as np
def set_plotoptions():
plt.xlabel("x")
plt.ylabel("$\phi(x)$")
plt.grid()