emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug: Code block returned no value [9.1.9 (release_9.1.9-65-g5e4542 @ /us


From: Greg Minshall
Subject: Bug: Code block returned no value [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)]
Date: Sun, 03 May 2020 07:27:04 -0700

hi.  i'm running R code from an org mode file.  i was having a problem
where a code block that *was* returning a value result was not returning
the results into the buffer.

(after long head-scratching) this appears to be because my code was
returning more lines of results than org-table-convert-region-max-lines.

but, i was *not* seeing any error message, nothing to indicate to me why
i was getting no results.  in the test program below, when trying to
return more than 1000 lines, one sees, in the echo area, "Code block
returned no value".  if you go to *Messages*, there you can see an error
message.

i think somehow org/babel should make sure the user sees what limitation
s/he is running into.

the test block below, 'FailsIfnGT999', if run with n <= 999, will return
a table of that many lines.  if run with n > 999, (for me, invoking
"emacs -Q"), you will get empty results, with the message "Code block
returned no value" (which is false, but the interactions between R code,
R, ess, babel, org, etc., are a bit mysterious to the semi-initiated) in
the echo area.

(not invoking via 'emacs -Q', i am running
----
Package: Org mode version 9.3.6 (9.3.6-43-gc77edd-elpa @
/home/minshall/.emacs.d/elpa/org-20200413/)
----
but the results are the same; i'm submitting the bug report from 9.3.6,
but edited the Subject line with the header from an attempt to submit
from 9.1.9.)

cheers, Greg

>>>>
run this first to get R enabled
#+BEGIN_SRC emacs-lisp :results none
  (org-babel-do-load-languages
   'org-babel-load-languages
      '((R . t)))
#+END_SRC

then, run =FailsIfnGT999= first with =n= set to =100=.  notice there
are results.  then, run =FailsIfnGT999= with =n= set to, e.g., 1100.
notice there are *no* results, and the message area at the bottom of
the screen says
: Code block returned no value

now, if you go to the *Messages* buffer, you *will* see the error message, i.e.,
: Error reading results: (user-error Region is longer than 
‘org-table-convert-region-max-lines’ (999) lines; not converting)

#+name: FailsIfnGT999
#+begin_src R :results value table :var n=100
result <- data.frame()
for (i in 1:n) {
  result <- rbind(result, data.frame(a=i,b=i+1))
}
result
#+end_src
>>>>

Emacs  : GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10)
 of 2019-08-29
Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
/usr/share/emacs/26.3/lisp/org/)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]