From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shiyuan Subject: Re: babel python example not reproducible Date: Sun, 15 Jun 2014 22:59:26 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bdc853cce12c904fbedba17 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwPx3-00040t-6o for emacs-orgmode@gnu.org; Mon, 16 Jun 2014 01:59:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwPx2-0000km-2s for emacs-orgmode@gnu.org; Mon, 16 Jun 2014 01:59:29 -0400 Received: from mail-vc0-x236.google.com ([2607:f8b0:400c:c03::236]:49426) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwPx1-0000kh-Tk for emacs-orgmode@gnu.org; Mon, 16 Jun 2014 01:59:28 -0400 Received: by mail-vc0-f182.google.com with SMTP id il7so4478242vcb.13 for ; Sun, 15 Jun 2014 22:59:26 -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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Doyley, Marvin" Cc: emacs-orgmode@gnu.org --047d7bdc853cce12c904fbedba17 Content-Type: text/plain; charset=UTF-8 The two setting doesn't seem to have effect. (setq python-shell-interpreter "ipython") (setq python-shell-interpreter-args "--pylab") When I did `C-c C-c` on the SRC block to execute the code, emacs created a buffer with the interior python process. When I switched to the process, I saw it is python 2.5.3, not ipython. Also, it looks like the problem is with the shell interpreter. If I enter command directly in the shell buffer, the shell buffer will echo command itself and then the result. >>> print "Hello" print "Hello" Hello. Is there any setting to control this shell behavior? Can I make the python shell not echo the command? Thanks. On Wed, Jun 11, 2014 at 12:48 AM, Doyley, Marvin wrote: > Works for me, see example below > #+BEGIN_SRC python :results output :session foo > > x=100 > print "hello" > 2 > print "bye" > #+END_SRC > > #+RESULTS: > : > : >>> hello > : 2 > : bye > > #+BEGIN_SRC python :results output :session foo > > print "hello good bye" > print "Printing value from previous session", x > #+END_SRC > > #+RESULTS: > : > : hello good bye > : Printing value from previous session 100 > > The only difference is that I like to give my session a name and for > what it is worth I am using ipython (don't think this will make a > difference). You can do this including the > following statement in your .emacs file > > (setq python-shell-interpreter "ipython") > (setq python-shell-interpreter-args "--pylab") > > Hope this help. > Cheers, > M > > > --047d7bdc853cce12c904fbedba17 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The two setting doesn't seem to have effect. =C2= =A0
(setq python-shell-interpreter "ipython")
(setq pytho= n-shell-interpreter-args "--pylab")
Whe= n I did `C-c C-c` on the SRC block to execute the code, emacs created a buf= fer with the interior python process. When I switched to the process, I saw= it is python 2.5.3, not ipython. =C2=A0

Also, it lo= oks like the problem is with the shell interpreter. If I enter command dire= ctly in the shell buffer, the shell buffer will echo command itself and the= n the result.=C2=A0

>>>= ; print "Hello"
print "Hello= "
Hello.=C2=A0

Is there any setting to control this shell= behavior? Can I make the python shell not echo the command? Thanks. =C2=A0=


On Wed,= Jun 11, 2014 at 12:48 AM, Doyley, Marvin <mdoyley@ur.rochester.edu= > wrote:
Works for me, see example below
#+BEGIN_SRC python :results output :session foo

x=3D100
print "hello"
2
print "bye"
#+END_SRC

#+RESULTS:
:
: >>> hello
: 2
: bye

#+BEGIN_SRC python :results output :session foo

print "hello good bye"
print "Printing value from previous session", x
#+END_SRC

#+RESULTS:
:
: hello good bye
: Printing value from previous session 100

The only difference is that I like to give my session a name and for
what it is worth I am using ipython (don't think this will make a diffe= rence). You can do this including the
following statement in your .emacs file

(setq python-shell-interpreter "ipython")
(setq python-shell-interpreter-args "--pylab")

Hope this help.
Cheers,
M



--047d7bdc853cce12c904fbedba17--