Re: [Pythonmac-SIG] AppKit ImportError (was py2app: ImportError)
On 10/24/2011 04:12 AM, Ronald Oussoren wrote: On 13 Oct, 2011, at 18:25, Sean Robinson wrote: On 10/10/2011 07:44 AM, Sean Robinson wrote: On 10/08/2011 07:36 AM, Ronald Oussoren wrote: On 6 Oct, 2011, at 22:35, Sean Robinson wrote: 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. Ronald, So, to follow-up... I have been able to create a working semi-standalone app bundle (which is what I wanted) by adding two more dirs to sys.path. Thank you for py2app and for your help. My app bundles work on 10.6.3 and 10.6.8 with the default Apple-provided Python on each. Attached to this message is a zip archive with two minimal projects (working and not_working) which highlight the single difference which allows AppKit to be imported. Each project is three lines of python plus the setup.py created by py2applet. IHTH. That was a pretty lame bug: when using the system build of Python we don't include Python and the "standard" library into the application bundle, including the extra libraries like PyObjC and wxWidgets. That part worked fine, but py2app never made sure that the directory with extra libraries was available on sys.path and that causes the problem you're having. I've pushed a fix for that to the repository, and will push a new release to PyPI later today. This morning, I removed my explicit additions to sys.path within my project and I tested creating an app bundle using py2app from the repository (changeset 179:5e27e7b0b17d). Everything tests well. AppKit and the rest of PyObjC is imported correctly when the app bundle is launched. Thank you, again, for your maintenance and improvement of py2app. -- 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
Re: [Pythonmac-SIG] AppKit ImportError (was py2app: ImportError)
On 13 Oct, 2011, at 18:25, Sean Robinson wrote: > On 10/10/2011 07:44 AM, Sean Robinson wrote: >> On 10/08/2011 07:36 AM, Ronald Oussoren wrote: >>> >>> On 6 Oct, 2011, at 22:35, Sean Robinson wrote: 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. >> > > Ronald, > > So, to follow-up... I have been able to create a working semi-standalone > app bundle (which is what I wanted) by adding two more dirs to sys.path. > Thank you for py2app and for your help. My app bundles work on 10.6.3 and > 10.6.8 with the default Apple-provided Python on each. > > Attached to this message is a zip archive with two minimal projects (working > and not_working) which highlight the single difference which allows AppKit to > be imported. Each project is three lines of python plus the setup.py created > by py2applet. IHTH. That was a pretty lame bug: when using the system build of Python we don't include Python and the "standard" library into the application bundle, including the extra libraries like PyObjC and wxWidgets. That part worked fine, but py2app never made sure that the directory with extra libraries was available on sys.path and that causes the problem you're having. I've pushed a fix for that to the repository, and will push a new release to PyPI later today. 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
Re: [Pythonmac-SIG] AppKit ImportError (was py2app: ImportError)
On 13 Oct, 2011, at 18:25, Sean Robinson wrote: > On 10/10/2011 07:44 AM, Sean Robinson wrote: >> On 10/08/2011 07:36 AM, Ronald Oussoren wrote: >>> >>> On 6 Oct, 2011, at 22:35, Sean Robinson wrote: 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. >> > > Ronald, > > So, to follow-up... I have been able to create a working semi-standalone > app bundle (which is what I wanted) by adding two more dirs to sys.path. > Thank you for py2app and for your help. My app bundles work on 10.6.3 and > 10.6.8 with the default Apple-provided Python on each. Thank you. I'm going to use this to reproduce the problem and fix py2app. Ronald 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
Re: [Pythonmac-SIG] AppKit ImportError (was py2app: ImportError)
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
Re: [Pythonmac-SIG] AppKit ImportError (was py2app: ImportError)
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? 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