From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Max Arnold Newsgroups: gmane.emacs.help Subject: Re: python mode shell and unicode Date: Mon, 29 Mar 2010 00:58:01 +0700 Message-ID: <20100328175801.GA5783@bbone> References: <20100326153543.GA11085@bbone> <4BAE44D0.9090804@easy-emacs.de> <20100328024756.GA4890@bbone> <4BAF044E.7010304@easy-emacs.de> <20100328130822.GA7535@bbone> <4BAF6E31.8020202@easy-emacs.de> <20100328163708.GA9749@bbone> <4BAF84FE.4040205@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1269799124 7521 80.91.229.12 (28 Mar 2010 17:58:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 28 Mar 2010 17:58:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 28 19:58:40 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nvwkx-00071e-OZ for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Mar 2010 19:58:40 +0200 Original-Received: from localhost ([127.0.0.1]:54639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nvwkx-0005zd-83 for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Mar 2010 13:58:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvwkT-0005xq-I8 for help-gnu-emacs@gnu.org; Sun, 28 Mar 2010 13:58:09 -0400 Original-Received: from [140.186.70.92] (port=59296 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvwkS-0005wu-34 for help-gnu-emacs@gnu.org; Sun, 28 Mar 2010 13:58:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvwkQ-0003Yy-8x for help-gnu-emacs@gnu.org; Sun, 28 Mar 2010 13:58:07 -0400 Original-Received: from mail-fx0-f224.google.com ([209.85.220.224]:44051) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvwkQ-0003Ys-3v for help-gnu-emacs@gnu.org; Sun, 28 Mar 2010 13:58:06 -0400 Original-Received: by fxm24 with SMTP id 24so19315fxm.26 for ; Sun, 28 Mar 2010 10:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:mail-followup-to:references:mime-version:content-type :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=u/JxPLHUyOGqVrPmu7vCy33N7eVHhAA5FYc/QKSCzh8=; b=low23g5yATWK+px/aUqa8lDTyopMt2+GeU/09+nmc+o/5swwrHFadEd39EjwX7dJ7d Fw/6h9OAYW8dfG+WDpKoJOgF7TOAv1VkhAvq+AZQhDt8ampV30zdHialYsgLdigVQgyP XwcBi4xD2l+2o129WBGDam4UYCflBcougOts0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; b=YGURkSnw2k1YrAwsz+34uSOMDeWuQOgcmkOqFa/+ckQ8gq0HAapgfkBbZqfthK1iKT 34jLoPDz8JfqD5VCJF2i89WEnTTyn4kkIEyzJsCHfYl5gvvYlCBB3BLskpIkG9WMiwRC lf2sz0P3tbXWKCLUjzFweH/+QbNcBCLeZnR9Q= Original-Received: by 10.223.56.216 with SMTP id z24mr3080756fag.82.1269799085074; Sun, 28 Mar 2010 10:58:05 -0700 (PDT) Original-Received: from bbone ([212.75.220.126]) by mx.google.com with ESMTPS id 14sm2367635fxm.1.2010.03.28.10.58.04 (version=SSLv3 cipher=RC4-MD5); Sun, 28 Mar 2010 10:58:04 -0700 (PDT) Mail-Followup-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <4BAF84FE.4040205@easy-emacs.de> User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72520 Archived-At: 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 "", line 1, in > > 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?