emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: R C <recifx@gmail.com>
To: Jack Kamm <jackkamm@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: ob-python.el: questions about output
Date: Wed, 26 Feb 2020 23:29:03 -0500	[thread overview]
Message-ID: <CAD_Xbc6fPvMQyR=g5jhzxbTXqLn0pv2DdONODFFDNzd9GqFWvQ@mail.gmail.com> (raw)
In-Reply-To: <878sksx8mz.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1826 bytes --]

Hi Jack,
Thanks for your suggestion to use ob-jupyter. That gives me the stdout and
graphical output in separate results blocks as I wanted, and no return
statement is needed. I don't know if there are any side-effects to using
multiple sessions in a single org file, but so far it seems to work quite
well.

On Mon, Feb 24, 2020 at 11:18 AM Jack Kamm <jackkamm@gmail.com> wrote:

> Hi RC,
>
> R C <recifx@gmail.com> writes:
>
> > My python src blocks often have both graphical output as well as the
> > results of some numerical calculation displayed using print statements.
> >
> > When exported I would like the line: return 'img/ex1.png' not to be
> > included in the listing of the src block.
> >
> > Also, the output of the print statement is not displayed in this case.
>
> The external ob-jupyter [0] accomplishes what you want:
>
> 1. It can return multiple types of output, e.g. print statements and plots.
> 2. It doesn't require the "return" statement.
>
> It's main limitations are:
> 1. It requires jupyter.
> 2. It requires using session blocks.
>
> I'd recommend checking it out. It has excellent Python support.
>
> If you prefer a native solution, I think the options are:
>
> 1. noweb (as Eric mentioned). Then you only need to write the code
> once, but note that it will be executed twice.
>
> 2. Using multiple session blocks to return output and value
> separately. Since they use the same state, you would only need to
> execute the code once.
>
> 3. Possibly, you could insert the link to the image separately, create a
> named reference to it, and pass it to the Python block via ":var", which
> would create at an image at that link. Then use ":results output" to
> capture the print statements. I'm not 100% sure if this will work.
>
> [0] https://github.com/dzop/emacs-jupyter
>


-- 
Regards,
RC

[-- Attachment #2: Type: text/html, Size: 2572 bytes --]

      parent reply	other threads:[~2020-02-27  9:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-23 16:43 ob-python.el: questions about output R C
2020-02-24  4:52 ` Jack Kamm
2020-02-24  4:53   ` Jack Kamm
2020-02-24  7:13   ` R C
2020-02-24 13:42     ` Fraga, Eric
2020-02-24 16:18       ` Jack Kamm
2020-02-24 16:49         ` Fraga, Eric
2020-02-24 16:17     ` Jack Kamm
2020-02-24 16:40       ` Fraga, Eric
2020-02-27  4:29       ` R C [this message]

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='CAD_Xbc6fPvMQyR=g5jhzxbTXqLn0pv2DdONODFFDNzd9GqFWvQ@mail.gmail.com' \
    --to=recifx@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jackkamm@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).