From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: ob-octave.el raise error after execute src block Date: Fri, 23 Mar 2018 07:55:16 +0800 Message-ID: <0e2fe1ac-b9fd-c500-7816-2b4a428e749c@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------F2BB68EC0EC385BA60DB03A6" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezA3L-00088X-E2 for emacs-orgmode@gnu.org; Thu, 22 Mar 2018 19:55:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezA3G-0005C2-EN for emacs-orgmode@gnu.org; Thu, 22 Mar 2018 19:55:27 -0400 Received: from mail-pl0-x229.google.com ([2607:f8b0:400e:c01::229]:41912) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ezA3G-0005Bc-5z for emacs-orgmode@gnu.org; Thu, 22 Mar 2018 19:55:22 -0400 Received: by mail-pl0-x229.google.com with SMTP id b7-v6so6361201plr.8 for ; Thu, 22 Mar 2018 16:55:21 -0700 (PDT) Received: from [0.0.0.0] ([119.28.89.243]) by smtp.gmail.com with ESMTPSA id z13sm16401971pfk.129.2018.03.22.16.55.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Mar 2018 16:55:19 -0700 (PDT) Content-Language: en-US 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: org-mode This is a multi-part message in MIME format. --------------F2BB68EC0EC385BA60DB03A6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit I got the following error after executing src block: ``` error: invalid call to script /usr/share/octave/4.2.2/m/help/ans.m ``` Here is my code: #+begin_src octave :results file :dir "data/images" :file "figure1.png" clf ();surf (peaks);saveas (1,"figure1.png");#+end_src --------------F2BB68EC0EC385BA60DB03A6 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

I got the following error after executing src block:

```

error: invalid call to script /usr/share/octave/4.2.2/m/help/ans.m

```

Here is my code:

