#114 Unhandled exception on syntax check: Unicode

closed
nobody
None
5
2007-04-11
2006-12-14
Scott Severance
No

When I do a syntax check on the attached file, drpython pops up a dialog with the following message:

--------------------------------
No Line Number Found:

encoding declaration in Unicode string

Traceback (most recent call last):
File "/usr/bin/drpython", line 656, in CheckSyntax
compile(text, fn, 'exec')
SyntaxError: encoding declaration in Unicode string
--------------------------------

Here's my system info: Ubuntu Linux 6.06 (Dapper)
From the DrPython about dialog (note that the about dialog doesn't provide the DrPython version--according to Synaptic, I'm using version 161-2):

--------------------------------
wxPython Version: 2.6.1.2pre

wxPython Platform: wxGTK, unicode, gtk2, wx-assertions-off

Python Version: 2.4.3.final

Python Platform: linux2
--------------------------------

Discussion

  • Source file that triggers the bug

     
    Attachments
  • Logged In: YES
    user_id=772872
    Originator: NO

    This unicode things again. :()

    I will take a look into it, thanks for reporting this.

     
  • Logged In: YES
    user_id=772872
    Originator: NO

    Ok, I can duplicate it on the last drpyhton 163, WindowsXp, wxPython Version: 2.8.0.0.20061118

    No Line Number Found:

    encoding declaration in Unicode string

    Traceback (most recent call last):
    File "drpython.py", line 669, in CheckSyntax
    compile(text, fn, 'exec')
    SyntaxError: encoding declaration in Unicode string

    If I press then close, then it shows the right result.
    But nevertheless this is a bug and should be fixed.

    For the about dialog.
    I saw it also, that the version string is not displayed, but in Windows it is.
    There is some problem about that in Linux (with the layout)

     
  • Logged In: YES
    user_id=772872
    Originator: NO

    The problem seems to be the coding line utf8.
    If I remove that, check syntax isn't complaining anymore.

    Is this a pyhton issue(?).

     
  • Logged In: YES
    user_id=1589549
    Originator: YES

    I don't think that it's a python issue, because I don't have problems running the file, and many python files use utf-8. I tried inserting the UTF-8 declaration into another file that doesn't contain any Unicode-specific characters and got the same exception.

     
  • Logged In: YES
    user_id=772872
    Originator: NO

    Strange, you are right:
    I tried that in Pycrust following way:

    r=file ("C:\\drpython\\unicodechecksyntaxproblem.py", 'rb')
    t=r.read()
    e=compile(t, "C:\\drpython\\unicodechecksyntaxproblem.py", 'exec')

    and that works.

    I will take a look in it, and if you have a solution, the better. ;)

     
  • Logged In: YES
    user_id=772872
    Originator: NO

    in 1.64 there is a fix by Knut Gerwens.

     
    • status: open --> closed
     
    • status: closed --> open
     
  • Knut
    Knut
    2007-01-05

    Logged In: YES
    user_id=1641170
    Originator: NO

    Also, the About Dialog should be in order beginning with DrPython-164. It seems that it is better to use 'wx.lib.stattext.GenStaticText' instead of 'wx.StaticText' because wx.StaticText is not a proper widget, when wxPython is run with wxGTK.

     
  • Logged In: YES
    user_id=772872
    Originator: NO

    All right! ;)

     
    • status: open --> closed