all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Max Arnold <lwarxx@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: python mode shell and unicode
Date: Mon, 29 Mar 2010 00:58:01 +0700	[thread overview]
Message-ID: <20100328175801.GA5783@bbone> (raw)
In-Reply-To: <4BAF84FE.4040205@easy-emacs.de>

On Sun, Mar 28, 2010 at 06:34:06PM +0200, Andreas Röhler wrote:
> > On Sun, Mar 28, 2010 at 04:56:49PM +0200, Andreas Röhler wrote:
> >> Looks like your problem is rather on the python than the emacs side.
> > 
> >> Download it here
> >> http://launchpad.net/python-mode/trunk/5.1.0/+download/python-mode.el
> >>
> >> M-x py-execute-file
> > 
> > Ok, I placed (require 'python-mode) to init.el and it seems to be activated
> > (autoloading didn't worked for me). But M-x shows no available completions
> > for py-execute-file:
> > 
> > Possible completions are:
> > py-electric-backspace                  py-electric-colon
> > py-electric-delete                     py-end-of-def-or-class
> > py-execute-buffer                      py-execute-def-or-class
> > py-execute-import-or-reload            py-execute-region
> > py-execute-string
> > 
> > Although C-h f py-execute-file shows it and says it is defined in python-mode.el.
> > 
> > 
> > Next, quick test with print u'\xA9':
> > 
> > 1. Invoke python shell manually:
> > 
> > M-x py-shell
> >>>> print u'\xA9'
> > ©
> > 
> > 
> > 2. Create new buffer containing the same print command, switch it to python-mode
> > and use py-execute-buffer:
> > 
> >>>> ## working on region in file /usr/tmp/python-9773IlV.py...
> > ©
> > 
> 
> So that's what it should do(?)


Yes, (1) and (2) is expected behaviour, 0xA9 is the UTF-8 code for copyright symbol (C).

> > 
> > 3. Close python shell (opened at step 1) and invoke py-execute-buffer again:
> > 
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> > UnicodeEncodeError: 'ascii' codec can't encode character u'\xa9' in position 0: ordinal not in range(128)
> > 
> > 
> > Is this really a python problem?  I think there is a difference in how Emacs spawns python
> > process in each case.
> > 
> > 
> 
> Hmm, yes, get the same error.
> However, if I re-start ipython-shell parallel
> 
> it works again
> 
> In [11]: ## working on region in file /usr/tmp/python-3766xFD.py...
> ©
> 
> 
> Maybe just start a python-shell to have a work-around?

Initially I discovered this problem using python.el. It spawns new python
process upon C-c C-c even if there is existing one (looks like it launches
one process per buffer). So this workaround applicable only for python-mode.el


> Sorry, I'm not able to dive into now.
> 
> It may help, if you make a bug-report, having it noticed at least here:
> 
> https://bugs.launchpad.net/python-mode

Ok, I'll do this.  Should I do the same for python.el somewhere?




  reply	other threads:[~2010-03-28 17:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-26 15:35 python mode shell and unicode Max Arnold
2010-03-27 17:48 ` Andreas Röhler
2010-03-28  2:47   ` Max Arnold
2010-03-28  7:25     ` Andreas Röhler
2010-03-28 13:08       ` Max Arnold
2010-03-28 14:56         ` Andreas Röhler
2010-03-28 16:37           ` Max Arnold
2010-03-28 16:34             ` Andreas Röhler
2010-03-28 17:58               ` Max Arnold [this message]
2010-03-28 17:28                 ` Andreas Röhler

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

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

  git send-email \
    --in-reply-to=20100328175801.GA5783@bbone \
    --to=lwarxx@gmail.com \
    --cc=help-gnu-emacs@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.