Dear, org-mode developer,

I was not aware of the fact, that new lines are special in interactive mode and indicate the end of an indented block (I have just found out about that in the babel documentation for python). Therefore the issue which I have reported is probably not a bug but rather an expected behavior. Please excuse me for positing a false bug report.

Best regards,
Tobias Müller.

Am 14.10.19 um 19:55 schrieb Tobias Müller:

Dear org-mode developer,

I have discovered the following issue with Python code-blocks: Using the :session header argument leads to errors of the type IndentationError: expected an indented block if the code block contains indented regions with empty lines. An example code-block which produces this kind of error is the following:

#+begin_src python :session
  for k in range(3):

      print(k)
#+end_src

removing the :session header argument leads to correct execution of the code block. The same is true if the :results output header argument is used.

If the blank line within the for-loop is removed the loop also gets executed correctly, however after executing the block the error NameError: name '_' is not defined is raised in the buffer of the Python session.

The generated info-file is attached to this mail.

Best regards,
Tobias Müller.