#90 Encoding Error Exception


Trying to open attached file, get the following traceback (minorly editted for brevity):

Traceback (most recent call last):
File "drpython.py", line 2727, in OpenFile
oof, e = drEncoding.EncodeText(self, oof, encoding, True)
File "drEncoding.py", line 208, in EncodeText
raise Exception, 'Encoding Error!'
Exception: Encoding Error!

wxPython Version:
wxPython Platform: wxMSW, unicode, wx-assertions-on
Python Version: 2.4.1.final
Python Platform: win32
OS Version: WinXP SP2


  • Stephen Anderson

    Python File which causes exception on opening

  • Omar Modesto

    Omar Modesto - 2006-01-24

    Logged In: YES

    I get the same error message when using any special
    characters (ñ,®,© and such). It seems DrPython doesn't
    support anything other than the standard ones at the moment.

  • Knut

    Knut - 2007-01-05

    Logged In: YES
    Originator: NO

    I could reproduce the error by loading the attached file (nanothreads.py). The error occurs, because the file contains the Character \xa9. This is the Copyright sign (©) in latin-1 (ISO-ISO 8859-1 and variations like Windows cp1252).
    The error can be healed by changing the Default Encoding in DrPython to an appropiate encoding. This can be done under "Options->Preferences->General". I have added this information to the Encoding Error message, so that users will have a hint what to do.

  • Knut

    Knut - 2007-01-05

    Logged In: YES
    Originator: NO

    Another possibilty is, to add an encoding cookie like # -*- coding: ISO 8859-1 -*- to line 1 or 2 of the sourcefile. I tested this by adding the line to nanothreads.py (the attachment below) and DrPython recognized the cookie in accordance with PEP 0263 (see http://www.python.org/dev/peps/pep-0263/\). Precondition is that "Auto Detect Encoding" is switched on under "Options->Preferences->General".
    I do believe now that the handling of Decoding/Encoding respectively Unicode in DrPython is correct and that both this request and request "[ 1615463 ] Unhandled exception on syntax check: Unicode" can be closed

  • Franz Steinhaeusler

    • status: open --> closed
  • Franz Steinhaeusler

    Logged In: YES
    Originator: NO

    thanks knuger.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks