I should probably confess to having this in my .emacs files:

;; language specific headers. I think this comes before the defaults
(setq org-babel-default-header-args:emacs-lisp
      (cons '(:results . "value replace")
        (assq-delete-all :results org-babel-default-header-args)))

;; set default :results to output
(setq org-babel-default-header-args
      (cons '(:results . "output replace")
        (assq-delete-all :results org-babel-default-header-args)))

;; set default exports to both code and results
(setq org-babel-default-header-args
      (cons '(:exports . "both")
        (assq-delete-all :exports org-babel-default-header-args)))

These things change the default behaviors for the results. I almost always want output as results, and not value (the regular default), except when coding in emacs-lisp where the value make sense to me.

That would certainly be a point of confusion ;)

I also find you want :results output raw

if you are printing a table or printing org. This is something I have never found satisfying, especially for long tables or outputs it is tedious to have to delete the old output by hand before rerunning it. I have not found any other sets of options that do what I want, e.g. changing raw to org results in the section being wrapped in #+begin_org/end_org, which is usually not what I want. I usually do want the raw output.

I hope that clarifies where some of your differences might be coming from.

John

-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Tue, Apr 15, 2014 at 5:18 PM, Martin Schöön <martin.schoon@gmail.com> wrote:
This is my first post here...

I have been using org-mode as a pure TODO-tool for some time but this winter I realised it could be used for much more and I have been experimenting with mixing in LaTeX and Python for fun and because I find literate programming a particularly sane idea (I am a HW engineer).

Less than I week ago I started to look into using tables for input and output to/from Python scripts. I was inspired by something I found at http://kitchingroup.cheme.cmu.edu/ . The enclosed example 1 file is a pruned version of the org-file I found there. If I run the embedded Python script using C-c C-c I don't get the table shown in the example. Instead I get "none" on the row following "#+RESULTS:"

If I change ":results raw" to ":results output" I do get the table but 'wrapped' in "#+begin_example" and "#+end_example" as shown in  the enclosed example 2 file. I have done some further testing/changes in that file (adding some stuff to the top of the file and changing the formatting of the print statements) none of which changed the extra wrapping of the table. When I export to LaTeX -> PDF the table does not show up in the end result.

Let's move over to the third example file and the real mystery. This all my own code. Reading data from the first table works just fine and the same goes for the calculations. The output table, however, is different from that of example 2. The 'wrapper' is gone but each row is starting with ": ". Where does that come from? Why does it differ from example 2? If my results differ from someone else's (different install/versions etc) -- OK. But how can I get differences like this on my own? To my  un-trained eyes the print statements of examples 2 and 3 look very similar. (But, the first things that go blind are the eyes... probably something blatantly obvious once pointed out to me.)

OS: #! Linux (Based on Debian stable, 64-bit)
Emacs: 23.4.1
Org-mode: 8.2.5h
Python: 2.7.3