From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [Babel] (wrong-type-argument char-or-string-p nil) when shell error Date: Fri, 15 Oct 2010 09:25:59 -0600 Message-ID: <87pqvbh3zs.fsf@gmail.com> References: <807hhj8pv3.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=39856 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6mAY-00081a-Ru for emacs-orgmode@gnu.org; Fri, 15 Oct 2010 11:26:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6mAX-00033i-CU for emacs-orgmode@gnu.org; Fri, 15 Oct 2010 11:26:06 -0400 Received: from mail-yw0-f41.google.com ([209.85.213.41]:39944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6mAX-00033e-8E for emacs-orgmode@gnu.org; Fri, 15 Oct 2010 11:26:05 -0400 Received: by ywh1 with SMTP id 1so627712ywh.0 for ; Fri, 15 Oct 2010 08:26:04 -0700 (PDT) In-Reply-To: <807hhj8pv3.fsf@mundaneum.com> (=?utf-8?Q?=22S=C3=A9bastien?= Vauban"'s message of "Fri, 15 Oct 2010 16:58:24 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?S=C3=A9bastien?= Vauban Cc: emacs-orgmode@gnu.org Tested and Fixed. Thanks -- Eric S=C3=A9bastien Vauban writes: > Hi Eric and Dan, > > * Getting messages from stderr > > #+begin_src sh > ls NoSuchFileOrDirectory.txt > #+end_src > > results in > > : ls: cannot access NoSuchFileOrDirectory.txt: No such file or directory > > in *Org-Babel Error Output*, and > > #+begin_src emacs-lisp > Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil) > insert(nil) > (save-current-buffer (set-buffer temp-buffer) (insert results)) > (with-current-buffer temp-buffer (insert results)) > (prog1 (with-current-buffer temp-buffer (insert results)) (with-current= -buffer temp-buffer (write-region nil nil temp-file nil 0))) > (unwind-protect (prog1 (with-current-buffer temp-buffer ...) (with-curr= ent-buffer temp-buffer ...)) (and (buffer-name temp-buffer) (kill-buffer te= mp-buffer))) > (let ((temp-file tmp-file) (temp-buffer ...)) (unwind-protect (prog1 ..= . ...) (and ... ...))) > (with-temp-file tmp-file (insert results)) > (let ((tmp-file ...)) (with-temp-file tmp-file (insert results)) (org-b= abel-import-elisp-from-file tmp-file)) > (if (or (member "scalar" result-params) (member "output" result-params)= ) results (let (...) (with-temp-file tmp-file ...) (org-babel-import-elisp-= from-file tmp-file))) > (lambda (results) (if (or ... ...) results (let ... ... ...)))(nil) > org-babel-sh-evaluate(nil "ls NoSuchFileOrDirectory.txt\n\n\n" ("replac= e")) > (org-babel-reassemble-table (org-babel-sh-evaluate session full-body re= sult-params) (org-babel-pick-name (nth 4 processed-params) (cdr ...)) (org-= babel-pick-name (nth 5 processed-params) (cdr ...))) > (let* ((processed-params ...) (session ...) (result-params ...) (full-b= ody ...)) (org-babel-reassemble-table (org-babel-sh-evaluate session full-b= ody result-params) (org-babel-pick-name ... ...) (org-babel-pick-name ... .= ..))) > org-babel-execute:sh("ls NoSuchFileOrDirectory.txt\n" ((:cache . "no") = (:comments . "") (:exports . "code") (:hlines . "no") (:noweb . "no") (:res= ults . "replace") (:session . "none") (:shebang . "") (:tangle . "no"))) > funcall(org-babel-execute:sh "ls NoSuchFileOrDirectory.txt\n" ((:cache = . "no") (:comments . "") (:exports . "code") (:hlines . "no") (:noweb . "no= ") (:results . "replace") (:session . "none") (:shebang . "") (:tangle . "n= o"))) > (setq result (funcall cmd body params)) > (if (and (not arg) new-hash (equal new-hash old-hash)) (save-excursion = (goto-char ...) (end-of-line 1) (forward-char 1) (setq result ...) (message= ...) result) (message "executing %s code block%s..." (capitalize lang) (if= ... ... "")) (setq result (funcall cmd body params)) (if (eq result-type .= ..) (setq result ...)) (org-babel-insert-result result result-params info n= ew-hash indent lang) (run-hooks (quote org-babel-after-execute-hook)) resul= t) > (progn (fset (quote call-process-region) (function* ...)) (unless (fbou= ndp cmd) (error "No org-babel-execute function for %s!" lang)) (if (and ...= new-hash ...) (save-excursion ... ... ... ... ... result) (message "execut= ing %s code block%s..." ... ...) (setq result ...) (if ... ...) (org-babel-= insert-result result result-params info new-hash indent lang) (run-hooks ..= .) result)) > (unwind-protect (progn (fset ... ...) (unless ... ...) (if ... ... ... = ... ... ... ... result)) (if --cl-letf-bound-- (fset ... --cl-letf-save--) = (fmakunbound ...))) > (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...)) (unwind-protect = (progn ... ... ...) (if --cl-letf-bound-- ... ...))) > (letf ((... ...)) (unless (fboundp cmd) (error "No org-babel-execute fu= nction for %s!" lang)) (if (and ... new-hash ...) (save-excursion ... ... .= .. ... ... result) (message "executing %s code block%s..." ... ...) (setq r= esult ...) (if ... ...) (org-babel-insert-result result result-params info = new-hash indent lang) (run-hooks ...) result)) > (letf* ((... ...)) (unless (fboundp cmd) (error "No org-babel-execute f= unction for %s!" lang)) (if (and ... new-hash ...) (save-excursion ... ... = ... ... ... result) (message "executing %s code block%s..." ... ...) (setq = result ...) (if ... ...) (org-babel-insert-result result result-params info= new-hash indent lang) (run-hooks ...) result)) > (flet ((call-process-region ... ...)) (unless (fboundp cmd) (error "No = org-babel-execute function for %s!" lang)) (if (and ... new-hash ...) (save= -excursion ... ... ... ... ... result) (message "executing %s code block%s.= .." ... ...) (setq result ...) (if ... ...) (org-babel-insert-result result= result-params info new-hash indent lang) (run-hooks ...) result)) > (unwind-protect (flet (...) (unless ... ...) (if ... ... ... ... ... ..= . ... result)) (setq call-process-region (quote org-babel-call-process-regi= on-original))) > (let* ((lang ...) (params ...) (new-hash ...) (old-hash ...) (body ...)= (result-params ...) (result-type ...) (cmd ...) (dir ...) (default-directo= ry ...) (org-babel-call-process-region-original ...) (indent ...) result) (= unwind-protect (flet ... ... ...) (setq call-process-region ...))) > (progn (let* (... ... ... ... ... ... ... ... ... ... ... ... result) (= unwind-protect ... ...))) > (if (org-babel-confirm-evaluate info) (progn (let* ... ...))) > (when (org-babel-confirm-evaluate info) (let* (... ... ... ... ... ... = ... ... ... ... ... ... result) (unwind-protect ... ...))) > (let ((info ...)) (when (org-babel-confirm-evaluate info) (let* ... ...= ))) > org-babel-execute-src-block(nil ("sh" "ls NoSuchFileOrDirectory.txt\n" = ((:cache . "no") (:comments . "") (:exports . "code") (:hlines . "no") (:no= web . "no") (:results . "replace") (:session . "none") (:shebang . "") (:ta= ngle . "no")) "" nil nil 0)) > (progn (org-babel-execute-src-block current-prefix-arg info) t) > (if info (progn (org-babel-execute-src-block current-prefix-arg info) t= ) nil) > (let ((info ...)) (if info (progn ... t) nil)) > org-babel-execute-src-block-maybe() > (or (org-babel-execute-src-block-maybe) (org-babel-lob-execute-maybe)) > org-babel-execute-maybe() > call-interactively(org-babel-execute-maybe) > (cond ((commandp org-speed-command) (setq this-command org-speed-comman= d) (call-interactively org-speed-command)) ((functionp org-speed-command) (= funcall org-speed-command)) ((and org-speed-command ...) (eval org-speed-co= mmand)) (t (let ... ...))) > (cond ((and org-use-speed-commands ...) (cond ... ... ... ...)) ((and .= .. ... ... ...) (let ... ... ... ... ...)) (t (setq org-table-may-need-upda= te t) (self-insert-command N) (org-fix-tags-on-the-fly) (if org-self-insert= -cluster-for-undo ...))) > org-self-insert-command(1) > call-interactively(org-self-insert-command nil nil) > #+end_src > > Best regards, > Seb