Function: org-babel-python-evaluate-external-process

org-babel-python-evaluate-external-process is a byte-compiled function defined in ob-python.el.gz.

Signature

(org-babel-python-evaluate-external-process BODY &optional RESULT-TYPE RESULT-PARAMS PREAMBLE)

Documentation

Evaluate BODY in external python process.

If RESULT-TYPE equals output then return standard output as a string. If RESULT-TYPE equals value then return the value of the last statement in BODY, as elisp.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ob-python.el.gz
(defun org-babel-python-evaluate-external-process
    (body &optional result-type result-params preamble)
  "Evaluate BODY in external python process.
If RESULT-TYPE equals `output' then return standard output as a
string.  If RESULT-TYPE equals `value' then return the value of the
last statement in BODY, as elisp."
  (let ((raw
         (pcase result-type
           (`output (org-babel-eval org-babel-python-command
				    (concat preamble (and preamble "\n")
					    body)))
           (`value (let ((tmp-file (org-babel-temp-file "python-")))
		     (org-babel-eval
		      org-babel-python-command
		      (concat
		       preamble (and preamble "\n")
		       (format
			(if (member "pp" result-params)
			    org-babel-python-pp-wrapper-method
			  org-babel-python-wrapper-method)
			(org-babel-python--shift-right body)
			(org-babel-process-file-name tmp-file 'noquote))))
		     (org-babel-eval-read-file tmp-file))))))
    (org-babel-result-cond result-params
      raw
      (org-babel-python-table-or-string (org-trim raw)))))