emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] ob-python: Fix python session initialization
@ 2015-09-30  8:01 Grégoire Jadi
  2015-09-30  8:26 ` Grégoire Jadi
  0 siblings, 1 reply; 3+ messages in thread
From: Grégoire Jadi @ 2015-09-30  8:01 UTC (permalink / raw)
  To: Orgmode

[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]

Hi,

There is a bug in ob-python, the parameters aren't used to initialize
the session. Here is a patch that fixes it.

OK to push ?

* lisp/ob-python.el (org-babel-execute:python): Send params to `org-babel-python-initiate-session'.

It was not possible to configure the sesssion with custom parameters.
For example, the python interpreter with :python
> BEGIN_SRC python :session my-session :python ipython
---
 lisp/ob-python.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 3a9b8f6..f2e6f66 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -74,7 +74,7 @@ This will typically be either `python' or `python-mode'."
   "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
-		   (cdr (assoc :session params))))
+		   (cdr (assoc :session params)) params))
          (result-params (cdr (assoc :result-params params)))
          (result-type (cdr (assoc :result-type params)))
 	 (return-val (when (and (eq result-type 'value) (not session))
-- 

-- 
Grégoire Jadi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ob-python: Fix python session initialization
  2015-09-30  8:01 [PATCH] ob-python: Fix python session initialization Grégoire Jadi
@ 2015-09-30  8:26 ` Grégoire Jadi
  2015-10-29 14:08   ` Aaron Ecay
  0 siblings, 1 reply; 3+ messages in thread
From: Grégoire Jadi @ 2015-09-30  8:26 UTC (permalink / raw)
  To: Orgmode

[-- Attachment #1: Type: text/plain, Size: 1499 bytes --]


Grégoire Jadi writes:

> Hi,
>
> There is a bug in ob-python, the parameters aren't used to initialize
> the session. Here is a patch that fixes it.

Err, discard this. It's not enough to fix the bug since
`org-babel-python-initiate-session' doesn't use the params either. I'll
come back later with a correct patch (unless someone else is faster ;)).

Sorry for the noise.

Cheers

> OK to push ?
>
> * lisp/ob-python.el (org-babel-execute:python): Send params to `org-babel-python-initiate-session'.
>
> It was not possible to configure the sesssion with custom parameters.
> For example, the python interpreter with :python
>> BEGIN_SRC python :session my-session :python ipython
> ---
>  lisp/ob-python.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/ob-python.el b/lisp/ob-python.el
> index 3a9b8f6..f2e6f66 100644
> --- a/lisp/ob-python.el
> +++ b/lisp/ob-python.el
> @@ -74,7 +74,7 @@ This will typically be either `python' or `python-mode'."
>    "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
> -		   (cdr (assoc :session params))))
> +		   (cdr (assoc :session params)) params))
>           (result-params (cdr (assoc :result-params params)))
>           (result-type (cdr (assoc :result-type params)))
>  	 (return-val (when (and (eq result-type 'value) (not session))
> -- 

-- 
Grégoire Jadi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ob-python: Fix python session initialization
  2015-09-30  8:26 ` Grégoire Jadi
@ 2015-10-29 14:08   ` Aaron Ecay
  0 siblings, 0 replies; 3+ messages in thread
From: Aaron Ecay @ 2015-10-29 14:08 UTC (permalink / raw)
  To: Grégoire Jadi, Orgmode

Hi Grégoire,

I’ve looked at ‘org-babel-python-initiate-session’ and I can’t see an
obvious bug.  Did you come up with a patch to fix the problems you were
seeing?

Thanks,

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-29 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-30  8:01 [PATCH] ob-python: Fix python session initialization Grégoire Jadi
2015-09-30  8:26 ` Grégoire Jadi
2015-10-29 14:08   ` Aaron Ecay

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).