py2app problem

I am compiling a wxPython program that I have been working on. It
works fine from the command line, but when I use py2app, it is
complaining that it cannot find one of my modules that goes with my
application. My py2app setup script looks like this:

"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup

APP = ['ge2c.py']
DATA_FILES = ['resources/','ge2c/']
OPTIONS = {'argv_emulation': True, 'iconfile':'resources/
e2c_icon.icns', 'resources': ['resources/e2c_icon.icns', 'resources/
ELAN2CONNOT.css'],
    'packages': ('wx', 'ge2c'), 'site_packages': True, 'plist' :
{'CFBundleName': 'ELAN2CONNOT', 'CFBundleShortVersionString': '0.7.2',
    'CFBundleGetInfoString': 'ELAN2CONNOT 0.7.2',
'CFBUNDLEExecutable': 'ELAN2CONNOT', 'CFBundleIndentifier':
'com.doorinternational.ge2c'}}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

The error I receive when I run the app file it creates is this:

8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] Traceback (most recent call last):
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] File "/Users/user/Documents/DOOR/Consultant Work/Elan2CONNOT/
GUI/ge2c-0.7.2/dist/ELAN2CONNOT.app/Contents/Resources/__boot__.py",
line 156, in <module>
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] _run('ge2c.py')
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] File "/Users/user/Documents/DOOR/Consultant Work/Elan2CONNOT/
GUI/ge2c-0.7.2/dist/ELAN2CONNOT.app/Contents/Resources/__boot__.py",
line 153, in _run
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] execfile(path, globals(), globals())
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] File "/Users/user/Documents/DOOR/Consultant Work/Elan2CONNOT/
GUI/ge2c-0.7.2/dist/ELAN2CONNOT.app/Contents/Resources/ge2c.py", line
26, in <module>
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] from ge2c import *
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] File "/Users/user/Documents/DOOR/Consultant Work/Elan2CONNOT/
GUI/ge2c-0.7.2/dist/ELAN2CONNOT.app/Contents/Resources/ge2c.py", line
349, in <module>
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] app = ThisApp(0)
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] File "/BinaryCache/wxWidgets/wxWidgets-11~88/Root/System/
Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/
wx-2.8-mac-unicode/wx/_core.py", line 7757, in __init__
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] File "/BinaryCache/wxWidgets/wxWidgets-11~88/Root/System/
Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/
wx-2.8-mac-unicode/wx/_core.py", line 7354, in _BootstrapApp
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] File "/Users/user/Documents/DOOR/Consultant Work/Elan2CONNOT/
GUI/ge2c-0.7.2/dist/ELAN2CONNOT.app/Contents/Resources/ge2c.py", line
332, in OnInit
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] self.frame = MainFrame(None, -1, "GE2C")
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] File "/Users/user/Documents/DOOR/Consultant Work/Elan2CONNOT/
GUI/ge2c-0.7.2/dist/ELAN2CONNOT.app/Contents/Resources/ge2c.py", line
81, in __init__
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] self.panel_l = panels.ParameterPanel(self) # fields for
data
8/31/09 01:09:02 [0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT
[19393] NameError: global name 'panels' is not defined
8/31/09 01:09:05 com.apple.launchd[108]
([0x0-0x5cf5cf].org.pythonmac.unspecified.ELAN2CONNOT[19393]) Exited
with exit code: 255

In my source folder, all of my modules for this application are under
a folder called ge2c which has dialogs.py, document.py, export.py,
panels.py, rtfwriter.py. The main script then calls whatever it needs
from those modules. I do have an __init__.py in the ge2c folder which
contains: __all__ = ["document", "panels", "export", "dialogs",
"rtfwriter"]

Any thoughts?

Thanks,

Stuart

Hello,

I am compiling a wxPython program that I have been working on. It
works fine from the command line, but when I use py2app, it is
complaining that it cannot find one of my modules that goes with my
application. My py2app setup script looks like this:

"""
This is a setup.py script generated by py2applet

Usage:
python setup.py py2app
"""

from setuptools import setup

APP = ['ge2c.py']
DATA_FILES = ['resources/','ge2c/']
OPTIONS = {'argv_emulation': True, 'iconfile':'resources/
e2c_icon.icns', 'resources': ['resources/e2c_icon.icns', 'resources/
ELAN2CONNOT.css'],
'packages': ('wx', 'ge2c'), 'site_packages': True, 'plist' :
{'CFBundleName': 'ELAN2CONNOT', 'CFBundleShortVersionString': '0.7.2',
'CFBundleGetInfoString': 'ELAN2CONNOT 0.7.2',
'CFBUNDLEExecutable': 'ELAN2CONNOT', 'CFBundleIndentifier':
'com.doorinternational.ge2c'}}

Here are a few things too look at

1) You probably do not need the 'packages' and 'site_packages'
arguments (I have never used them in any of my projects anyway).

2) If your doing dynamic imports you may need to specify some explicit includes

i.e)

options = {'py2app' : {'includes' : ['ge2c.*',], ...}

3) If your package is not directly on the path of your setup file you
may need to modify sys.path before running setup() to help if find
your modules.

Cody

···

On Mon, Aug 31, 2009 at 8:02 AM, Stuart Thiessen<thiessenstuart@gmail.com> wrote:

It still responds with the NameError. But running it from the
commandline works fine?

Stuart

···

On Aug 31, 2009, at 08:17 , Cody Precord wrote:

Hello,

On Mon, Aug 31, 2009 at 8:02 AM, Stuart > Thiessen<thiessenstuart@gmail.com> wrote:

