emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [PATCH] Honor the :python header argument in python src-blocks


From: Nathaniel Nicandro
Subject: [O] [PATCH] Honor the :python header argument in python src-blocks
Date: Thu, 27 Apr 2017 19:04:25 -0500
User-agent: mu4e 0.9.18; emacs 25.1.1

Hello,

This is my first post to the mailing list and I just wanted to say thank all of you for making such a great piece of code!
Below is a patch that should fix the problem where a python session was
being initiated without first checking the :python header argument.

--- PATCH ---

From a721c97924b5b965179a2dd90e54d63c7de00317 Mon Sep 17 00:00:00 2001
From: Nathaniel Nicandro <address@hidden>
Date: Thu, 27 Apr 2017 18:16:41 -0500
Subject: [PATCH] Honor the :python header argument in python src-blocks

* lisp/ob-python.el (org-babel-execute:python):
`org-babel-python-command` should be set before calling
`org-babel-python-initiate-session`.

TINYCHANGE
---
lisp/ob-python.el | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index b838a48..f533658 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -73,15 +73,15 @@ This will typically be either `python' or `python-mode'."
(defun org-babel-execute:python (body params)
  "Execute a block of Python code with Babel.
This function is called by `org-babel-execute-src-block'."
-  (let* ((session (org-babel-python-initiate-session
+  (let* ((org-babel-python-command
+          (or (cdr (assq :python params)) org-babel-python-command))
+         (session (org-babel-python-initiate-session
          (cdr (assq :session params))))
         (result-params (cdr (assq :result-params params)))
         (result-type (cdr (assq :result-type params)))
         (return-val (when (and (eq result-type 'value) (not session))
                       (cdr (assq :return params))))
         (preamble (cdr (assq :preamble params)))
-         (org-babel-python-command
-          (or (cdr (assq :python params)) org-babel-python-command))
         (full-body
          (org-babel-expand-body:generic
          (concat body (if return-val (format "\nreturn %s" return-val) ""))
--
2.3.8



reply via email to

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