From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dushyant Juneja Subject: Re: org-babel python eval discrepancy Date: Thu, 03 Aug 2017 18:54:06 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1148e42e563dae0555dde8fa" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddLGF-0006Ur-Qs for emacs-orgmode@gnu.org; Thu, 03 Aug 2017 14:54:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddLGF-0008OA-3l for emacs-orgmode@gnu.org; Thu, 03 Aug 2017 14:54:19 -0400 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:32832) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddLGE-0008NT-SM for emacs-orgmode@gnu.org; Thu, 03 Aug 2017 14:54:19 -0400 Received: by mail-wm0-x235.google.com with SMTP id k20so6730425wmg.0 for ; Thu, 03 Aug 2017 11:54:18 -0700 (PDT) In-Reply-To: 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: Dov Grobgeld Cc: emacs-orgmode --001a1148e42e563dae0555dde8fa Content-Type: text/plain; charset="UTF-8" Hey Dov, Bull's eye! Never realized that could hurt. It so happened that I set the correct python version in my shell before starting emacs. However, my bashrc file was hardwired to a different version, which org used every time for evaluating the src blocks. Thanks for the help! Dushyant On Thu, Aug 3, 2017 at 2:22 PM Dov Grobgeld wrote: > Shell is using python3 and org-mode python2? > > On Aug 3, 2017 8:31 PM, "Dushyant Juneja" > wrote: > >> Hi, >> >> I have the following code block in my org mode based literate programming >> notes: >> >> #+BEGIN_SRC python >> print('1+2 > 4 is ', 1+2 > 4) >> print("What is 3 + 2?", 3 + 2) >> #+END_SRC >> >> When I tangle it and run the script, it gives me expected output as >> follows: >> >> > python notes.py >> 1+2 > 4 is False >> What is 3 + 2? 5 >> >> However, in buffer evaluation (using =C-c C-c= with cursor on src block) >> gives me the following output, which seems unexpected: >> >> #+BEGIN_SRC python >> print('1+2 > 4 is ', 1+2 > 4) >> print("What is 3 + 2?", 3 + 2) >> #+END_SRC >> >> #+RESULTS: >> : ('1+2 > 4 is ', False) >> : ('What is 3 + 2?', 5) >> >> Any hints what may be going wrong? >> >> Dushyant >> > --001a1148e42e563dae0555dde8fa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hey Dov,

Bull's eye! Never realized= that could hurt.

It so happened that I set the correct = python version in my shell before starting emacs. However, my bashrc file w= as hardwired to a different version, which org used every time for evaluati= ng the src blocks.

Thanks for the help!
= Dushyant

On Thu, Aug 3, = 2017 at 2:22 PM Dov Grobgeld <= dov.grobgeld@gmail.com> wrote:
Shell is using python3 and org-mode python2?

On Aug 3, 2017 8:31 P= M, "Dushyant Juneja" <juneja.dushyant@gmail.com> wrote:
Hi,

I have the following code block in my org mode based literate prog= ramming notes:

#+BEG= IN_SRC python=C2=A0
print('1+= 2 > 4 is ', 1+2 > 4)
pr= int("What is 3 + 2?", 3 + 2)
#+END_SRC

When I tangle it and = run the script, it gives me expected output as follows:

> python notes.py=C2=A0
=
1+2 > 4 is =C2=A0False
What is 3 + 2? 5

However, in buffer evaluation (using =3DC-c C-c=3D with cursor on src bl= ock) gives me the following output, which seems unexpected:

<= /div>
#+BEGIN_SRC python=C2=A0
print('1+2 > 4 is ', 1+2 > 4)=
print("What is 3 + 2?"= , 3 + 2)
#+END_SRC

= #+RESULTS:
: ('1+2 > 4 is = ', False)
: ('What is= 3 + 2?', 5)

Any hints what may b= e going wrong?

Dushyant
--001a1148e42e563dae0555dde8fa--