Skip to main content
added 637 characters in body
Source Link
Anaphory
  • 240
  • 1
  • 14

While trying to run a python script in an Inferior Python buffer for Python 3.3.5 in my Emacs 24.3.1 GTK+ window, I get a

>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.3/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1332:
 ordinal not in range(128)

This even happens when all my buffer contains is the minimum to make it a python script containing a unicode character.

#!/usr/bin/env python3
"ε"

There appears to also be some magic that replaces all non-ascii characters from the first line (?) of input with whitespace, because just

"ε"

gives me the string " ", trying to do ε=4 results in an IndentationError, and ord("ε") on the first line of a file returns 32. This may be related; however, if the non-ascii symbols appear after the first line, all these constructions result in a UnicodeDecodeError instead.

As you can see, I haven't even started outputting any unicode symbols, and the Inferior Python buffer accepts input of unicode characters. Running the same python script in a terminal (urxvt or a random tty) works without problems as well.

What do I need to change to make it work?

While trying to run a python script in an Inferior Python buffer in my Emacs 24.3.1 GTK+ window, I get a

>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.3/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1332:
 ordinal not in range(128)

I haven't even started outputting any unicode symbols, and the Inferior Python buffer accepts input of unicode characters. Running the same python script in a terminal (urxvt or a random tty) works without problems as well.

What do I need to change to make it work?

While trying to run a python script in an Inferior Python buffer for Python 3.3.5 in my Emacs 24.3.1 GTK+ window, I get a

>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.3/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1332:
 ordinal not in range(128)

This even happens when all my buffer contains is the minimum to make it a python script containing a unicode character.

#!/usr/bin/env python3
"ε"

There appears to also be some magic that replaces all non-ascii characters from the first line (?) of input with whitespace, because just

"ε"

gives me the string " ", trying to do ε=4 results in an IndentationError, and ord("ε") on the first line of a file returns 32. This may be related; however, if the non-ascii symbols appear after the first line, all these constructions result in a UnicodeDecodeError instead.

As you can see, I haven't even started outputting any unicode symbols, and the Inferior Python buffer accepts input of unicode characters. Running the same python script in a terminal (urxvt or a random tty) works without problems as well.

What do I need to change to make it work?

Source Link
Anaphory
  • 240
  • 1
  • 14

UnicodeDecodeError in my Inferior Python buffer

While trying to run a python script in an Inferior Python buffer in my Emacs 24.3.1 GTK+ window, I get a

>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.3/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1332:
 ordinal not in range(128)

I haven't even started outputting any unicode symbols, and the Inferior Python buffer accepts input of unicode characters. Running the same python script in a terminal (urxvt or a random tty) works without problems as well.

What do I need to change to make it work?