On 6 Oct, 2011, at 16:51, Sean Robinson wrote: > On 10/06/2011 06:11 AM, Ronald Oussoren wrote: >> >> On 4 Oct, 2011, at 16:32, Sean Robinson wrote: >> >>> On 10/04/2011 06:54 AM, Ronald Oussoren wrote: >>>> >>>> On 30 Sep, 2011, at 21:36, Sean Robinson wrote: >>>> >>>>> I have not yet been able to make a working stand-alone app bundle using >>>>> py2app and I hope someone can point out what I'm missing. I am using >>>>> py2app cloned from bitbucket (changeset 169:9d95dbc52431), but py2app >>>>> 0.6.3 did not work, either. This is being done on OSX 10.6.8 with the >>>>> Apple-provided python (v2.6.1). >>>>> >>>>> The app (quotidian) is a Tkinter python script that runs well from >>>>> Terminal and partially from a py2app --alias app bundle. But the primary >>>>> problem is that sub-modules with the project are not importing (see the >>>>> stderr log below) on launch. The supposedly missing module is in >>>>> site-packages.zip (as queue.pyc). I have verified that site-packages.zip >>>>> is in sys.path. >>>>> >>>>> Does anyone have something else I can check? >>>> >>>> Can you reproduce this problem in a simple standalone application (using >>>> Tkinter is fine)? >>>> >>>> Ronald >>> >>> Attached is a minimal project (4 lines of Python in 3 files) that >>> replicates the error I am seeing. >> >> Does your real project have the same structure? The test projects almost >> certainly fails because of implementation details in CPython. Your project >> has a module and a package named quot that are located in the same >> directory, which one gets loaded by CPython depends on the order they are >> seen by os.listdir. This happens to work fine on OSX because OSX sorts >> directories and therefore the package is found before the module. >> >> It doesn't work when the application is bundled by py2app because the module >> happens to be earlier in the zipfile directory than the package, and the >> "import quot.queue" in the main script fails because the import statement >> only looks at the quot module which doesn't have a submodule named queue. >> >> That said, the current behavior of py2app is still fishy at best. The >> 'quot.py' file is currently copied into quot.app/Contents/ (where is should >> be located for the bootstrap code) as well as the site-packages.zip file >> (and another location). The copy in the zipfile is not needed, and py2app >> shouldn't have copied it into that file. >> >> A quick workaround is to rename 'quot.py' to 'quot_script.py'. >> > > Yes, my actual project had the same structure with a module and package with > the same name. This had not been a problem elsewhere, but I can see why it > does not work with py2app. So, I'll make sure to avoid a name collision > between my init module and all packages, which sounds like a good practice to > follow anyway. > > Thank you for your help. My bundled app is running. Now to find why AppKit > isn't importing…
I've just pushed a partial fix to the repository, this fixes the issue for regular builds but not yet for '--alias' builds. Your code was very helpful in finding the cause of the issue, and while writing a testcase for this problem. W.r.t. to AppKit not importing, does it import outside of the app bundle? Ronald > > > -- > Sean Robinson > Laboratory Technician > Physics Astronomy Geology > sean.robin...@sccmail.maricopa.edu
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG