From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darlan Cavalcante Moreira Subject: Re: export image generated by python code. Date: Mon, 30 Apr 2012 12:14:12 -0300 Message-ID: <4f9eac49.8a1b340a.7045.ffff8af9@mx.google.com> References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOsJ2-0006Wp-Cm for emacs-orgmode@gnu.org; Mon, 30 Apr 2012 11:14:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SOsIw-0007Rj-5O for emacs-orgmode@gnu.org; Mon, 30 Apr 2012 11:14:27 -0400 Received: from mail-vx0-f169.google.com ([209.85.220.169]:60652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOsIv-0007NJ-V9 for emacs-orgmode@gnu.org; Mon, 30 Apr 2012 11:14:22 -0400 Received: by vcbfy7 with SMTP id fy7so2617103vcb.0 for ; Mon, 30 Apr 2012 08:14:19 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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: Khoroshyy Petro Cc: org-mode mailing list Remember that when you execute the code via "C-c C-c" it is run in a temporary file which is not in the same folder as the org file from where it was generated from. Maybe you are reading some data from a file and Python is not able to locate the file when run with "C-c C-c". Put ":results output" in the header and then print the current working directory to see what I mean. If this is the problem, use the full path to load any data you need in the python code. Remember you can use variables in org-babel to pass this path to python, such as ":var datapath="some_path_or_lisp_function_to_get_the_path" in the babel header.. -- Darlan At Mon, 30 Apr 2012 15:54:34 +0200, Khoroshyy Petro wrote: > > Hi all. > After some struggle, I can see inline pictures in my org file. > The problem was python execution. If I execure the code in python-mode > shell, it generates a picture. > I the code executed via C-c C-c, the output picture file is empty. > I still do not know how to solve it. > > And I have encountered another problem. The 'result' image is not > exported, even if I add play with :export option. > > Any recommendations how to solve those? > Thanks > Petro > #+BEGIN_SRC python :file estimated_spectra_cl.png > import pylab > from scipy import optimize > import numpy as np > import pylab as plt > ..... > plt.figure() > plt.plot(spectra[:,0],spectra[:,1:]) > plt.grid(1) > # plt.show() > plt.savefig("estimated_spectra_cl.png",dpi=100) > #+END_SRC > > #+RESULTS: > [[file:estimated_spectra_cl.png]] >