[Pythonmac-SIG] py2app: how to force packages into application bundle?

weddingmusic at partybombe.de weddingmusic at partybombe.de
Tue Sep 16 17:15:45 CEST 2008


hi Joe and Pythonmac-SIG-Community

still that does not work for me.

what i have done:

1)
easy_install -U somemodule==dev
run into 
NameError: global name 'log' is not defined

searching the web i figured out that this is a problem of subversion 1.5 and setuptools.

at least i could fix this by checkout current setuptools-dev manually:
svn checkout http://svn.python.org/projects/sandbox/trunk/setuptools
and installing by
python setup.py install

2)
now i could install current development version of py2app, modulegraph and macholib as you suggested.
my third party dictionary (/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages ) looks like this now:

ClientForm-0.2.9-py2.5.egg
altgraph-0.6.7-py2.5.egg
bdist_mpkg-0.4.3-py2.5.egg
easy-install.pth
macholib-1.1-py2.5.egg
macholib-1.2.1.dev_r23-py2.5.egg
mechanize-0.1.8-py2.5.egg
modulegraph-0.7-py2.5.egg
modulegraph-0.7.2.dev_r21-py2.5.egg
py2app-0.3.6-py2.5.egg
py2app-0.4.2-py2.5.egg
setuptools-0.6c8-py2.5.egg
setuptools-0.7a1dev_r66388-py2.5.egg
setuptools.pth

I'm not quite sure whether i should remove the old packages when installing new ones?

3)
running python setup.py py2app returns some new error now:

running py2app
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 579, in _run
    self.run_normal()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 631, in run_normal
    mf = self.get_modulefinder()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 539, in get_modulefinder
    debug=debug,
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/find_modules.py", line 255, in find_modules
    find_needed_modules(mf, scripts, includes, packages)
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/find_modules.py", line 176, in find_needed_modules
    mf.run_script(path)
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py", line 369, in run_script
    self.scan_code(co, m)
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py", line 638, in scan_code
    self.scan_code(c, m)
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py", line 610, in scan_code
    self._safe_import_hook(name, m, fromlist)
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py", line 540, in _safe_import_hook
    mods = self.import_hook(name, caller)
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py", line 380, in import_hook
    q, tail = self.find_head_package(parent, name)
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py", line 419, in find_head_package
    q = self.import_module(head, qname, parent)
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py", line 493, in import_module
    parent and parent.packagepath, parent)
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py", line 680, in find_module
    fp, buf, stuff = find_module(name, path)
  File "build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py", line 114, in find_module
    if isinstance(importer, pkg_resources.ImpWrapper):
AttributeError: 'module' object has no attribute 'ImpWrapper'
> /Users/me/python_test/build/bdist.macosx-10.3-i386/egg/modulegraph/modulegraph.py(114)find_module()
(Pdb) 

Anyone has got ideas?
thank you
axel


PS:
my setup.py still is:

#!/usr/bin/env python
from setuptools import setup
import py2app

setup(
    app=['test.py'],
    options=dict(
        py2app=dict(
            packages=['mechanize'],
            site_packages=True,
        ),
    ),
)

and my source code test.py:

import mechanize



-------- Original-Nachricht --------
> Datum: Tue, 16 Sep 2008 09:18:03 -0400
> Von: Joe Losco <joelosco at frontiernet.net>
> An: weddingmusic at partybombe.de
> CC: pythonmac-sig at python.org
> Betreff: Re: [Pythonmac-SIG] py2app: how to force packages into application bundle?

> 
> 
> > thanks Joe,
> 
> no problem.. glad I could help..
> 
> > gets me the following output:
> > running py2app
> > Traceback (most recent call last):
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> > python2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/build_app.py",  
> > line 548, in _run
> >   self.run_normal()
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> > python2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/build_app.py",  
> > line 600, in run_normal
> >   mf = self.get_modulefinder()
> > File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
> > python2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/build_app.py",  
> > line 508, in get_modulefinder
> >   debug=debug,
> > File "build/bdist.macosx-10.3-i386/egg/modulegraph/find_modules.py",  
> > line 243, in find_modules
> >   find_needed_modules(mf, scripts, includes, packages)
> > File "build/bdist.macosx-10.3-i386/egg/modulegraph/find_modules.py",  
> > line 179, in find_needed_modules
> >   path = m.packagepath[0]
> > TypeError: 'NoneType' object is unsubscriptable
> > /Users/me/python_test/build/bdist.macosx-10.3-i386/egg/modulegraph/ 
> >> find_modules.py(179)find_needed_modules()
> > (Pdb)
> 
> ok.. next I think you have run into an issues with the versions of  
> modulegraph and py2app.
> I ran into the same issue.  I had to easy_install -U modulegraph==dev  
> and easy_install -U py2app==dev to fix it.  oh and I also had to  
> easy_install -U macholib==dev  since thats a dependancy.\
> However I should note that there are risks using the development  
> versions of the packages because there are going to be bugs and they  
> are updated nightly I believe.  So there may be bugs that weren't  
> there when I downloaded it and there may be bugs I have that are fixed  
> now.  Hopefully they get pushed up to the stable soon so that people  
> don't have to use the development versions.
> 
> 
> > please allow some more questions:
> > 1) is it correct that there is a directory "build/bdist.macosx-10.3- 
> > i386"? (I'm running macosx 10.4.11)
> > 2) i want to use python 2.5.2 which i installed in "/Library/ 
> > Frameworks/Python.framework/Versions/2.5"
> > i do not want to use the system installed python 2.3.5 in "/System/ 
> > Library/Frameworks/Python.framework/Versions/2.3"
> > is it correct to set PYTHONPATH to "/Library/Frameworks/ 
> > Python.framework/Versions/2.5" in ~/.MacOSX/environment.plist ?
> > does the first line in my setup.py probably refere to a wrong  
> > python2.3?
> > 3) did i install the mechanize package correct, when i find the file  
> > "mechanize-0.1.8-py2.5.egg" in "/Library/Frameworks/Python.framework/ 
> > Versions/2.5/lib/python2.5/site-packages"?
> >
> > hope to get some more help
> > greets
> > axel
> >
> 
> I'll do my best here however I'm not extremely experienced, I just  
> happened to run into the same issues you did.
> 1) I believe thats ok, because I think its just been hard coded into  
> py2app by its developer as to how the build directory gets made.
> 2) from the terminal do a 'which python' and make sure that the  
> desired python is displayed.  I believe the python used to run py2app  
> is the selected one that shows in the which.
> 	I don't think its necessary to set pythonpath in that plist.  In  
> my .bash_profile file in my home directory I set up my $PATH so that  
> the desired python is found first.. therefore shown in which.  I think  
> thats all thats needed.
> 3) Yes thats the systemwide location for the mechanize package.  You  
> could have also put it in ~/Library/Python/2.5/site-packages/.
> 
> best of luck
> joe
> 
> ps you should keep posting to the group as well so that others can  
> benefit from our discussion or contribute ideas / corrections where I  
> may be wrong or not know.
> 
> 	

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx


More information about the Pythonmac-SIG mailing list