[Pythonmac-SIG] py2app error
Ronald Oussoren
ronaldoussoren at mac.com
Thu Jul 29 08:09:07 CEST 2010
On 28 Jul, 2010, at 18:38, Nathan Lemoine wrote:
> Hey everyone,
>
> I've been trying to bundle my script into a standalone Mac application using the most updated version of py2app and Python 2.5 on OSX 10.5.8. I'm getting error messages during the compile procedure and I haven't come across a way to fix it. So I can run the py2applet and generate the setup.py file easily.
>
> Here's the output when I attempt python setup.py py2app:
>
> Traceback (most recent call last):
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/build_app.py", line 604, in _run
> self.run_normal()
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/build_app.py", line 675, in run_normal
> self.create_binaries(py_files, pkgdirs, extensions, loader_files)
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/build_app.py", line 739, in create_binaries
> dry_run=self.dry_run)
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/util.py", line 376, in byte_compile
> if force or newer(mod.filename, cfile):
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/util.py", line 172, in newer
> msource = get_mtime(source)
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/util.py", line 164, in get_mtime
> info = zf.getinfo(rest)
> File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/zipfile.py", line 462, in getinfo
> return self.NameToInfo[name]
> KeyError: 'pyglet/__init__.pyc'
> > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/zipfile.py(462)getinfo()
> -> return self.NameToInfo[name]
Could you create a small pyglet program with a setup.py that demonstrates the problem? py2app should be able to find packages used by your script, and even if it didn't find pyglet it shouldn't fail in this way. Is "/Library/Python/2.5/site-packages/pyglet-1.1.4-py2.5.egg" a file or a directory (both should work, but you never know)?
>
>
> So the KeyError would tell me that py2app does not have pyglet in its dictionary, so that it doesn't know where to search to find pyglet, correct? When I go into Python and find the path for the pyglet module (pyglet.__path__), I receive ['/Library/Python/2.5/site-packages/pyglet-1.1.4-py2.5.egg/pyglet'].
>
> Do I have to tell py2app specifically where to find the pyglet module? If so, how do I do that.
>
> Also, whenever I run py2app in alias mode, I get a completely different error:
>
> sudo python py2app setup.py -A (sudo is run because I get a permission denied error if I don't use it(
>
> Traceback (most recent call last):
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/build_app.py", line 602, in _run
> self.run_alias()
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/build_app.py", line 548, in run_alias
> dst = self.build_alias_executable(target, target.script)
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/build_app.py", line 1145, in build_alias_executable
> appdir, resdir, plist = self.create_bundle(target, script)
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/build_app.py", line 1131, in create_bundle
> use_runtime_preference=use_runtime_preference
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/build_app.py", line 1120, in create_appbundle
> extension=self.extension,
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/create_appbundle.py", line 34, in create_appbundle
> copy(srcmain, destmain)
> File "/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/util.py", line 233, in mergecopy
> return macholib.util.mergecopy(src, dest)
> File "build/bdist.macosx-10.5-i386/egg/macholib/util.py", line 111, in mergecopy
> copy2(src, dest)
> File "build/bdist.macosx-10.5-i386/egg/macholib/util.py", line 43, in copy2
> shutil.copy2(fsencoding(src), fsencoding(dst))
> File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/shutil.py", line 91, in copy2
> copyfile(src, dst)
> File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/shutil.py", line 46, in copyfile
> fsrc = open(src, 'rb')
> IOError: [Errno 2] No such file or directory: '/Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/apptemplate/prebuilt/main-i386'
> > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/shutil.py(53)copyfile()
> -> fsrc.close()
>
> I went into the Python Framework folder and the only prebuilt executeable in there is 32bit one, there isn't a main-i386 file. Am I missing a file?
You aren't missing a file, py2app doesn't have a main-i386 file. As a quick workaround you can copy /Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/apptemplate/prebuilt/main-fat to /Library/Python/2.5/site-packages/py2app-0.5-py2.5.egg/py2app/apptemplate/prebuilt/main-i386.
I will tweak py2app to better handle this, that will be in the next release (0.5.2, hopefully later this week).
Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3567 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20100729/2247d35b/attachment.bin>
More information about the Pythonmac-SIG
mailing list