[Pythonmac-SIG] Problem packaging vtk application on Snow Leopard with py2app

Ronald Oussoren ronaldoussoren at mac.com
Wed May 26 11:59:43 CEST 2010


On 25 May, 2010, at 18:20, jens.thomas at stfc.ac.uk wrote:

> Hi,
> 
> I'm trying to package up an app under OSX 10.6 (MacBook with Intel Duo) with py2app. The application uses the external modules: vtk, numpy, Pmw.
> 
> When I try to package it up, I get the following error:
> 
> ...lots of output...
> Copying /Library/Python/2.6/site-packages/numpy-1.4.1-py2.6-macosx-10.6-universal.egg/numpy/version.pyc -> /Users/jmht/Documents/ccp1gui/dist/ccp1gui.app/Contents/Resources/lib/python2.6/numpy
> creating /Users/jmht/Documents/ccp1gui/dist/ccp1gui.app/Contents/Resources/lib/python2.6/lib-dynload/vtk
> Traceback (most recent call last):
>  File "/Library/Python/2.6/site-packages/py2app-0.4.3-py2.6.egg/py2app/build_app.py", line 589, in _run
>    self.run_normal()
>  File "/Library/Python/2.6/site-packages/py2app-0.4.3-py2.6.egg/py2app/build_app.py", line 660, in run_normal
>    self.create_binaries(py_files, pkgdirs, extensions, loader_files)
>  File "/Library/Python/2.6/site-packages/py2app-0.4.3-py2.6.egg/py2app/build_app.py", line 777, in create_binaries
>    platfiles = mm.run()
>  File "build/bdist.macosx-10.6-universal/egg/macholib/MachOStandalone.py", line 101, in run
>    for fn in platfiles:
>  File "build/bdist.macosx-10.6-universal/egg/macholib/util.py", line 227, in iter_platform_files
>    if is_platform_file(fn):
>  File "build/bdist.macosx-10.6-universal/egg/macholib/util.py", line 206, in is_platform_file
>    header = mach_o.fat_header.from_fileobj(fileobj, _endian_='>')
>  File "build/bdist.macosx-10.6-universal/egg/macholib/ptypes.py", line 44, in from_fileobj
>    return cls.from_str(f.read(cls._size_), **kw)
>  File "build/bdist.macosx-10.6-universal/egg/macholib/ptypes.py", line 48, in from_str
>    return cls.from_tuple(struct.unpack(endian + cls._format_, s), **kw)
> error: unpack requires a string argument of length 8
> 
> 
> As py2app kindly fires up the debugger, I was able to look through the stack and see that:
> 
> endian + cls._format_ is '>LL' (i.e. big-endian with two unsigned longs)
> 
> the string s that was read in from the file is:
> 
> '\xca\xfe\xba\xbe\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00\x03'
> 
> which is of length 16, and cls._size_ is 16.
> 
> Everything points to 16 being the correct length, but the call to struct.unpack is expecting something of length 8.

You seem to be running a 64-bit versions of python. There are some issues w.r.t. running py2app on 64-bit executables and you seem to run into one of them.

IIRC '>L' is always a 32-bit entity in the struct module, while the code expects it to be a 64-bit entity (for 64-bit binaries). Patching that should be fairly easy, but I don't have time to do that right now.

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/20100526/c1d86537/attachment-0001.bin>


More information about the Pythonmac-SIG mailing list