[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] What is output for org-babel?

From: Darlan Cavalcante Moreira
Subject: Re: [Orgmode] What is output for org-babel?
Date: Thu, 05 Nov 2009 11:26:13 -0300
User-agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/23.1 Mule/6.0 (HANACHIRUSATO)

COmments are inline.

At Thu, 5 Nov 2009 11:17:39 +0000 (UTC),
andrea Crotti <address@hidden> wrote:
> I'm with org-mode 6.31a, I was trying to
> get output in the exported files but I never see the output.
> So I investigate and for example this
> #+BEGIN_SRC python
> import os; os.listdir(os.getcwd())

This does not return anything for me either, but
#+BEGIN_SRC python
import os
works as expected. This is strange, since "import os; os.listdir(os.getcwd())"
is valid and will work if typed in the python interpreter directly.

> doesn't return any output while this
> #+BEGIN_SRC python
> "hello"
> does and this:
> #+BEGIN_SRC python
> return "hello"
> Again doesn't.

I don't think this is suppose to work. As I understand org-babel send this code
to python without any processing but you are not inside a python
function. Therefore this is as if you have typed 'return "hello"' in the
interpreter and it will result in an error. That's why no output is shown.
Change "#+BEGIN_SRC python" to "#+BEGIN_SRC python :results output" and you will
see the error.

However, if the code is sent to the python interpreter as it is, then it bugs me
why "import os; os.listdir(os.getcwd())" didn't work.

- Darlan

> I guess that the returned value is depending also on the language,
> but in general what's the rule?
> Another little thing, I have a file with many haskell source blocks.
> They are separated because they are different answers,
> but if they are loaded separately they don't work.
> So is there a way to take all the source code and load it at once?
> Something like more or less:
> (append-to-buffer "haskell-buf" (get-code "exercises.org"))
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

reply via email to

[Prev in Thread] Current Thread [Next in Thread]