From mboxrd@z Thu Jan 1 00:00:00 1970 From: William Henney Subject: Re: Mixing Python2 and Python3 blocks in one file Date: Tue, 17 May 2016 09:24:32 -0500 Message-ID: References: <2016-05-08T10-21-00@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec5055339f15f5e05330a7f9c Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2fvI-0000Zv-BU for emacs-orgmode@gnu.org; Tue, 17 May 2016 10:24:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2fvF-0000VQ-SC for emacs-orgmode@gnu.org; Tue, 17 May 2016 10:24:35 -0400 Received: from mail-ig0-x22a.google.com ([2607:f8b0:4001:c05::22a]:37399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2fvF-0000VE-KU for emacs-orgmode@gnu.org; Tue, 17 May 2016 10:24:33 -0400 Received: by mail-ig0-x22a.google.com with SMTP id s8so10575689ign.0 for ; Tue, 17 May 2016 07:24:33 -0700 (PDT) In-Reply-To: <2016-05-08T10-21-00@devnull.Karl-Voit.at> 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: Karl Voit Cc: emacs-org --bcaec5055339f15f5e05330a7f9c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Karl On Sun, May 8, 2016 at 3:31 AM, Karl Voit wrote: Python2 and Python3 are two different languages. Unfortunately, > Org-mode only uses ~#+BEGIN_SRC python~ for both and uses > python-shell-interpreter to choose/switch the compiler. > > Shouldn't Org-mode introduce ~#+BEGIN_SRC python2~ and ~#+BEGIN_SRC > python3~ to solve this issue in a clean way? > > ~#+BEGIN_SRC python~ can still default to python2. > > > You can use the :python header argument to the source block, which allows you to specify the path to the python interpreter: =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94 BEGIN EXAMPLE =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94 * Default python version #+name: check-python-version #+BEGIN_SRC python import sys return sys.version #+END_SRC #+RESULTS: check-python-version : 3.4.4 |Anaconda 2.5.0 (x86_64)| (default, Jan 9 2016, 17:30:09) : [GCC 4.2.1 (Apple Inc. build 5577)] This is the control experiment. * Custom python version #+BEGIN_SRC python :python /Users/will/anaconda/envs/py27/bin/python import sys return sys.version #+END_SRC #+RESULTS: : 2.7.11 |Continuum Analytics, Inc.| (default, Dec 6 2015, 18:57:58) : [GCC 4.2.1 (Apple Inc. build 5577)] =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94 END EXAMPLE =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94 Also see original discussion at https://lists.gnu.org/archive/html/emacs-orgmode/2014-04/msg01042.html Will > I only found those sources/solutions: > > http://thread.gmane.org/gmane.emacs.orgmode/47867 > ... file-variables to choose interpretor > > http://thread.gmane.org/gmane.emacs.orgmode/47867 > ... workaround with #+srcname (I don't get yet) > > > -- > mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: > > get Memacs from https://github.com/novoid/Memacs < > > https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on > github > > > --=20 Dr William Henney, Instituto de Radioastronom=C3=ADa y Astrof=C3=ADsica, Universidad Nacional Aut=C3=B3noma de M=C3=A9xico, Campus Morelia --bcaec5055339f15f5e05330a7f9c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Karl

On Sun, May 8, 2016 at 3:31 AM, Karl Voit <devnull@karl-voit.at<= /a>> wrote:

Python2 and Python3 are two different languages. Unfortunately,
Org-mode only uses ~#+BEGIN_SRC python~ for both and uses
python-shell-interpreter to choose/switch the compiler.

Shouldn't Org-mode introduce ~#+BEGIN_SRC python2~ and ~#+BEGIN_SRC
python3~ to solve this issue in a clean way?

~#+BEGIN_SRC python~ can still default to python2.








I only found those sources/solutions:

http://thread.gmane.org/gmane.emacs.orgmode/47867
... file-variables to choose interpretor

http://thread.gmane.org/gmane.emacs.orgmode/47867
... workaround with #+srcname (I don't get yet)


--
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
=C2=A0 =C2=A0 =C2=A0 =C2=A0> get Memacs from
https://github.com/n= ovoid/Memacs <

https://github.com/novoid/extract_pdf_an= notations_to_orgmode + more on github





--

=C2=A0 Dr William Henney, Instituto de Rad= ioastronom=C3=ADa y Astrof=C3=ADsica,
=C2=A0 Universidad Nacional Aut=C3= =B3noma de M=C3=A9xico, Campus Morelia
--bcaec5055339f15f5e05330a7f9c--