This is my source block:

#+BEGIN_SRC python
print "hello"

The output is always:

: None

This is my org-babel configuration:

 '((python . t)
   (C . t)
   (calc . t)
   (latex . t)
   (java . t)
   (ruby . t)
   (scheme . t)
   (sh . t)
   (sqlite . t)
   (js . t)))

Python is on my PATH and executable via terminal.

Emacs-lisp SRC blocks works just fine.

Why do I get None instead of hello?

2 Answers 2


This is a peculiarity of how babel handles some languages. This gives some detail on python, and a complete list of options is available here. There are quite a few useful ones.

Basically, depending on the language, there are several options for output. Sometimes it makes sense to use the standard output (what print does), for other languages (eg octave), it makes sense to display an image. For python, the default is value, which shows the return value of the code, so changing your print statement to a return would give the expected behavior.

This isn't very useful in some cases, so it can be changed by adding :results output to the first line of the source block.


In a very simple case like this one, there's a hack I tend to use, replace print with return:

#+BEGIN_SRC python
return "hello"

: hello

But in general the better solution will be to use :results output, as mentioned by user2699.

#+BEGIN_SRC python :results output

: hello
  • 4
    This is not a hack. :)
    – Omar
    Commented Oct 4, 2018 at 2:42
  • While these examples directly worked, I have also upvoted the @user2699 answer. It is necessary to look to the explanations, not to just repeat a magic. Thanks guys.
    – jaromrax
    Commented Jan 25, 2021 at 9:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.