From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: org-babel -- Improper syntax error in session mode? Date: Mon, 20 Jun 2011 14:15:22 -0700 Message-ID: <87aadcxl05.fsf@gmail.com> References: <87k4chwgpa.fsf@gmail.com> <23747.1308539849@alphaville.dokosmarshall.org> <87ei2ouwxk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:40379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYlof-0003iO-3W for emacs-orgmode@gnu.org; Mon, 20 Jun 2011 17:15:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYlod-0000Bk-7f for emacs-orgmode@gnu.org; Mon, 20 Jun 2011 17:15:28 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:64817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYloc-0000BN-LQ for emacs-orgmode@gnu.org; Mon, 20 Jun 2011 17:15:26 -0400 Received: by pvc12 with SMTP id 12so1481664pvc.0 for ; Mon, 20 Jun 2011 14:15:25 -0700 (PDT) In-Reply-To: (Herbert Sitz's message of "Mon, 20 Jun 2011 20:45:05 +0000 (UTC)") 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: Herbert Sitz Cc: emacs-orgmode@gnu.org Herbert Sitz writes: > Eric Schulte 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/