emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Roland Donat <roland.donat@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: Python SRC exec tuple fails [7.9.3f (release_7.9.3f-17-g7524ef <at> MY-PATH/)]
Date: Wed, 8 May 2013 14:02:36 +0000 (UTC)	[thread overview]
Message-ID: <loom.20130508T154537-221@post.gmane.org> (raw)
In-Reply-To: 518A5516.6070704@easy-emacs.de

Andreas Röhler <andreas.roehler <at> 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.

  reply	other threads:[~2013-05-08 14:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08  6:47 Bug: Python SRC exec tuple fails [7.9.3f (release_7.9.3f-17-g7524ef @ MY-PATH/)] Andreas Röhler
2013-05-08  7:12 ` Andreas Röhler
2013-05-08  7:58   ` Andreas Röhler
2013-05-08 12:40     ` Eric Schulte
2013-05-08 13:04       ` Andreas Röhler
2013-05-08 13:20         ` Bug: Python SRC exec tuple fails [7.9.3f (release_7.9.3f-17-g7524ef <at> MY-PATH/)] Roland Donat
2013-05-08 13:37           ` Andreas Röhler
2013-05-08 14:02             ` Roland Donat [this message]
2013-05-08 14:28               ` Andreas Röhler
2013-05-08 16:11               ` Andreas Röhler
2013-05-08 20:50                 ` Roland Donat
2013-05-09  9:01                   ` Andreas Röhler
2013-05-09 14:33                     ` Roland Donat
2013-05-09 14:45                       ` Andreas Röhler
2013-05-09 19:20                         ` Roland Donat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20130508T154537-221@post.gmane.org \
    --to=roland.donat@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).