From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: Re: org-babel -- Improper syntax error in session mode? Date: Tue, 21 Jun 2011 02:48:18 +0530 Message-ID: <818vsw19t1.fsf@gmail.com> References: <87k4chwgpa.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:38450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYlqm-0004XX-GU for emacs-orgmode@gnu.org; Mon, 20 Jun 2011 17:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYlqk-0000gw-W3 for emacs-orgmode@gnu.org; Mon, 20 Jun 2011 17:17:40 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:50449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYlqk-0000gO-FQ for emacs-orgmode@gnu.org; Mon, 20 Jun 2011 17:17:38 -0400 Received: by mail-pv0-f169.google.com with SMTP id 12so1483448pvc.0 for ; Mon, 20 Jun 2011 14:17:37 -0700 (PDT) In-Reply-To: (Herbert Sitz's message of "Mon, 20 Jun 2011 02:12:32 +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 Discalimer: I neither use python or babel. > Eric Schulte gmail.com> writes: >> I can confirm that I see the same behavior. Also, if I manually type >> the body of the code block into the session I get the same error output >> from Python, so I don't believe this is due to a problem with Babel. >> > > It appears the problem is that the python session is interactive and > is built to emit output after each Python "block" (e.g., the 'for' > block), before another "block" of Python is entered. > If this is the way it's designed ISTM you are speculating on design based on a very simple example and just this "specific implementation". > then it seems to me that it's Babel's obligation to feed the Python > blocks to the Python session as required and then assemble the output > pieces as appropriate. Or am I missing something? -- Herb There is a difference between feeding an interactive shell by hand and feeding interactive shell via a program (The latter one is very fast). The behaviour pertaining to buffering and flusing of output buffers would not be apparent unless large volumes of output text is spewed. The assumption that is being made in this thread is that: "Python interpreter blocks until *all* output are *appears at the* console before moving on to the next block." While it is reasonable to assume that Python interpreter *flushes the output buffers" it seems a bit too far-fetched to me to assume that python interpreter can *guarantee" the appearance of the spewed block before proceeding to the next block. Unless python spec clearly and *positively* confirms the behaviour you are assuming in *all* compliant-implementations, it is generally a good idea to be conservative and not rely on observed behaviour too much. Just my 2 cents. ps: Ignore if I have poorly understood the items discussed in this thread. Jambunathan K.. --