emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ob-octave.el raise error after execute src block
@ 2018-03-22 23:55 stardiviner
  2018-03-23  0:09 ` Eric S Fraga
  0 siblings, 1 reply; 3+ messages in thread
From: stardiviner @ 2018-03-22 23:55 UTC (permalink / raw)
  To: org-mode

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

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


[-- Attachment #2: Type: text/html, Size: 2022 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ob-octave.el raise error after execute src block
  2018-03-22 23:55 ob-octave.el raise error after execute src block stardiviner
@ 2018-03-23  0:09 ` Eric S Fraga
  2018-03-23  8:16   ` Need somebody knows Octave help on ob-octave.el error stardiviner
  0 siblings, 1 reply; 3+ messages in thread
From: Eric S Fraga @ 2018-03-23  0:09 UTC (permalink / raw)
  To: stardiviner; +Cc: org-mode

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

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

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-341-g3a4fd3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Need somebody knows Octave help on ob-octave.el error
  2018-03-23  0:09 ` Eric S Fraga
@ 2018-03-23  8:16   ` stardiviner
  0 siblings, 0 replies; 3+ messages in thread
From: stardiviner @ 2018-03-23  8:16 UTC (permalink / raw)
  To: org-mode

[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]

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
>


[-- Attachment #2: Type: text/html, Size: 7506 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-23  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-22 23:55 ob-octave.el raise error after execute src block stardiviner
2018-03-23  0:09 ` Eric S Fraga
2018-03-23  8:16   ` Need somebody knows Octave help on ob-octave.el error stardiviner

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