From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathaniel Nicandro Subject: [PATCH] Honor the :python header argument in python src-blocks Date: Thu, 27 Apr 2017 19:04:25 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3tOj-00056Z-1z for emacs-orgmode@gnu.org; Thu, 27 Apr 2017 20:04:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3tOe-0000Fp-UH for emacs-orgmode@gnu.org; Thu, 27 Apr 2017 20:04:33 -0400 Received: from mail-5.cc.uic.edu ([128.248.156.155]:33855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3tOe-0000Ez-OR for emacs-orgmode@gnu.org; Thu, 27 Apr 2017 20:04:28 -0400 Received: from pegasus (c-98-220-96-179.hsd1.il.comcast.net [98.220.96.179]) (authenticated bits=0) by mail-5.cc.uic.edu (8.14.4/8.14.4) with ESMTP id v3S04PMY019433 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 27 Apr 2017 19:04:27 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: org mode 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 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