help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: python mode shell and unicode


From: Max Arnold
Subject: Re: python mode shell and unicode
Date: Mon, 29 Mar 2010 00:58:01 +0700
User-agent: Mutt/1.5.20 (2009-06-14)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]