0

Org mode errors out when trying to export a python code block to html. This error seems to be specific to python, as json and bash src blocks work. Furthermore, I can export to latex, markdown and txt. Prior to exporting, the python syntax does get highlighted properly.

Minimal example needed to reproduce:

#+title: Testing exporting python
#+begin_src python
x = 1
#+end_src

Then org-export-dispatch > h > h (or H or o)

enter image description here

Changing the src tag to #+begin_src py fixes the problem (but breaks syntax highlighting)

Changing the src tag to #+begin_src python :exports none also fixes the problem (by not including the python at all in the export)

The error generated is or: Cannot detect source file name; buffer is not visiting a file

enter image description here

org-babel-load-languages is

((python . t)
 (emacs-lisp . t))

Doom emacs with several things added on

GNU Emacs 28.2.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2022-11-01

1
  • 1
    I can't reproduce with Emacs 28.2 (non-Doom) but including my init file. Does it happen with emacs -Q and perhaps some minimal initialization (enabling python for babel e.g.)? If not, then your init file is the culprit: bisect it to figure out what exactly causes the problem.
    – NickD
    Mar 24 at 4:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.