emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Extraneous output from Python code blocks using :session option


From: John Kitchin
Subject: Re: [O] Extraneous output from Python code blocks using :session option
Date: Thu, 12 Mar 2015 11:17:35 -0400

Nice. I hope this makes it into org-mode one day.

In the mean time, I crafted an approach with another hook function that
is described here:

http://kitchingroup.cheme.cmu.edu/blog/2015/03/12/Making-org-mode-Python-sessions-look-better/

This can be done in an init file.

Kyle Meyer writes:

> Richard Stanton <address@hidden> wrote:
>> I'm trying to use the :session option so I can import modules, etc.,
>> just once at the beginning of my document, like with am IPython
>> notebook. Unfortunately, the output from these code blocks contains
>> some extraneous characters. For example:
>>
>> #+BEGIN_SRC python :session :results output
>> a = 2
>> b = 3
>> c = 4
>> print 'a=      ', a
>> print 'b =     ', b
>> print 'a + b = ', a+b
>> #+END_SRC
>>
>> #+RESULTS:
>> :
>> : >>> >>> a=       2
>> : b =      3
>> : a + b =  5
>
> I also see this behavior.  I asked the list some time ago [1], but I
> didn't follow up beyond the initial email.
>
>> How can I stop the production of all those ">" signs (sometimes
>> they're dots), which don't appear if I run the same code block without
>> the :session option?
>
> I've attached a patch that seems to fix the example you gave and the
> cases from my earlier email.  I don't know enough about babel's
> internals to know if it is a good way to fix it, but at least it might
> serve as a quick fix for you until there is a better solution.
>
> [1] http://thread.gmane.org/gmane.emacs.orgmode/79014

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]