GNU bug report logs - #5794
23.1; UnicodeEncodeError in python-shell

Previous Next

Package: emacs;

Reported by: Max Arnold <lwarxx <at> gmail.com>

Date: Mon, 29 Mar 2010 05:01:01 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Max Arnold <lwarxx <at> gmail.com>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 5794 <at> debbugs.gnu.org, Dave Love <fx <at> gnu.org>
Subject: bug#5794: 23.1; UnicodeEncodeError in python-shell
Date: Sun, 11 Apr 2010 09:47:52 +0700
On Sat, Apr 10, 2010 at 02:21:40PM -0400, Chong Yidong wrote:
> > >>> Traceback (most recent call last):
> >   File "/tmp/py5308nvC", line 1, in <module>
> >     print u'\xA9'
> > UnicodeEncodeError: 'ascii' codec can't encode character u'\xa9' in
> > position 0: ordinal not in range(128)
> 
> This is due to the following line in `run-python', which I merged from
> the upstream python.el on 2008-02-21:
> 
>        ;; Suppress use of pager for help output:
>        (process-connection-type nil))
> 
> Dave, do you remember what the rationale for this is?  (I don't
> understand the comment.)
> 
> I'm not sure why using a pipe rather than a pty makes a difference,
> though.

This is probably for python builtin help() function, which can use pager
to scroll documentation page by page. When help() detects that terminal is
a pipe, it disables interactive scrolling and just prints full output as is.
Try this for example:

import os
help(os)

Fortunately, python understands $PAGER environment variable and will use it
for scrolling, so PAGER="cat" will have the same effect as using pipe.

Hope this helps.




This bug report was last modified 14 years and 336 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.