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--