#+begin_src octave :results file :dir "data/images" :file "figure1.png"
clf ();
surf (peaks);
saveas (1, "figure1.png");
#+end_src
--------------F2BB68EC0EC385BA60DB03A6-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: ob-octave.el raise error after execute src block Date: Fri, 23 Mar 2018 00:09:54 +0000 Message-ID: <87bmff4ppp.fsf@ucl.ac.uk> References: <0e2fe1ac-b9fd-c500-7816-2b4a428e749c@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezAHv-0003pE-I0 for emacs-orgmode@gnu.org; Thu, 22 Mar 2018 20:10:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezAHs-0002Qs-D2 for emacs-orgmode@gnu.org; Thu, 22 Mar 2018 20:10:31 -0400 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:50319) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ezAHs-0002QY-5n for emacs-orgmode@gnu.org; Thu, 22 Mar 2018 20:10:28 -0400 Received: by mail-wm0-x231.google.com with SMTP id i75so652229wmf.0 for ; Thu, 22 Mar 2018 17:10:28 -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" To: stardiviner Cc: org-mode --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Friday, 23 Mar 2018 at 07:55, stardiviner wrote: > I got the following error after executing src block: > > ``` > > error: invalid call to script /usr/share/octave/4.2.2/m/help/ans.m I see the same. Not sure why this is happening but you can fix it but adding any line after the saveas statement that would generate a value, e.g. just a "1" will do: #+begin_src org ,#+begin_src octave :results file :dir "data/images" :file "figure1.png" clf (); surf (peaks); saveas (1, "figure1.png"); 1 ,#+end_src #+end_src =2D-=20 Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-341-g3a4fd3 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSPXCedOQfhSlwpVw3IkZPY//z2fQUCWrRF0gAKCRDIkZPY//z2 fWAZAKCRvXvBKDF636XABpGLu1YapnvZCACgnTviIpScAeqbWP4p46Wy/sfzuXg= =41Fn -----END PGP SIGNATURE----- --=-=-=-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner Subject: Re: Need somebody knows Octave help on ob-octave.el error Date: Fri, 23 Mar 2018 16:16:19 +0800 Message-ID: <106ff020-037c-48ce-546e-78cd482ef8bc@gmail.com> References: <0e2fe1ac-b9fd-c500-7816-2b4a428e749c@gmail.com> <87bmff4ppp.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------DE26B789288CC9E88B2EB256" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezHsD-0000RO-8e for emacs-orgmode@gnu.org; Fri, 23 Mar 2018 04:16:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezHs9-0004K4-Tp for emacs-orgmode@gnu.org; Fri, 23 Mar 2018 04:16:29 -0400 Received: from mail-io0-x242.google.com ([2607:f8b0:4001:c06::242]:35677) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ezHs9-0004JT-Mq for emacs-orgmode@gnu.org; Fri, 23 Mar 2018 04:16:25 -0400 Received: by mail-io0-x242.google.com with SMTP id e7so14158848iof.2 for ; Fri, 23 Mar 2018 01:16:25 -0700 (PDT) Received: from [0.0.0.0] ([119.28.89.243]) by smtp.gmail.com with ESMTPSA id l201sm6026604iol.6.2018.03.23.01.16.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 01:16:23 -0700 (PDT) In-Reply-To: <87bmff4ppp.fsf@ucl.ac.uk> Content-Language: en-US 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: org-mode This is a multi-part message in MIME format. --------------DE26B789288CC9E88B2EB256 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit After check out source code of `ob-octave.el`, I found only one places used `ans.m`: ``` (defvar org-babel-octave-wrapper-method   "%s if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); fclose(fid); else, dlmwrite('%s', ans, '\\t') end") ``` Might Octave package versions compatition issue or something elseraised this error. Based on the error hints, should  be the calling to `ans` is wrong. After tesing upper code in Octave REPL, it works fine. that weird. The upper variable is just a wrapper around src block `body`for saving`ans` to file. Anyway, hope somebody who knows elisp and Octave can check this out. On 03/23/2018 08:09 AM, Eric S Fraga wrote: > On Friday, 23 Mar 2018 at 07:55, stardiviner wrote: >> I got the following error after executing src block: >> >> ``` >> >> error: invalid call to script /usr/share/octave/4.2.2/m/help/ans.m > I see the same. Not sure why this is happening but you can fix it but > adding any line after the saveas statement that would generate a value, > e.g. just a "1" will do: > > #+begin_src org > ,#+begin_src octave :results file :dir "data/images" :file "figure1.png" > clf (); > surf (peaks); > saveas (1, "figure1.png"); > 1 > ,#+end_src > #+end_src > --------------DE26B789288CC9E88B2EB256 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

After check out source code of `ob-octave.el`, I found only one places used `ans.m`:

```

(defvar org-babel-octave-wrapper-method
  "%s
if ischar(ans), fid = fopen('%s', 'w'); fprintf(fid, '%%s\\n', ans); fclose(fid);
else, dlmwrite('%s', ans, '\\t')
end")

```

Might Octave package versions compatition issue or something else raised this error. Based on the error hints, should  be the calling to `ans` is wrong. After tesing upper code in Octave REPL, it works fine. that weird. The upper variable is just a wrapper around src block `body` for saving `ans` to file.

Anyway, hope somebody who knows elisp and Octave can check this out.


On 03/23/2018 08:09 AM, Eric S Fraga wrote:
On Friday, 23 Mar 2018 at 07:55, stardiviner wrote:
I got the following error after executing src block:

```

error: invalid call to script /usr/share/octave/4.2.2/m/help/ans.m
I see the same.  Not sure why this is happening but you can fix it but
adding any line after the saveas statement that would generate a value,
e.g. just a "1" will do:

#+begin_src org
  ,#+begin_src octave :results file :dir "data/images" :file "figure1.png"
  clf ();
  surf (peaks);
  saveas (1, "figure1.png");
  1
  ,#+end_src
#+end_src


--------------DE26B789288CC9E88B2EB256--