I’m trying to use the EasyDialogs python module to produce some simple dialog boxes for my python script on OSX. Whenever I try and import the EasyDialogs module I get the following error:
>>> import EasyDialogs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/plat-mac/EasyDialogs.py", line 24, in <module>
from Carbon.Dlg import GetNewDialog, SetDialogItemText, GetDialogItemText, ModalDialog
File "/Library/Frameworks/EPD64.framework/Versions/6.2/lib/python2.6/plat-mac/Carbon/Dlg.py", line 1, in <module>
from _Dlg import *
ImportError: No module named _Dlg
I’ve tried doing easy_install Carbon, as I thought it may be due to some issue with the Carbon package for python, but that hasn’t helped. Any ideas?
From the paths in your traceback, you appear to be using a 64-bit Enthought Python Distribution. The
EasyDialogsmodule uses various OS X Carbon interfaces, many of which OS X only provides 32-bit versions and have been deprecated by Apple. For this reason, the PythonCarbonwrapper andEasyDialogsmodules are deprecated in Python 2 and have been removed in Python 3. While they may work in 32-bit mode, you should avoid using them in new code. There are other alternatives available:Tkinterin the standard library, various cross platform GUI frameworks (see here). For more simple dialogs, you could also use the osax package in appscript to use theUser Interactionsuite of AppleScript’sStandard Additions.