[Pythonmac-SIG] Trials with building app

Chris Weisiger cweisiger at msg.ucsf.edu
Tue Sep 14 00:49:42 CEST 2010


On Mon, Sep 13, 2010 at 3:00 PM, Christopher Barker
<Chris.Barker at noaa.gov>wrote:

> Chris Weisiger wrote:
>
>> Just another update on my travails with making an app build with py2app.
>> Since my previous posts haven't attracted much attention, I'm primarily
>> posting this on the off-chance that someone else is having similar issues
>> and might be helped. However, please do speak up if you have something to
>> contribute! I'm starting to get a wee bit frustrated.
>>
>
> This can be frustrating -- it's tricky stuff, and there are apparently only
> a few of us trying to do it.
>
> However, Ronald Oussoren has recently been giving py2app some much-needed
> love. He hasn't responded yet, so he may be busy or on vacton, or?? but he
> did specifically ask us all to let this list know when bugs were found.


Excellent news. I'm glad to hear that someone is taking charge of the
project -- it gives much more incentive to others to help out when they
discover fixable problems. It's a bit hard to report a bug, even if you have
the fix, if you have no ability to get that fix into the standard
distribution.


>
>
>  To build with a nonstandard Python install (necessary to get py2app to
>> include the Python interpreter in the build),
>>
>
> What is a "non-standard" install? you are right that it's won't include
> python if you use the Apple-supplied Python, but it should work with the
> build from python.org -- are you using something else? If so, why?
>
>
Sorry, I should have clarified here. By "non-standard" I mean "not the
distribution that comes with the OS". The standard distribution, IIRC, is
/usr/bin/python (which points to an install in /System/Frameworks); I'm
using /usr/local/bin/python (which points to an install in
/Library/Frameworks).


>
>  I have to "create" a main-i386 app template. This is done by going into
>> py2app-0.5.2-py2.5.egg/py2app/apptemplate/prebuilt and doing "ln -sf
>> main-fat3 main-i386"
>>
>
> This shouldn't be necessary, so something is up. py2app should "just work"
> with the exception of having to explicitly specify modules and packages
> sometimes (and data files...).
>

This thread suggests that Python is "lying about its architecture"; might be
a holdover from using Python2.5 instead of 2.6:
http://old.nabble.com/py2app-architecture-problem-and-System-Python-question-td29262714.html


>
>
First, key any any ability to help:
>
> What version of OS-X? what processor, exactly what version/build of Python,
> and what version of py2app?
>
>
OSX: 10.5.4
Processor: Intel Core 2 Duo 2GHz (Macbook)
Python: Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
 * I'd be on a newer version, but I have to deal with legacy cruft on a
regular basis, which doesn't work in 2.6.
py2app: 0.5.2.


> Second -- have you tried to do the very simplest thing first, with your
> set-up -- a simple hello world app? then you can add in modules that you may
> have problems with one at a time.
>
>
I really should have thought of this myself. Aside from the architecture
issue, hello.app fails with the same zlib error I mentioned earlier (when it
tries to import traceback in __boot__.py's _get_argvemulator()). I've put
the entirety of the test directory (including the source code, py2app's egg
directory with the symlink, and the build and dist directories) here:
http://derakon.dyndns.org/~chriswei/temp/hello.tgz

On a hunch, I tried using /usr/local/bin/python2.6. This doesn't give me the
architecture error, and the app successfully builds and runs with no
interference. So it looks like it's the architecture that's the problem, and
my symlink isn't helping as much as I thought it was. Using main-fat as
main-i386 will generate a working app, though. I tried using that for the
real program -- and it worked! Oddly enough, it doesn't need the __boot__.py
hack to find lib-dynload either.


>
>  This will allow py2app to build the app. However, it won't run, because I
>> have a dependency on a .so file which isn't in the default search paths that
>> py2app sets up.
>>
>
> Chris Weisiger wrote:
>
>> (creatively named "processor.app") that errors out on running with this
>> error:
>>
>> ImportError:
>> '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/Crypto/Hash/SHA256.so'
>> not found
>>
>> SHA256.so does exist, in
>> ./dist/processor.app/Contents/Resources/lib/python2.5/lib-dynload/Crypto/Hash/SHA256.so
>>
>
> However, that is a *.so that is part of Apple's Python ('cause it's in
> "System") -- so you don't seem to be completely clean of the Apple python.
> That file does exist in my python.org install, so py2app should be able to
> do the right thing with it.
>
>
Per the above, this was, I suppose, an offshoot of claiming to be the wrong
architecture.


> If you post a simple-as-possilbe-but-still-shos-the-problem example if an
> ap pthat uses SHA, maybe on of us can test it for you.
>
> For example, I've enclosed the simplest test of sha256 I could think of,
> along with a setup.py to build it. It works fine on my 10.5 PPC system with
> the python.org python2.6 (you need to open up the console to see the
> output when it runs)
>
> Does this work for you?
>
>
Having applied the hack to claim that main-i386 is main-fat, yes.
Alternately, using python2.6 instead of python2.5 also works sans hacks.


> Note that is puts _sha265.so in:
>
> hashlib_test.app/Contents/Resources/lib/python2.6/lib-dynload
>
>
> Maybe not much help, but you know you aren't alone...
>
>
Much more help than you might think. :) It's amazing how often I forget to
break problems down to their simplest possible level. Thank you so much!


> -Chris
>
>
>
-Chris


>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker at noaa.gov
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20100913/ae51155d/attachment-0001.html>


More information about the Pythonmac-SIG mailing list