From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roland Donat Subject: Re: Bug: Python SRC exec tuple fails [7.9.3f (release_7.9.3f-17-g7524ef MY-PATH/)] Date: Wed, 8 May 2013 14:02:36 +0000 (UTC) Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:40114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ua4xP-0006c4-Aw for emacs-orgmode@gnu.org; Wed, 08 May 2013 10:03:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ua4xJ-0003cx-Mi for emacs-orgmode@gnu.org; Wed, 08 May 2013 10:02:59 -0400 Received: from plane.gmane.org ([80.91.229.3]:60397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ua4xJ-0003ch-Es for emacs-orgmode@gnu.org; Wed, 08 May 2013 10:02:53 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ua4xH-0000H3-SC for emacs-orgmode@gnu.org; Wed, 08 May 2013 16:02:51 +0200 Received: from mar92-18-78-239-131-140.fbx.proxad.net ([78.239.131.140]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 May 2013 16:02:51 +0200 Received: from roland.donat by mar92-18-78-239-131-140.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 May 2013 16:02:51 +0200 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 Andreas Röhler easy-emacs.de> writes: > > Am 08.05.2013 15:20, schrieb Roland Donat: > > > >> > >> hmm, indeed, shows up nicely now. > >> Please close, cheers, > >> > >> Andreas > >> > >> > > > > That's right, it works with python3 but that is not the case with python2... > > > > Cheers, > > > > Roland. > > python2 fails here already with a common shell, independently from Emacs. > > OTOH that works with python2: > > #+NAME: test > #+begin_src python :results value :preamble # -*- coding: utf-8 -*- :return a[0][0] > a = ( ( "é", "a" ), ( "a", "à" ) ) > #+end_src > > #+RESULTS: test > : é > > Maybe there is a work-around from > a[0][0] > > ? > > 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.