From mboxrd@z Thu Jan 1 00:00:00 1970 From: Myles English Subject: wrong python version when using :session Date: Mon, 05 Sep 2011 18:28:08 +0100 Message-ID: <87liu2x5jr.fsf@bill.home> Reply-To: emacs-orgmode@gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:37996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0cx4-0006r1-QV for emacs-orgmode@gnu.org; Mon, 05 Sep 2011 13:27:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0cx3-0002zc-KC for emacs-orgmode@gnu.org; Mon, 05 Sep 2011 13:27:18 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:47054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0cx3-0002zN-Ec for emacs-orgmode@gnu.org; Mon, 05 Sep 2011 13:27:17 -0400 Received: by wwj26 with SMTP id 26so124850wwj.0 for ; Mon, 05 Sep 2011 10:27:16 -0700 (PDT) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hello, When a python source block has a :session header argument, the python version selected does not appear to respect the value of the variable org-babel-python-command. Starting emacs with this in the init file (.emacs): (require 'org-install) (org-babel-do-load-languages 'org-babel-load-languages '((python . t) )) (setq org-babel-python-command "python2") And in my org file: #+begin_src python :results output import sys print(sys.version) #+end_src #+results: : 2.7.2 (default, Jun 29 2011, 11:10:00) : [GCC 4.6.1] Now, exactly the same but with ":session x" header argument: #+begin_src python :results output :session x import sys print(sys.version) #+end_src #+results: : : 3.2.1 (default, Jul 11 2011, 12:37:47) : [GCC 4.6.1] So babel has chosen to use Python 3.2 When I wanted to use Python 2.7, as in the first block, and the value of org-babel-python-command is still "python2". Part of the documentation for the variable python-python-command is: "Shell command to run Python interpreter". On my system to run the Python 2.7 interpreter I would do: $ python2 at the command line so, setting this variable thus: #+begin_src elisp (setq python-python-command "python2") #+end_src #+results: : python2 and then using the two examples from above again gives the same (correct) results for the block without the :session header argument: #+begin_src python :results output import sys print(sys.version) #+end_src #+results: : 2.7.2 (default, Jun 29 2011, 11:10:00) : [GCC 4.6.1] but a different error for the block with the session argument: #+begin_src python :results output :session x import sys print(sys.version) #+end_src results in the message: "python-check-version: Only Python versions >= 2.2 and < 3.0 are supported" Versions on my system are: orgmode commit cae9f947be (Aug 30th) GNU Emacs 23.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.22.1) of 2011-03-10 on bitzer.hoetzel.info $ ls -l `which python{2,3,}` /usr/bin/python -> python3 /usr/bin/python2 -> python2.7 /usr/bin/python3 Am I doing something wrong or is this a bug? I am wondering if it is reasonable to expect emacs/orgmode to be able to deal with the fact that I have Python 3 installed. Thanks, Myles