On 3/05/11 6:18 AM, Ronald Oussoren wrote:
>> I get the following error when trying to run my app when built with
>> py2app and python 2.7.
>>
>>       File "crcmod/__init__.pyc", line 7, in <module>
>>     ImportError: No module named predefined
>>
>>
>> The app works fine when built with Python 2.5 or Python 2.6.
>>
>> It seems the folks in py2exe land are having the same issue.
>>
>>     http://thread.gmane.org/gmane.comp.python.py2exe/4301
>>     http://thread.gmane.org/gmane.comp.python.py2exe/4302
>>
>>
>> Any ideas what would be causing this and how it can be
>> fixed/solved/worked-around ??
>
> The crcmod package contains a module named crcmod. My guess is that
> both py2app and py2exe get confused by this and try to fetch
> 'crcmod.predefined' from the nested module instead of the toplevel
> package.  This basicly means that both py2*s have a bug in their
> emulation of the __import__ code.  
>
> I'll see if I can create a testcase for this for the modulegraph
> package, it should then be fairly easy to actually fix the issue. As
> this is only a problem with python2.7 this may end up being a bug in
> the stdlib though.
>
> As a workaround try adding includes for crcmod.predefined, or even the
> entire crcmod package (setup(..., package=['crcmod'], ...))

Yep.  Forcing inclusion of the module in setup does resolve the issue. 
Here is the snippet of my setup file that worked for me :)

Hopefully py2app can be fixed so this is not necessary, but at least I
have a workaround now.

Thanks Ronald !!

    PACKAGES = [ 'crcmod', ]

    OPTIONS = {
                'argv_emulation' : True,
                'iconfile' : 'images/myapp.icns',
                'plist' : Plist,
                'packages' : PACKAGES,
               }

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


_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to