From: Kevin A. <al...@se...> - 2004-05-14 20:57:59
|
On May 14, 2004, at 1:49 PM, Tim Black wrote: > All my py2exe errors have gone away since upgrading from Pythoncard=20 > 0.7.2. to 0.7.3.1 and from wxPython 2.4.2.4 to 2.5.1.5. The app runs=20= > fine with no errors using python. However, the resulting .exe does not=20= > run properly. I built and ran it as a console exe, after putting an=20 > exception handler around the instantiation of the PythonCardApp, and=20= > here is what=92s going wrong: > > =A0 > > cannot import module 'button > > Traceback (most recent call last): > =A0 File "BOAMessenger.py", line 383, in ? > =A0 File "PythonCardPrototype\model.pyc", line 218, in __init__ > =A0 File "PythonCardPrototype\res.pyc", line 48, in getResource > =A0 File "PythonCardPrototype\res.pyc", line 86, in __init__ > =A0 File "PythonCardPrototype\res.pyc", line 91, in __init__ > =A0 File "PythonCardPrototype\res.pyc", line 91, in __init__ > =A0 File "PythonCardPrototype\res.pyc", line 96, in __init__ > =A0 File "PythonCardPrototype\res.pyc", line 130, in enforceSpec > =A0 File "PythonCardPrototype\res.pyc", line 30, in = loadComponentModule > ImportError: cannot import module 'button > > > It looks like there is a typo somewhere. I double checked my resource=20= > file, but the button component is: > {'type':'Button', > =A0=A0=A0 'name':'btnSend', > =A0=A0=A0 'position':(5, 5), > =A0=A0=A0 'size':(40, -1), > =A0=A0=A0 'label':'Send', > =A0=A0=A0 }, > > Looks fine to me. Has anyone seen this button import exception before? > Did you add an explicit import of the button component to your code=20 such as: from PythonCardPrototype.components import button as in the examples, and/or tell py2exe to include that module when it=20 does its build? All components are imported dynamically, so py2exe has=20= no way of knowing which components you used in the resource. Thomas and=20= I have had some recent discussion about how to best inform py2exe of=20 the necessary imports and there is a discussion about the issue going=20 on on the ctypes-users mailing list as well which you can read on gmane=20= as gmane.comp.python.ctypes. See the Metadata for py2exe thread. ka= |