Org-Babel Stderr Results

If you execute a code-block in org-mode the default behavior when the executed code sends output to stderr is to open a pop-up buffer rather than including it in the org-babel file. Sometimes, though, you might want to document actual output from stderr but, as it turns out, this is how org-mode is designed so you are mostly stuck with it. There is a simple work-around though, just put an entry in the source-block that outputs to stdout at the end of the block and everyhing will show up in the results.

This is how you could include the output when there are failing tests run by py.test:

#+BEGIN_SRC sh :results verbatim
  py.test tests/
  echo
#+END_SRC

This will run all the tests in the tests folder and include the output in the org-mode file even if there are failures, thanks to the echo at the end.

I got this from Stack Overflow, of course.