From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: are babel python sessions and inlined images incompatible? Date: Tue, 23 Apr 2013 07:29:50 -0600 Message-ID: <8738uhmget.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUerY-0001qd-EC for emacs-orgmode@gnu.org; Tue, 23 Apr 2013 11:10:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUerW-0006PN-3U for emacs-orgmode@gnu.org; Tue, 23 Apr 2013 11:10:32 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:33732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUerV-0006P9-UX for emacs-orgmode@gnu.org; Tue, 23 Apr 2013 11:10:30 -0400 Received: by mail-pd0-f170.google.com with SMTP id 10so497394pdi.15 for ; Tue, 23 Apr 2013 08:10:29 -0700 (PDT) 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: Rodrigo Amestica Cc: emacs-orgmode@gnu.org Rodrigo Amestica writes: > Hello, > > if I use this block > > #+BEGIN_SRC python :results file > from pylab import * > plot(rand(10)) > savefig('images/test.png') > return 'images/test.png' > #+END_SRC > > then the RESULTS block shows me an inlined version of the plot. > > If now I switch to this block > > #+BEGIN_SRC python :session test :results file > from pylab import * > plot(rand(10)) > savefig('images/test.png') > return 'images/test.png' > #+END_SRC > You don't need to explicitly specify a return when working with a session. Either of the following should work. #+BEGIN_SRC python :session test :file "images/test.png" from pylab import * plot(rand(10)) savefig('images/test.png') #+END_SRC or #+BEGIN_SRC python :session test :results file from pylab import * plot(rand(10)) savefig('images/test.png') 'images/test.png' #+END_SRC Hope this helps, > > then the RESULTS block does not show the inlined plot but this > > | | > > Using a session is kind of mandatory for me because I need several blocks to > share variables. > > Is there something evidently wrong with my approach? > > thanks, > Rodrigo > > -- Eric Schulte http://cs.unm.edu/~eschulte