Menu

#200 Python3 error (with MacOS)

closed
Python3 (1)
default/tip
2017-04-08
2017-04-08
No

I'm trying to run wxGlade on macOS Sierra using Python 3.6.1 but get errors. I've tried Python 3.3, 3.4 and 3.5 with the same result. Note: I am using the latest wxPython (Phoenix) daily snapshot install.

The error is:

$ python3.6 wxglade.py
  File "wxglade.py", line 105
    print _("""
          ^
SyntaxError: invalid syntax

How do I fix that error so I can use Python 3.6 and wxPython (Phoenix). The main wxGlade page claims it works with Python >= 3.1 and wxPython >= 2.8 (I presume that means Phoenix for Python 3).

It seems to launch ok if using Python 2.7, however that is using wxPython ('3.0.2.0 osx-cocoa (classic)')

I'm having problems using wxGlade (Python 2.7 and wxPython 3.0.2) where I can't seem to add widgets to my frame or sizer. For some reason I can mange to get a frame or dialog, but not be able to add widgets. It might be me not understanding how to use it, but I've tried dragging, double-clicking on widgets but nothing much happens. Anyway, that's probably another problem altogether.

Discussion

  • Brendan Simon

    Brendan Simon - 2017-04-08

    I am. I'm using revision 2283 according to Sourcetree.

    What confused me was the _() in the code. I'd never seen that before and completely threw me. So with further investigation I found it is legit and used/installed by gettext.

    So it seems the problem is more that the print functions are only Python2 compatible. I edited to place the surround parenthesis that Python3 requires and then found other issues for Python3 (e.g. not use as in exception handling.

    Doesn't anybody test or use Python 3 with wxGlade?

    I will continue my debugging/hacking :)

     
  • Dietmar Schwertberger

    That's strange.
    When I look at the repository, the print call is at line 79 and clearly is Python 3 compatible:

    https://bitbucket.org/wxglade/wxglade/src/6e05ab49fc8763c1938b6301866eaeeef14960e6/wxglade.py?at=default&fileviewer=file-view-default

    I'm using Python 3.4 and 3.5 most of the time. I have not yet tried 3.6.
    Yes, the _ is confusing in the beginning and does not increase the readability of the code. Personally, I would not have added gettext support at all, as nobody can use wxGlade without reading the english wx documentation.

     
  • Brendan Simon

    Brendan Simon - 2017-04-08

    OK. My bad. I didn't have the latest 'default' branch checked out (as I thought I did). I had tag rel_0.7.2 checked out. DOH !!! Sorry for the noise.

    I'm not a Mercurial user so was relying on SourceTree to give me information however it doesn't make the tags bold when checked out (as it does with branches).

    I have a different error with Python 3.6 (and Python 3.5) and I will investigate that further and report a bug if necessary.

    Again, apologies for the noise :-/

     
  • Dietmar Schwertberger

    No problem. My Hg knowledge is also rather basic...
    I don't have a Mac available here, but I'm quite sure we can figure out and fix if there's a bug.

     
  • Dietmar Schwertberger

    • status: open --> closed
    • assigned_to: Dietmar Schwertberger
     

Log in to post a comment.