[Pythonmac-SIG] newbie py2app problem - "ImportError: no module named code"

anonymous user mike.spamfree at yahoo.com
Fri Apr 4 22:40:17 CEST 2008


Hi Chris,

Thanks for the response!  I actually used one of your older posts from 2006 to help get me started with py2app, so I'm doubly indebted. 

> That shouldn't be required. if you've imported wx,
> py2app should pick 
> that up, and the wx recipe should "do the right
> thing" -- it's always 
> worked for me. Try it without specifying that package.
> 
> Let us know how it works out...

> http://mail.python.org/mailman/listinfo/pythonmac-sig

Ok, so the reason I originally explicitly listed wx as a package is because I got the following error when running the .dmg file using the "raw" setup.py script straight out of py2applet:


Traceback (most recent call last):
  File "/Users/pekalmj1/tmp/foo2/dist/driver.app/Contents/Resources/__boot__.py", line 137, in <module>
    _run('driver.py')
  File "/Users/pekalmj1/tmp/foo2/dist/driver.app/Contents/Resources/__boot__.py", line 134, in _run
    execfile(path, globals(), globals())
  File "/Users/pekalmj1/tmp/foo2/dist/driver.app/Contents/Resources/driver.py", line 14, in <module>
    from wx import *
AttributeError: 'module' object has no attribute 'build'
2008-04-04 16:31:31.999 driver[3152] driver Error
2008-04-04 16:31:32.000 driver[3152] driver Error
An unexpected error has occurred during execution of the main script

AttributeError: 'module' object has no attribute 'build'


I had no idea what this meant, and assumed it had something to do with needing to specify wx as a package explicitly.  Based on your feedback, I went back and changed my "from wx import *" to a "import wx" (which, as you pointed out, I should have done in the first place).  The resulting .dmg seems to work!  I haven't yet tried dropping the dmg on another platform to ensure that it's not really still picking up my locally installed wx libs behind the scenes, but this definitely seems to have repaired the import code problem.  

Thanks again for your time - I think I would have just punted on this without your help!

mike


      ____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com


More information about the Pythonmac-SIG mailing list