From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?= Subject: Re: Bug: Python SRC exec tuple fails [7.9.3f (release_7.9.3f-17-g7524ef MY-PATH/)] Date: Thu, 09 May 2013 11:01:33 +0200 Message-ID: <518B65ED.6070908@easy-emacs.de> References: <5189F4EC.7010609@easy-emacs.de> <5189FAC6.8060807@easy-emacs.de> <518A059D.8080402@easy-emacs.de> <87fvxxprum.fsf@gmail.com> <518A4D4A.9010200@easy-emacs.de> <518A5516.6070704@easy-emacs.de> <518A791E.8020403@easy-emacs.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:40314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UaMh2-0001Z8-BG for emacs-orgmode@gnu.org; Thu, 09 May 2013 04:59:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UaMh0-0004U9-TD for emacs-orgmode@gnu.org; Thu, 09 May 2013 04:59:16 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:54759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UaMh0-0004Tt-K4 for emacs-orgmode@gnu.org; Thu, 09 May 2013 04:59:14 -0400 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: emacs-orgmode@gnu.org Am 08.05.2013 22:50, schrieb Roland Donat: >>> Yes, you're right Andreas. It "fails" to show the accented characters if > you >>> try to print the entire tuple. >>> It fails too if you evaluate a[0][0] in your interpreter. You should see > : >>>>>> a[0][0] >>> '\xc3\xa9' >>> But print a[0][0] gives the expected answer 'é' >>> >>> So, based on your successful experience consisting in returning a[0][0] > in >>> the orgmode source block, we can assume that org-babel use the python > print >>> function to display results in org buffer, aren't we? >>> >>> Another strange behaviour, when you evaluate the src_block test given in >>> example, you get : >>> | \303\251 | a | >>> | a | \303\240 | >>> >>> Whereas I was expecting to get the same code than in the python > interpreter, >>> that is : >>> | \xc3\xa9 | a | >>> | a | '\xc3\xa0' | >>> >>> In addition, when I try to save my buffer, Emacs doesn't recognize the >>> encoding of characters \303\251 and \303\240 and asks me to choose an >>> encoding. Then, I enter utf-8 and nothing happens BUT when I quit and > reopen >>> my file : the characters are printed correctly.... Too strange for > me.... >>> >>> Cheers, >>> >>> Roland. >> >> so what about that: >> >> a = ( ( "é", "a" ), ( "a", "à" ) ) >> for i, j in a: >> print i, j >> >> BTW previous post was sent prematurely.. >> >> Andreas >> >> > > Yep, using a couple of for loops will work but the result won't return as a > table which is a requirement for me. > > To precise the context a littre more, I have basically 2 source blocks : > 1) the famous python block which must return a table > 2) a R block used to post-process the previous table > > Well, thanks for your help. > I think I spent too much time on this so I'm thinking about changing my > approach. For example, put the result of the first step into a file and then > process the file in step 2. > > Best regards, > > Roland. Just playing a little bit with your example, what about this: #+begin_src python :results output :preamble # -*- coding: utf-8 -*- a = ( ( "é", "a" ), ( "a", "à" ) ) for i, j in a: print("|%s | %s|" % (i, j)) #+end_src