I issue
emacs -Q yes.org
where yes.org is
(org-babel-do-load-languages 'org-babel-load-languages '((python . t)))
#+begin_src python :results output
print(2)
#+end_src
I first evaluate the loading Python to babel expression with C-x C-e, and then go to the line of "print" and
- press
C-c C-c, I get
org-ctrl-c-ctrl-c: ‘C-c C-c’ can do nothing useful here
- do
M-x org-babel-execute-src-block, I get
funcall-interactively: Wrong type argument: consp, nil
To investigate latter more, I do M-: (setq debug-on-error t) and the *Backtrace* then reads:
Debugger entered--Lisp error: (wrong-type-argument consp nil)
org-babel-execute-src-block()
funcall-interactively(org-babel-execute-src-block)
command-execute(org-babel-execute-src-block record)
execute-extended-command(nil "org-babel-execute-src-block" "org-babel-execute-sr")
funcall-interactively(execute-extended-command nil "org-babel-execute-src-block" "org-babel-execute-sr")
command-execute(execute-extended-command)
which I don't understand. What's more, I get the exact same error even if I don't call the org-babel-do-load-languages function in the first line. What can I do to make the code block execute and put results?
"emacs --version" says "GNU Emacs 28.1", on Windows 10.
So i tried to manually call org-babel-execute-src-block ("C-x C-e"d this in the "yes.org"s buffer):
(org-babel-execute-src-block nil '("python" "print(2)" nil nil nil nil nil))
and the *Messages* reads
Can’t guess python-indent-offset, using defaults: 4
org-babel-insert-result: Wrong type argument: markerp, nil
So this time it looks like it did evalute the code, but had a hard time inserting it and errored out. The traceback is
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
org-babel-insert-result("None" nil ("python" "print(2)" ((:colname-names) (:rowname-names) (:result-params) (:result-type . value) (:results . "") (:exports . "")) nil nil nil nil) nil "python")
org-babel-execute-src-block(nil ("python" "print(2)" nil nil nil nil nil))
eval-expression((org-babel-execute-src-block nil '("python" "print(2)" nil nil nil nil nil)) nil nil 127)
funcall-interactively(eval-expression (org-babel-execute-src-block nil '("python" "print(2)" nil nil nil nil nil)) nil nil 127)
command-execute(eval-expression)
which I again don't know what it tells...
org-babel-load-languages? RunM-x describe-variable.org-babel-execute-src-blockto the question.