[Pythonmac-SIG] py2app ImportError

Ronald Oussoren ronaldoussoren at mac.com
Tue Feb 6 10:23:56 CET 2007


On 6 Feb, 2007, at 9:37, Erwin Marsi wrote:

> My py2app-build application crashes with an ImportError. I'm using
> the standard python 2.5 framework from http://www.python.org/
> download/ and py2app 0.3.5 build from sources.
>
> I followed the py2app tutorial and tried in alias mode first. Here's
> my setup.py:
>
> --
>
> """
> This is a setup.py script generated by py2applet
>
> Usage:
>      python setup.py py2app
> """
>
> from setuptools import setup
>
> APP = ['hitaext.py']
> DATA_FILES = []
> OPTIONS = {'argv_emulation': True}
>
> setup(
>      app=APP,
>      data_files=DATA_FILES,
>      options={'py2app': OPTIONS},
>      setup_requires=['py2app'],
> )
>
>
> --
>
> My app runs fine. However, after building for deployment, running my
> app results in the following error:
>
> --
>
> $ rm -rf build dist && python setup.py py2app
> ...
>
> $ dist/hitaext.app/Contents/MacOS/hitaext
> Traceback (most recent call last):
>    File "/Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/
> dist/hitaext.app/Contents/Resources/__boot__.py", line 137, in  
> <module>
>      _run('hitaext.py')
>    File "/Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/
> dist/hitaext.app/Contents/Resources/__boot__.py", line 134, in _run
>      execfile(path, globals(), globals())
>    File "/Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/
> dist/hitaext.app/Contents/Resources/hitaext.py", line 17, in <module>
>      from ielemtree import IndexElemTree
>    File "/Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/
> dist/hitaext.app/Contents/Resources/lib/python2.5/ielemtree.pyc",
> line 11, in <module>
>
> ImportError: cannot import name ElementTree
> 2007-02-05 21:32:48.840 hitaext[4505] hitaext Error
> 2007-02-05 21:32:48.843 hitaext[4505] hitaext Error
> An unexpected error has occurred during execution of the main script
>
> ImportError: cannot import name ElementTree
>
> --
>
> Any ideas on what went wrong and how to fix it?

How does ielemtree import ElementTree? Does it use an import  
statement or does it call __import__ directly? py2app can only detect  
imports that are done using the import statement.


Ronald

>
>
> thanks,
>
> Erwin
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig



More information about the Pythonmac-SIG mailing list