* Problem with python source block
@ 2018-05-26 5:06 Doyley, Marvin M.
2018-05-26 5:29 ` Thibault Marin
2018-05-26 10:00 ` Van L
0 siblings, 2 replies; 7+ messages in thread
From: Doyley, Marvin M. @ 2018-05-26 5:06 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
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
]]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem with python source block
2018-05-26 5:06 Problem with python source block Doyley, Marvin M.
@ 2018-05-26 5:29 ` Thibault Marin
2018-05-26 10:00 ` Van L
1 sibling, 0 replies; 7+ messages in thread
From: Thibault Marin @ 2018-05-26 5:29 UTC (permalink / raw)
To: Doyley, Marvin M.; +Cc: emacs-orgmode@gnu.org
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 it 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
> ]]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem with python source block
2018-05-26 5:06 Problem with python source block Doyley, Marvin M.
2018-05-26 5:29 ` Thibault Marin
@ 2018-05-26 10:00 ` Van L
1 sibling, 0 replies; 7+ messages in thread
From: Van L @ 2018-05-26 10:00 UTC (permalink / raw)
To: Doyley, Marvin M.; +Cc: emacs-orgmode@gnu.org
> Doyley, Marvin M. writes:
>
> I get an error
I get a reproduction of your error outside of Emacs and Org Mode.
Adapting an example from the list’s archive, the following works.
#+BEGIN_SRC elisp :results none
(org-babel-do-load-languages
'org-babel-load-languages
'((python . t)))
#+END_SRC
#+BEGIN_SRC python :results output
a = 5
b = 16
print(a + b)
#+END_SRC
#+RESULTS:
: 21
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem with python source block
@ 2018-05-26 13:16 Doyley, Marvin M.
2018-05-26 14:22 ` Doyley, Marvin M.
0 siblings, 1 reply; 7+ messages in thread
From: Doyley, Marvin M. @ 2018-05-26 13:16 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1.1: Type: text/plain, Size: 947 bytes --]
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.
[-- Attachment #1.2: Type: text/html, Size: 2011 bytes --]
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem with python source block
2018-05-26 13:16 Doyley, Marvin M.
@ 2018-05-26 14:22 ` Doyley, Marvin M.
2018-05-26 15:18 ` John Kitchin
2018-05-26 16:39 ` Doyley, Marvin M.
0 siblings, 2 replies; 7+ messages in thread
From: Doyley, Marvin M. @ 2018-05-26 14:22 UTC (permalink / raw)
To: Doyley, Marvin M.; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 1352 bytes --]
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. <m.doyley@rochester.edu<mailto:m.doyley@rochester.edu>> 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.
[-- Attachment #2: Type: text/html, Size: 3114 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem with python source block
2018-05-26 14:22 ` Doyley, Marvin M.
@ 2018-05-26 15:18 ` John Kitchin
2018-05-26 16:39 ` Doyley, Marvin M.
1 sibling, 0 replies; 7+ messages in thread
From: John Kitchin @ 2018-05-26 15:18 UTC (permalink / raw)
To: Doyley, Marvin M.; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 2080 bytes --]
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. <m.doyley@rochester.edu>
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. <m.doyley@rochester.edu>
> 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.
>
>
>
[-- Attachment #2: Type: text/html, Size: 3899 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Problem with python source block
2018-05-26 14:22 ` Doyley, Marvin M.
2018-05-26 15:18 ` John Kitchin
@ 2018-05-26 16:39 ` Doyley, Marvin M.
1 sibling, 0 replies; 7+ messages in thread
From: Doyley, Marvin M. @ 2018-05-26 16:39 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1.1: Type: text/plain, Size: 1672 bytes --]
Thanks John,
The problem is now fixed
cheers,
M
> On May 26, 2018, at 10:22 AM, Doyley, Marvin M. <m.doyley@rochester.edu> 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. <m.doyley@rochester.edu <mailto:m.doyley@rochester.edu>> 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.
>
[-- Attachment #1.2: Type: text/html, Size: 3637 bytes --]
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-05-26 16:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-26 5:06 Problem with python source block Doyley, Marvin M.
2018-05-26 5:29 ` Thibault Marin
2018-05-26 10:00 ` Van L
-- strict thread matches above, loose matches on Subject: below --
2018-05-26 13:16 Doyley, Marvin M.
2018-05-26 14:22 ` Doyley, Marvin M.
2018-05-26 15:18 ` John Kitchin
2018-05-26 16:39 ` Doyley, Marvin M.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).