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

jens.thomas at stfc.ac.uk jens.thomas at stfc.ac.uk
Tue May 25 18:20:56 CEST 2010


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.

I looked in the struct module and there is a 'calcsize' function which indicates what size is required for a specific format.

struct.calcsize('>LL') is 8 whereas struct.calcsize('LL') is 16

so it looks to me like the problem is with the format string.

Does anyone know if this is a bug in py2app, python or just something I'm doing wrong?

Any help/suggestions would be appreciated.

Thanks,

Jens

-- 
Scanned by iCritical.


More information about the Pythonmac-SIG mailing list