From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Problem with python source block Date: Sat, 26 May 2018 08:18:30 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000b9030a056d1d65e2" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMaxm-0007DN-HK for emacs-orgmode@gnu.org; Sat, 26 May 2018 11:18:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fMaxl-0006J4-4a for emacs-orgmode@gnu.org; Sat, 26 May 2018 11:18:34 -0400 Received: from mail-wr0-x22e.google.com ([2a00:1450:400c:c0c::22e]:34422) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fMaxk-0006Iq-NZ for emacs-orgmode@gnu.org; Sat, 26 May 2018 11:18:33 -0400 Received: by mail-wr0-x22e.google.com with SMTP id j1-v6so13746526wrm.1 for ; Sat, 26 May 2018 08:18:32 -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" To: "Doyley, Marvin M." Cc: "emacs-orgmode@gnu.org" --000000000000b9030a056d1d65e2 Content-Type: text/plain; charset="UTF-8" The default for :results in scimax is output. You need to specify that you want the value for your block. This worked for me. #+BEGIN_SRC python :results value file import numpy as np import matplotlib.pyplot as plt import seaborn as sns x = np.random.rand(100) y= np.cos(x) plt.plot(x,y) plt.savefig('test.png') return 'test.png' #+END_SRC John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Sat, May 26, 2018 at 7:22 AM, Doyley, Marvin M. wrote: > Hi there, > > The problem seem to be cause by scimax-org-babel-python.el. > When I disable this works fine, but doing this disables asynchronous > execution. > > John do you have any suggestions what is going on ? > > Cheers, > M > > > On May 26, 2018, at 9:16 AM, Doyley, Marvin M. > wrote: > > > Hi Thibault, > > thanks for the info. I will dig around my config > > cheers, > > M > > > > > Hi, > > > For what it's worth, I cannot reproduce it on Org mode version 9.1.>13 > >(release_9.1.13-763-g2621db) with -Q; the file is properly produced. > > > >I get the same error if I add the `session' header argument, maybe i>t is > >set elsewhere? > > >Hope it helps. > > >thibault > > >Doyley, Marvin M. writes: > > >* Hi there,* > > > >* When I run the following code I get an error, does anybody know how to fix * > >* this* > > > >* I am using the latest version of org-mode.* > > > >* Thanks,* > >* M* > > > > > >* #+BEGIN_SRC python :results file* > >* import numpy as np* > >* import matplotlib.pyplot as plt* > >* import seaborn as sns* > >* x = np.random.rand(100)* > >* y= np.cos(x)* > >* plt.plot(x,y)* > >* plt.savefig('test.png')* > >* return 'test.png'* > >* #+END_SRC* > > > >* #+RESULTS:* > >* [[file: File "Org SRC", line 8* > >* return 'test.png'* > >* ^* > >* SyntaxError: 'return' outside function* > >* ]]* > > > > I will do some digging around in my config file. > > > --000000000000b9030a056d1d65e2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The default for :results in scimax is output. You need to = specify that you want the value for your block.

This wor= ked for me.

#+BEGIN_SRC python :results value f= ile
import numpy as np
import matplotlib.pyplot as plt<= /div>
import seaborn as sns
x =3D np.random.rand(100)
y=3D np.cos(x)
plt.plot(x,y)
plt.savefig('test.p= ng')
return 'test.png'
#+END_SRC

John

-----------------------------------
Prof= essor John Kitchin=C2=A0
Doherty Hall A207F
Department of Chemical En= gineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-= 7803

On Sat, May 26, 2018 at 7:22 AM, Doyley, Mar= vin M. <m.doyley@rochester.edu> wrote:
Hi there,

The problem seem to be cause by=C2=A0scimax-org-babel-python.el.
When I disable this works fine, but doing this disables asynchronous execution.

John do you have any suggestions what is going on ?

Cheers,
M


On May 26, 2018, at 9:16 AM, Doyley, Marvin M. <m.doyley@rochester.edu> wro= te:


Hi Thibault,
thanks for the info. I will dig around my config 
cheers,
M


> Hi,

> For what it's worth, I cannot reproduce it on Org mode version 9.1=
.>13
>(release_9.1.13-763-g2621db) with -Q; the file is properly produced.
>
>I get the same error if I add the `session' header argument, maybe =
i>t is
>set elsewhere?

>Hope it helps.

>thibault

>Doyley, Marvin M. writes:

> Hi there,
>
> When I run the following code I get an error, does anybody know how=
 to fix 
> this
>
> I am using the latest version of org-mode.
>
> Thanks,
> M
>
>
> #+BEGIN_SRC python :results file
> import numpy as np
> import matplotlib.pyplot as plt
> import seaborn as sns
> x =3D np.random.rand(100)
> y=3D np.cos(x)
> plt.plot(x,y)
> plt.savefig('test.png')
> return 'test.png'
> #+END_SRC
>
> #+RESULTS:
> [[file:  File "Org SRC", line 8
>     return 'test.png'
>     ^
> SyntaxError: 'return' outside function
> ]]


I will do some digging around in my config file.


--000000000000b9030a056d1d65e2--