astahlman / ob-async

Asynchronous src_block execution for org-babel
343 stars 32 forks source link

Error: (wrong-type-argument stringp nil) #43

Closed seagle0128 closed 5 years ago

seagle0128 commented 5 years ago

Checklist

Expected Behavior

Output correct results

Actual Behavior

Error, no output

Steps to Reproduce

C-c C-c on this block

+BEGIN_SRC emacs-lisp :async

(sleep-for 3) (file-relative-name (file-name-directory buffer-file-name) (file-truename (doom-modeline-project-root))) (message "Hello, Elisp!")

+END_SRC

Troubleshooting Artifacts

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  signal(wrong-type-argument (stringp nil))
  async-handle-result((lambda (result) (with-current-buffer #<buffer src.org> (save-excursion (goto-char (point-min)) (re-search-forward "1b5dff1ff6ebaafc6b901842b358d292") (org-backward-element) (let ((result-block (split-string (thing-at-point 'line t)))) (-if-let (block-name (nth 1 result-block)) (org-babel-goto-named-src-block block-name) (org-backward-element))) (let ((file (cdr (assq :file '((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:lexical . "no") (:async)))))) (when file (when result (with-temp-file file (insert (org-babel-format-result result (cdr (assq :sep '((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:lexical . "no") (:async)))))))) (setq result file)) (let ((post (cdr (assq :post '((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:lexical . "no") (:async)))))) (when post (let ((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq :file-desc '((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:lexical . "no") (:async))))) (and desc (or (cdr desc) result))))))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" '("replace"))))))) (org-babel-insert-result result '("replace") '("emacs-lisp" "(sleep-for 3)\n(message \"Hello, Elisp!\")\n\n(file-relative-name (file-name-directory buffer-file-name)\n                      (file-truename (doom-modeline-project-root)))" ((:colname-names) (:rowname-names) (:result-params "replace") (:result-type . value) (:results . "replace") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:lexical . "no") (:async)) "" nil 859 "(ref:%s)") 'nil '"emacs-lisp") (run-hooks 'org-babel-after-execute-hook))))) (async-signal (wrong-type-argument stringp nil)) #<buffer *emacs*>)
  async-when-done(#<process emacs> "finished\n")
astahlman commented 5 years ago

Can you elaborate on:

Expected Behavior

Output correct results

I get a similar error when running this file without ob-async when I'm in a scratch buffer.

Also:

[ x ] I've included a link to a Github Gist with the full contents of my troubleshooting.org buffer

I don't see the link - am I missing it?

stardiviner commented 5 years ago

I got similar issue. Here is my simple source code block.

#+NAME: Official Arch Linux base image
#+begin_src sh
docker pull archlinux/base
#+end_src

#+RESULTS: Official Arch Linux base image
: 3b99bc99cbdb8682c308b3b41f8820bc

I put the troubleshooting.org in Gist: https://gist.github.com/stardiviner/6c4d09c66dece246795bb1d677e40322

stardiviner commented 5 years ago

BTW, Org Mode has a way to run all source blocks bellowing headline at point with [C-c C-v C-s]. This is similar with run multiple async source blocks I think.

stardiviner commented 5 years ago

I guess my issue might related to option (setq org-babel-hash-show-time t).

stardiviner commented 5 years ago

Any idea about this problem? @astahlman

astahlman commented 5 years ago

@stardiviner Your troubleshooting.org Gist is using the same source block as in the original report, right? i.e., this one:

#+BEGIN_SRC emacs-lisp
  (sleep-for 3)
  (file-relative-name (file-name-directory buffer-file-name)
                      (file-truename (doom-modeline-project-root)))
  (message "Hello, Elisp!")
#+END_SRC

Again, that fails without the :async flag set, so I don't think the problem is with this package. I can't run your other example because I don't have docker installed.

Closing this one for now, but I'll be happy to take another look if someone can provide a reproducible example that works without the :async flag set and doesn't require any heavy dependencies (e.g., Docker)