emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Steeves <steeves@raingods.net>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Orgmode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: Suppressing interpeter output in code blocks
Date: Thu, 06 Jun 2013 14:08:47 -0400	[thread overview]
Message-ID: <51B0D02F.4040007@raingods.net> (raw)
In-Reply-To: <87a9n36x9q.fsf@gmail.com>

On 6/6/13 12:04 PM, Eric Schulte wrote:
> Michael Steeves <steeves@raingods.net> writes:
>> Is there any way to suppress all the extra text, and just get the
>> "Hello, world." string as my output?
>>
> 
> #+begin_src python :session testing
> a = 1
> b = 2
> c = a + b
> "Hello, world."
> #+end_src
> 
> #+RESULTS:
> : Hello, world.

Thanks for the reply. Unfortunately I need to set :results to output,
since I'm working with a doc where I'm working through a python script,
and want to run a section, get some output and write some additional
text, then move on to the next block (and all within a session, since
block 2 depends on things from block 1, and so on.

I put together a more descriptive example, but interestingly enough I'm
now getting some inconsistent output when I evaluate the source blocks.

#+BEGIN_SRC python :session testing :results output
print "Hello, World."
print "This is a test."
#+END_SRC

#+RESULTS:
: Hello, World.
: This is a test.

#+BEGIN_SRC python :session testing :results output
a = 1; b = 2
print "A is "+str(a)
print "B is "+str(b)
#+END_SRC

#+RESULTS:
:
: A is 1
: B is 2

#+BEGIN_SRC python :session testing :results output
c = a + b
print "C is "+str(c)
print "Now we're done."
#+END_SRC

#+RESULTS:
:
: C is 3
: Now we're done.

#+BEGIN_SRC python :session testing :results output
y = 3
z = 4
print "Y is "+str(y)
print "Z is "+str(z)
#+END_SRC

#+RESULTS:
:
: >>> Y is 3
: Z is 4

I don't understand why the last chunk provides different output than the
second -- the only real difference is that I put the assignments on one
line (seperated with a semicolon) in the second, and on individual lines
in the last.


-Mike
-- 
Michael Steeves (steeves@raingods.net)

  reply	other threads:[~2013-06-06 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 20:01 Suppressing interpeter output in code blocks Michael Steeves
2013-06-06 16:04 ` Eric Schulte
2013-06-06 18:08   ` Michael Steeves [this message]
2013-06-06 18:28     ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51B0D02F.4040007@raingods.net \
    --to=steeves@raingods.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).