开发者

Py2app Error in module graph

A few weeks ago, I was able to build Apps using py2app. I just tried it again and during the build process, I get dumped into a pdb session with the stack trace below.

It appears to be in import problem with modulegraph.py but I have the most update to date version.

This happens even with a bare minimum test file with no imports other than sys and using the setup that py2applet creates.

I've also made sure that the python I'm running py2app with is the /Library version, not the /System version.

Any Ideas?

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/py2app-0.4.3-py2.6.egg/py2app/build_app.py", line 589, in _run
    self.run_normal()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/py2app-0.4.3-py2.6.egg/py2app/build_app.py", line 641, in run_normal
    mf = self.get_modulefinder()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/py2app-0.4.3-py2.6.egg/py2app/build_app.py", line 549, in get_modulefinder
    debug=debug,
  File "build/bdist.macosx-10.6-universal/egg/modulegraph/find_modules.py", line 255, in find_modules
    find_needed_modules(mf, scripts, includes, packages)
  File "build/bdi开发者_如何学Gost.macosx-10.6-universal/egg/modulegraph/find_modules.py", line 180, in find_needed_modules
    mf.import_hook(mod[:-2], None, ['*'])
  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py", line 404, in import_hook
    modules.update(self.ensure_fromlist(m, fromlist))
  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py", line 472, in ensure_fromlist
    fromlist.update(self.find_all_submodules(m))
  File "build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py", line 496, in find_all_submodules
    for (path, mode, typ) in ifilter(None, imap(moduleInfoForPath, names)):
NameError: global name 'ifilter' is not defined
> /Users/justin/Desktop/test/build/bdist.macosx-10.6-universal/egg/modulegraph/modulegraph.py(496)find_all_submodules()
-> for (path, mode, typ) in ifilter(None, imap(moduleInfoForPath, names)):


That would appear to be a problem noted here and should have been fixed in the subsequent 0.8 release of modulegraph. Make sure your version of modulegraph is really up-to-date; the path is a little odd for it: build/bdist.macosx-10.6-universal/egg/modulegraph. Looks like you are using a private copy rather than one installed as a normal site-package like py2app (/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages).


Was having this issue but the accepted answer did not solve it for me.

I found From a Python script to a portable Mac application with py2app and am putting the condensed solution here:

Edit the file where this error ocured (for me, it was inside the virtual environment folder, named myenv), at: myenv/lib/python2.7/site-packages/py2app/recipes/virtualenv.py 1

myenv/lib/python2.7/site-packages/py2app/recipes/virtualenv.py

Look for the functions scan_code or load_module and add it an underscore before them, _scan_code and _load_module. Build again your application, it should work now

I know this is not ideal - but I just wanted to have a prototype for now so this will do. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