emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-babel -- Improper syntax error in session mode?


From: Eric Schulte
Subject: Re: [O] org-babel -- Improper syntax error in session mode?
Date: Mon, 20 Jun 2011 14:15:22 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Herbert Sitz <address@hidden> writes:

> Eric Schulte <schulte.eric <at> gmail.com> writes:
>> I've changed the python session evaluation so that it explicitly sends a
>> RET to the inferior Python process after every line of input.  The
>> attached patch makes this change.  
>
>> I can confirm that this fixes the
>> problem in your example (when an empty line is placed between the block
>> and the subsequent print statement)
>
> Eric --
>
> I did confirm that the patch works with this block:
> ------------------------------------------------
> #+begin_src python :results output :session mypy 
>     x = 1
>     for i in range(1,5):
>         x = x + i
>         print x
>
>     print "Did it work?"
> #+end_src
> ------------------------------------------------
>
> But it doesn't work with the block below, which _is_ valid Python code.

As far as I can tell the problem with the block below (missing the
space) is due to problems with the Python interpreter.

[...]

> ----------------------------------------------
> #+begin_src python :results output :session mypy 
>     x = 1
>     for i in range(1,5):
>         x = x + i
>         print x
>     print "Did it work?"
> #+end_src
> -------------------------------------------

[...]

>
> I hope I'm not confusing things.

No worries, however, I maintain that it is beyond the scope of Babel's
Python interaction to address examples such as the one given above which
do not work when typed into the Python verbatim session by the user.

> The patch does help, but doesn't address the extra-line insertion
> issue.
>

Fair enough.

Does it work for other "normal" Python interactive code blocks?  Have
you noticed any places where the previous version worked but the new
version doesn't?  If it seems safe then I would like to apply it.

Best -- Eric

>
> -- Herb
>
>
>
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



reply via email to

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