From mboxrd@z Thu Jan  1 00:00:00 1970
From: Eric Schulte <eric.schulte@gmx.com>
Subject: Re: python/babel inline images
Date: Tue, 05 Jun 2012 08:57:19 -0600
Message-ID: <874nqp9580.fsf@gmx.com>
References: <87pq9egifm.fsf@bye.fritz.box>
Mime-Version: 1.0
Content-Type: text/plain
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([208.118.235.92]:59161)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eric.schulte@gmx.com>) id 1SbvCN-00053T-TB
	for emacs-orgmode@gnu.org; Tue, 05 Jun 2012 10:57:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eric.schulte@gmx.com>) id 1SbvCH-0007aA-Cb
	for emacs-orgmode@gnu.org; Tue, 05 Jun 2012 10:57:31 -0400
Received: from mailout-us.gmx.com ([74.208.5.67]:43697
	helo=mailout-us.mail.com) by eggs.gnu.org with smtp (Exim 4.71)
	(envelope-from <eric.schulte@gmx.com>) id 1SbvCH-0007Zh-5C
	for emacs-orgmode@gnu.org; Tue, 05 Jun 2012 10:57:25 -0400
In-Reply-To: <87pq9egifm.fsf@bye.fritz.box> (henry atting's message of "Tue,
	05 Jun 2012 12:30:05 +0200")
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
To: henry atting <nsmp_06@online.de>
Cc: emacs-orgmode@gnu.org

henry atting <nsmp_06@online.de> writes:

> Hi,
>
> I do not succeed in generating an inline image as a result of a
> python code block. The code itself works, C-c C-c generates the
> according picture, but only in my home directory. The code block:
>
> -*- org-babel-python-command: "python3" -*-
> #+begin_src python
> import csv
> import matplotlib.pyplot as plot
> x = []
> y = []
> csv_reader = csv.reader(open('csv_data.csv'))
> for line in csv_reader:
> 	x.append(int(line[0]))
> 	y.append(float(line[1]))
> plot.plot(x, y, label=r'exp', color='green')
> plot.legend(loc='lower right')
> plot.savefig("exp_csv.svg")
> #+end_src
>
> It tried different combinations of `:exports results', `:results
> file', `:file filename'

I'm not python expert, but the code block should be run in your current
directory, e.g., the following outputs the current working path expected
for me.

#+begin_src sh
  pwd
#+end_src

If you want to explicitly pass the current directory to your code block
as an argument, you could try something like the following

#+begin_src python :var mydir=(file-name-directory (buffer-file-name))
  return mydir
#+end_src

Hope this helps,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte