Py2app 模块图中出现错误
几周前,我能够使用 py2app 构建应用程序。我刚刚再次尝试,在构建过程中,我被转储到 pdb 会话中,堆栈跟踪如下。
它似乎存在 modulegraph.py 的导入问题,但我拥有迄今为止最新的版本。
即使只有一个最低限度的测试文件,除了 sys 之外没有任何导入,并且使用 py2applet 创建的设置,也会发生这种情况。
我还确保运行 py2app 的 python 是 /Library 版本,而不是 /System 版本。
有什么想法吗?
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/bdist.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)):
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/bdist.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)):
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎是此处指出的问题,应该已修复在 modulegraph 的后续 0.8 版本中。确保您的
modulegraph
版本确实是最新的;该路径有点奇怪:build/bdist.macosx-10.6-universal/egg/modulegraph
。看起来您使用的是私有副本,而不是作为普通站点包安装的副本,例如py2app
(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/站点包
)。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 likepy2app
(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
).遇到了这个问题,但接受的答案并没有为我解决。
我发现 从 Python 脚本到带有 py2app 的便携式 Mac 应用程序,我将精简的解决方案放在这里:
我知道这并不理想 - 但我现在只想有一个原型,这样就可以了。 :)
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:
I know this is not ideal - but I just wanted to have a prototype for now so this will do. :)