You could try setting org-babel-python-command to "python -m sandbox".
If that doesn't work we could add a cmdline header argument to python
code blocks pretty easily.
Cheers,
John Kitchin writes:
> Hi,
> I am looking at a new strategy to capture stderr and exceptions in python
> code blocks.
cool! this worked wonderfully:
(setq org-babel-python-command "python -m sandbox")
#+BEGIN_SRC python
print 'hello'
print 4 + 6
import sys
print >>sys.stderr, 'message to stderr'
raise Exception('baboom')
#+END_SRC
#+RESULTS:
#+begin_example
Hi,
I am looking at a new strategy to capture stderr and exceptions in python
code blocks. Right now exceptions are not captured in the output, and
neither is stderr.
I made a little sandbox module that captures stdout, stderr, and exceptions
and then prints them all to stdout with some minor form