6

In a python source block in org-mode, after hitting C-c C-c, emacs says

Evaluation of python source block is disabled

Could anyone explain why?

1
  • Do you have a minimal working example (i.e., a small code source block) that we could all try out to reproduce your exact issue? Commented Dec 31, 2016 at 19:12

2 Answers 2

11

Simon's answer is not right if the org-mode version is >= 9. Here is another question on the same problem.

The solution

cd .emacs.d
cd elpa
cd org-xxxx
rm *.elc

Then, it's better to byte-recompile the directory of the org-xxxx. To do that, start emacs, then

C-0 M-x byte-recompile-directory RET ~/emacs.d/elpa/org-xxxx

Details at here.

Update 1: EmacsWiki on compile file.

Sign up to request clarification or add additional context in comments.

3 Comments

The link on the last line of your answer seems to be dead.
@Nick the link is to github.com/syl20bnr/spacemacs/issues/7641 I just checked it, it should work. BTW, More specifically, it is this_comment
Yup, it's working: whatever was happening yesterday (locally or remotely) seems to have fixed itself.
2

In order to evaluate an org-mode code block of a specific language you will have to customize org-babel-load-languages as described here. Evaluating the following will probably resolve your issue:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((python . t)))

From the docs:

org-babel-load-languages is a variable defined in org.el. Original value was ((emacs-lisp . t))

Languages which can be evaluated in Org-mode buffers. This list can be used to load support for any of the languages below, note that each language will depend on a different set of system executables and/or Emacs modes. When a language is "loaded", then code blocks in that language can be evaluated with org-babel-execute-src-block bound by default to C-c C-c (note the org-babel-no-eval-on-ctrl-c-ctrl-c variable can be set to remove code block evaluation from the C-c C-c keybinding. By default only Emacs Lisp (which has no requirements) is loaded.

You can customize this variable.

This variable was introduced, or its default value was changed, in version 24.1 of Emacs.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.