emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: henry atting <nsmp_06@online.de>
To: Mikhail Titov <mlt@gmx.us>
Cc: emacs-orgmode@gnu.org, 'henry atting' <nsmp_06@online.de>
Subject: Re: python/babel inline images
Date: Thu, 07 Jun 2012 10:43:25 +0200	[thread overview]
Message-ID: <8762b3eclu.fsf@bye.fritz.box> (raw)
In-Reply-To: <001801cd4418$e34e5d40$a9eb17c0$@us> (Mikhail Titov's message of "Wed, 6 Jun 2012 14:16:34 -0500")

"Mikhail Titov" <mlt@gmx.us> writes:

>> -----Original Message-----
>> From: emacs-orgmode-bounces+mlt=gmx.us@gnu.org [mailto:emacs-orgmode-
>> bounces+mlt=gmx.us@gnu.org] On Behalf Of henry atting
>> Sent: Wednesday, June 06, 2012 10:19 AM
>> To: emacs-orgmode@gnu.org
>> Subject: Re: [O] python/babel inline images
>> 
>> I don't think its a path problem.
>
> Indeed
>
> #+begin_src python :results output
> import os
> print(os.getcwd())
> #+end_src
>
> Shows location of my org doc.

Yes, shows my working directory.


>> The code itself works flawlessly. So
>> the workaround which I already have used is to link to the resulting
>> image. The only drawback with this solution is that after every
>> evaluation I have to remove the empty `'Results:'
>
> You can use :results silent

This is great! Actually this solves my problem which means: create a link
to the file and set results to silent.

>> but the heck with
>> it, I can live with it happily till the end of my days.
>> However I find that some inconsistency lies therein. Before
>> python/matplotlib I used gnuplot with which babel had no problem of
>> this type.
>
> Try using
>
> ... :file exp_csv.svg
> ...
> plot.savefig(file=sys.stdout)

This does not compile, the compiler complains about missing arguments.
I have to write it like this:

plot.savefig("file.svg", format='svg')

>
> #+begin_src python :results output :file zzz.xxx
> import os, sys
> print(os.getcwd(), file=sys.stdout)
> #+end_src
>
> #+RESULTS:
> [[file:zzz.xxx]]

Works as exspected.

> [...]

So, just to mention the current state of affairs (with a simple
example):

--8<---------------cut here---------------start------------->8---
#+begin_src python   :results output
from pylab import *

t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s)
show()
savefig("file.svg", format='svg')
#+end_src
--8<---------------cut here---------------start------------->8---

The above code works. But if I set `:file' to `file.svg' with every
evaluation the link to the file is placed after #+RESULTS: but the
file itself is empty. If the code is evaluated without `:file
file.svg' the evaluation simply works and the file.svg appears in the
working directory.

henry


-- 
http://literaturlatenight.de

  parent reply	other threads:[~2012-06-07  8:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05 10:30 python/babel inline images henry atting
2012-06-05 12:46 ` Brett Viren
2012-06-05 14:57 ` Eric Schulte
2012-06-05 22:34   ` William LÉCHELLE
2012-06-06 15:19     ` henry atting
2012-06-06 19:16       ` Mikhail Titov
2012-06-06 19:25         ` Eric Schulte
2012-06-06 19:32           ` Mikhail Titov
2012-06-07  8:43         ` henry atting [this message]
2012-06-07 15:09           ` Mikhail Titov
2012-06-06  0:59   ` Mikhail Titov
2012-06-06  5:19     ` Eric Schulte
2012-06-06 17:41       ` [babel] session initialization (was RE: python/babel inline images) Mikhail Titov
2012-06-06 19:01         ` Eric Schulte
2012-06-06 19:41           ` Mikhail Titov
2012-06-06 23:06             ` Mikhail Titov
2012-06-07 22:32               ` Mikhail Titov
2012-06-07 22:44                 ` Eric Schulte
2012-06-07 23:02                   ` Mikhail Titov
2012-06-08  1:56                     ` Mikhail Titov
2012-06-08  2:18                       ` Eric Schulte
2012-06-07 22:48             ` 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=8762b3eclu.fsf@bye.fritz.box \
    --to=nsmp_06@online.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=mlt@gmx.us \
    /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).