"Mikhail Titov" <m...@gmx.us> writes: >> -----Original Message----- >> From: emacs-orgmode-bounces+mlt=gmx...@gnu.org [mailto:emacs-orgmode- >> bounces+mlt=gmx...@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