I am compiling a wxPython program that I have been working on. It
works fine from the command line, but when I use py2app, it is
complaining that it cannot find one of my modules that goes with my
application. My py2app setup script looks like this:

"""
This is a setup.py script generated by py2applet

Usage:
   python setup.py py2app
"""

from setuptools import setup

APP = ['ge2c.py']
DATA_FILES = ['resources/','ge2c/']
OPTIONS = {'argv_emulation': True, 'iconfile':'resources/
e2c_icon.icns', 'resources': ['resources/e2c_icon.icns', 'resources/
ELAN2CONNOT.css'],
   'packages': ('wx', 'ge2c'), 'site_packages': True, 'plist' :
{'CFBundleName': 'ELAN2CONNOT', 'CFBundleShortVersionString':
'0.7.2',
   'CFBundleGetInfoString': 'ELAN2CONNOT 0.7.2',
'CFBUNDLEExecutable': 'ELAN2CONNOT', 'CFBundleIndentifier':
'com.doorinternational.ge2c'}}

Here are a few things too look at

1) You probably do not need the 'packages' and 'site_packages'
arguments (I have never used them in any of my projects anyway).

2) If your doing dynamic imports you may need to specify some
explicit includes

i.e)

options = {'py2app' : {'includes' : ['ge2c.*',], ...}

3) If your package is not directly on the path of your setup file you
may need to modify sys.path before running setup() to help if find
your modules.

Cody

>

I did some modifications like you suggest, but no luck. Running it
from the commandline works fine.

The structure of my source directory is as follows:

./ge2c.0.7.2

  ge2c/
    __init__.py
    panels.py
    export.py
    dialogs.py
    document.py
    rtfwriter.py
  ge2c.py
  setup.py (for py2app)
  setup_win32.py (for py2exe)

In ge2c.py, i just call import ge2c. The __init__.py imports all of
the modules. Within ge2c package, I just import the specific module.
The error occurs within the ge2c.py file.

Other thoughts?

Stuart

···

On Aug 31, 2009, at 08:17 , Cody Precord wrote:

Hello,

On Mon, Aug 31, 2009 at 8:02 AM, Stuart > Thiessen<thiessenstuart@gmail.com> wrote:

I am compiling a wxPython program that I have been working on. It
works fine from the command line, but when I use py2app, it is
complaining that it cannot find one of my modules that goes with my
application. My py2app setup script looks like this:

"""
This is a setup.py script generated by py2applet

Usage:
  python setup.py py2app
"""

from setuptools import setup

APP = ['ge2c.py']
DATA_FILES = ['resources/','ge2c/']
OPTIONS = {'argv_emulation': True, 'iconfile':'resources/
e2c_icon.icns', 'resources': ['resources/e2c_icon.icns', 'resources/
ELAN2CONNOT.css'],
  'packages': ('wx', 'ge2c'), 'site_packages': True, 'plist' :
{'CFBundleName': 'ELAN2CONNOT', 'CFBundleShortVersionString':
'0.7.2',
  'CFBundleGetInfoString': 'ELAN2CONNOT 0.7.2',
'CFBUNDLEExecutable': 'ELAN2CONNOT', 'CFBundleIndentifier':
'com.doorinternational.ge2c'}}

Here are a few things too look at

1) You probably do not need the 'packages' and 'site_packages'
arguments (I have never used them in any of my projects anyway).

2) If your doing dynamic imports you may need to specify some
explicit includes

i.e)

options = {'py2app' : {'includes' : ['ge2c.*',], ...}

3) If your package is not directly on the path of your setup file you
may need to modify sys.path before running setup() to help if find
your modules.

Cody

>

Thiessen Stuart wrote:

I did some modifications like you suggest, but no luck. Running it from the commandline works fine.

The structure of my source directory is as follows:

./ge2c.0.7.2

  ge2c/
    __init__.py
    panels.py
    export.py
    dialogs.py
    document.py
    rtfwriter.py
  ge2c.py
  setup.py (for py2app)
  setup_win32.py (for py2exe)

In ge2c.py, i just call import ge2c. The __init__.py imports all of the modules. Within ge2c package, I just import the specific module. The error occurs within the ge2c.py file.

Other thoughts?

Try changing the name of your main module to be different than the package name.

···

--
Robin Dunn
Software Craftsman

Thiessen Stuart wrote:

I did some modifications like you suggest, but no luck. Running it from the commandline works fine.

Other thoughts?

Do take a look at the output py2app provides when building. Also, py2app puts all teh python packages it includ3ed in:

YourAppName.app/Contents/Resources/lib/python2.5/site-packages.zip

you can unzip that, and see what's there -- it may give you a hint as to what's going on.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Thanks! That did the trick!

···

On Sep 3, 2009, at 12:59 , Robin Dunn wrote:

Thiessen Stuart wrote:

I did some modifications like you suggest, but no luck. Running it
from the commandline works fine.

The structure of my source directory is as follows:

./ge2c.0.7.2

  ge2c/
    __init__.py
    panels.py
    export.py
    dialogs.py
    document.py
    rtfwriter.py
  ge2c.py
  setup.py (for py2app)
  setup_win32.py (for py2exe)

In ge2c.py, i just call import ge2c. The __init__.py imports all of
the modules. Within ge2c package, I just import the specific module.
The error occurs within the ge2c.py file.

Other thoughts?

Try changing the name of your main module to be different than the
package name.

--
Robin Dunn
Software Craftsman
http://wxPython.org