An Emacs mode for editing Python code

UnicodeEncodeError in python-mode shell

Reported by Max Arnold on 2010-03-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Undecided
Andreas Roehler

Bug Description

When python shell invoked via C-c C-c, its stdout encoding is set to None and unicode characters can not be printed. Simple test case (0xA9 should produce unicode symbol (c) ):

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...
©
>>>

3. And this is how to trigger the error: 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)

This test was executed on Linux with Emacs-23.1 and latest python-mode.el. Emacs was running with -nw mode in rxvt-unicode terminal, system-wide LANG is set to ru_RU.UTF-8. On steps (1) and (2) sys.stdout.encoding is UTF-8, on step (3) it is None.

For more details see this thread: http://lists.gnu.org/archive/html/help-gnu-emacs/2010-03/msg00233.html

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
Changed in python-mode:
status: New → Confirmed
Changed in python-mode:
status: Confirmed → Fix Committed
Changed in python-mode:
milestone: none → 6.0
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers