Python3.5 erorr when import easygui

I got below error when import easygui in Python3.5

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import easygui
  File "C:\Users\bhongtip\AppData\Local\Programs\Python\Python35-32\lib\site-packages\easygui-0.98.0-py3.5.egg\easygui\__init__.py", line 50, in <module>
    from .boxes.choice_box import choicebox
  File "C:\Users\bhongtip\AppData\Local\Programs\Python\Python35-32\lib\site-packages\easygui-0.98.0-py3.5.egg\easygui\boxes\choice_box.py", line 76
    except Exception, e:
                    ^
SyntaxError: invalid syntax

Upvotes: 1

Views: 1441

Answers (3)

joshua robbins
joshua robbins

Reputation: 51

have you tried using:

from easygui import *

this is what I have always used and uhave used choicebox before.

Upvotes: 0

l. zhang
l. zhang

Reputation: 345

I see the easygui you have is for python 2.7.there are 2 things you can do.

  1. go to the C:\Users\bhongtip\AppData\Local\Programs\Python\Python35-32\lib\site-packages\easygui-0.98.0-py3.5.egg\easygui\boxes\choice_box.py and change the line to except (Exception, e): but that wouldn't solve all the problems.

  2. open cmd and type pip3 uninstall easygui then after that has been run type pip3 install --user easygui that should install the correct version for your python 3.5

Upvotes: 0

Martijn Pieters
Martijn Pieters

Reputation: 1121924

This issue was fixed in EasyGUI 0.98.1, which includes the change I suggested in my original answer below.

If you are still encountering this issue, upgrade to the latest release with

pip install -U "easygui>=0.98.1"

My original answer:

EasyGUI 0.98 introduced a change incompatible with Python 3.

You'll need to either downgrade to 0.97.4 (pip install -U EasyGUI==0.97.4) or fix that change.

Fixing that line is as easy as replacing line 76:

except Exception, e:

with

except Exception as e:

This is tracked as issue #97 by the project (with duplicates #101 and #102, and pull requests #100, #103, #105 and #107).

Upvotes: 3

Related Questions