On 10/08/2011 07:36 AM, Ronald Oussoren wrote:

On 6 Oct, 2011, at 22:35, Sean Robinson wrote:

On 10/06/2011 07:54 AM, Ronald Oussoren wrote:

On 6 Oct, 2011, at 16:51, Sean Robinson wrote:


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?


My script works as 'python quot.py' and now I am trying to bundle it up for my 
users to be able to click and run.  So, yes, from Terminal, AppKit imports 
correctly and the AppKit.NSSound module works well.

Looking at the various logs reported by py2app, it does not appear that the 
needed dirs are added to the app bundle's sys.path.  The follow process creates 
a failing AppKit import from the app bundle for me and shows different sys.path 
for 'python quot.py' vs app bundle launch.  I can provide much more detail 
(including modulegraph debug output) if requested, but the following steps in a 
Terminal window can reproduce the error for me every time.

$ echo "import sys">>  quot.py
$ echo "print sys.path">>  quot.py
$ echo "import AppKit">>  quot.py
$ cat quot.py
import sys
print sys.path
import AppKit

$ py2applet --make-setup quot.py
Wrote setup.py

$ python quot.py
NOTE: list of dirs in path

$ rm -rf build dist&&  python setup.py py2app
running py2app

$ open -a quot
NOTE: Error window appears and output is captured in Console which can be condensed to 
"ImportError: No module named AppKit".


I believe I can overcome this error by finding the right path(s) to append to 
the app bundle's sys.path, but I'm surprised that py2app does not do this 
automagically.

py2app should do this automaticly.  What version of python do you use? Is that 
a custom install or the system version of python? And finally, which OSX 
version are you using?


This is on OSX 10.6.8, using the system version of Python 2.6.1. The only non-standard packages/modules are py2app (0.6.4 pre-release and its requirements) installed local to the user account. I am developing as vanilla as I can get.

--
Sean Robinson
Laboratory Technician
Physics Astronomy Geology
sean.robin...@sccmail.maricopa.edu
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to