Re: [Pythonmac-SIG] py2app - ImportError using pycrypto
I found a way to solve my issue. I was poking around with pygame, which has the same shared object load problems. I stumbled across this: http://www.rkblog.rk.edu.pl/w/p/building-mac-os-x-applications-py2app/ And something in there fixed my problem... specifically this: You have to edit Contents/Resources/__boot__.py and add in function def _run(*scripts): (near end of file) and add after imports this line: sys.path = [os.path.join(os.environ['RESOURCEPATH'], 'lib', 'python2.5', 'lib-dynload')] + sys.path I added that, but changed python2.5 to python2.7 and it fixed the issue. I think clearly this isn't the right fix, but it does seem to get my shared objects loading. Is there any way to get this to happen automatically? Any idea what's actually going on here? Why does this fix the issue, and what are possible solutions other than hand-editing the __boot__.py? Thanks! - Terry On Apr 11, 2012, at 9:13 AM, Terry Simons wrote: I'm using py2app 0.6.4 with the system python 2.7.1 on Mac OS X 10.7.3. - Terry On Apr 11, 2012, at 2:17 AM, Ronald Oussoren wrote: Which version of py2app do you use? Do you use the system python (/usr/bin/python) or a custom install (python.org installer, macports, homebrew, self built, ...)? If you use the system python: which OSX release do you use? Ronald On 11 Apr, 2012, at 10:51, Terry Simons wrote: Hi, I'm using py2applet to build a tool that uses paramiko/pycrypto. Everything seems to build fine, but I get an error when launching my app that pycrypto's Crypto/Util/_counter.so object couldn't be found. It looks like the app is trying to load it from the OS installed Python, which I am a bit surprised by, since I've included --site-packages, and everything appears to be getting bundled up correctly. I poked around in the module and didn't find any hard-coded paths or anything like that, so I'm at a loss, but it looks like it's attempting to load from /usr/lib instead of my App's bundle... is that a red herring, or is it really loading from the wrong place? The _counter.so file is definitely present in the App's Contents/Resources/lib/python2.7/lib-dynload directory, but the app isn't apparently finding it when it launches. Here's the error that I'm seeing: 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/__init__.py, line 69, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/transport.py, line 32, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/util.py, line 32, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/common.py, line 98, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/__init__.py, line 29, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/_UserFriendlyRNG.py, line 38, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaAccumulator.py, line 39, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaGenerator.py, line 35, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Util/Counter.py, line 30, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File Crypto/Util/_counter.pyc, line 18, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File Crypto/Util/_counter.pyc, line 15, in __load 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: ImportError: '/usr/lib/python2.7/lib-dynload/Crypto/Util/_counter.so' not found Thanks for any suggestions. - Terry ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ 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] py2app - ImportError using pycrypto
On 12 Apr, 2012, at 8:59, Terry Simons wrote: I found a way to solve my issue. I was poking around with pygame, which has the same shared object load problems. I stumbled across this: http://www.rkblog.rk.edu.pl/w/p/building-mac-os-x-applications-py2app/ And something in there fixed my problem... specifically this: You have to edit Contents/Resources/__boot__.py and add in function def _run(*scripts): (near end of file) and add after imports this line: sys.path = [os.path.join(os.environ['RESOURCEPATH'], 'lib', 'python2.5', 'lib-dynload')] + sys.path I added that, but changed python2.5 to python2.7 and it fixed the issue. I think clearly this isn't the right fix, but it does seem to get my shared objects loading. Is there any way to get this to happen automatically? Any idea what's actually going on here? Why does this fix the issue, and what are possible solutions other than hand-editing the __boot__.py? I haven't had time to look into this yet, py2app should have generated a correct sys.path this definitely looks like a bug on my end. There have been changes in py2app in the last couple of releases to deal with simular problems, but those changes obviously didn't fix the real issue. Ronald Thanks! - Terry On Apr 11, 2012, at 9:13 AM, Terry Simons wrote: I'm using py2app 0.6.4 with the system python 2.7.1 on Mac OS X 10.7.3. - Terry On Apr 11, 2012, at 2:17 AM, Ronald Oussoren wrote: Which version of py2app do you use? Do you use the system python (/usr/bin/python) or a custom install (python.org installer, macports, homebrew, self built, ...)? If you use the system python: which OSX release do you use? Ronald On 11 Apr, 2012, at 10:51, Terry Simons wrote: Hi, I'm using py2applet to build a tool that uses paramiko/pycrypto. Everything seems to build fine, but I get an error when launching my app that pycrypto's Crypto/Util/_counter.so object couldn't be found. It looks like the app is trying to load it from the OS installed Python, which I am a bit surprised by, since I've included --site-packages, and everything appears to be getting bundled up correctly. I poked around in the module and didn't find any hard-coded paths or anything like that, so I'm at a loss, but it looks like it's attempting to load from /usr/lib instead of my App's bundle... is that a red herring, or is it really loading from the wrong place? The _counter.so file is definitely present in the App's Contents/Resources/lib/python2.7/lib-dynload directory, but the app isn't apparently finding it when it launches. Here's the error that I'm seeing: 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/__init__.py, line 69, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/transport.py, line 32, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/util.py, line 32, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/common.py, line 98, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/__init__.py, line 29, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/_UserFriendlyRNG.py, line 38, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaAccumulator.py, line 39, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaGenerator.py, line 35, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Util/Counter.py, line 30, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File Crypto/Util/_counter.pyc, line 18, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File Crypto/Util/_counter.pyc, line 15, in __load 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: ImportError: '/usr/lib/python2.7/lib-dynload/Crypto/Util/_counter.so' not found Thanks for any suggestions. - Terry ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG smime.p7s Description: S/MIME
[Pythonmac-SIG] py2app - ImportError using pycrypto
Hi, I'm using py2applet to build a tool that uses paramiko/pycrypto. Everything seems to build fine, but I get an error when launching my app that pycrypto's Crypto/Util/_counter.so object couldn't be found. It looks like the app is trying to load it from the OS installed Python, which I am a bit surprised by, since I've included --site-packages, and everything appears to be getting bundled up correctly. I poked around in the module and didn't find any hard-coded paths or anything like that, so I'm at a loss, but it looks like it's attempting to load from /usr/lib instead of my App's bundle... is that a red herring, or is it really loading from the wrong place? The _counter.so file is definitely present in the App's Contents/Resources/lib/python2.7/lib-dynload directory, but the app isn't apparently finding it when it launches. Here's the error that I'm seeing: 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/__init__.py, line 69, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/transport.py, line 32, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/util.py, line 32, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/common.py, line 98, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/__init__.py, line 29, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/_UserFriendlyRNG.py, line 38, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaAccumulator.py, line 39, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaGenerator.py, line 35, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Util/Counter.py, line 30, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File Crypto/Util/_counter.pyc, line 18, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File Crypto/Util/_counter.pyc, line 15, in __load 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: ImportError: '/usr/lib/python2.7/lib-dynload/Crypto/Util/_counter.so' not found Thanks for any suggestions. - Terry ___ 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] py2app - ImportError using pycrypto
Which version of py2app do you use? Do you use the system python (/usr/bin/python) or a custom install (python.org installer, macports, homebrew, self built, ...)? If you use the system python: which OSX release do you use? Ronald On 11 Apr, 2012, at 10:51, Terry Simons wrote: Hi, I'm using py2applet to build a tool that uses paramiko/pycrypto. Everything seems to build fine, but I get an error when launching my app that pycrypto's Crypto/Util/_counter.so object couldn't be found. It looks like the app is trying to load it from the OS installed Python, which I am a bit surprised by, since I've included --site-packages, and everything appears to be getting bundled up correctly. I poked around in the module and didn't find any hard-coded paths or anything like that, so I'm at a loss, but it looks like it's attempting to load from /usr/lib instead of my App's bundle... is that a red herring, or is it really loading from the wrong place? The _counter.so file is definitely present in the App's Contents/Resources/lib/python2.7/lib-dynload directory, but the app isn't apparently finding it when it launches. Here's the error that I'm seeing: 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/__init__.py, line 69, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/transport.py, line 32, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/util.py, line 32, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/common.py, line 98, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/__init__.py, line 29, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/_UserFriendlyRNG.py, line 38, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaAccumulator.py, line 39, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaGenerator.py, line 35, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Util/Counter.py, line 30, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File Crypto/Util/_counter.pyc, line 18, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File Crypto/Util/_counter.pyc, line 15, in __load 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: ImportError: '/usr/lib/python2.7/lib-dynload/Crypto/Util/_counter.so' not found Thanks for any suggestions. - Terry ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG 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] py2app - ImportError using pycrypto
I'm using py2app 0.6.4 with the system python 2.7.1 on Mac OS X 10.7.3. - Terry On Apr 11, 2012, at 2:17 AM, Ronald Oussoren wrote: Which version of py2app do you use? Do you use the system python (/usr/bin/python) or a custom install (python.org installer, macports, homebrew, self built, ...)? If you use the system python: which OSX release do you use? Ronald On 11 Apr, 2012, at 10:51, Terry Simons wrote: Hi, I'm using py2applet to build a tool that uses paramiko/pycrypto. Everything seems to build fine, but I get an error when launching my app that pycrypto's Crypto/Util/_counter.so object couldn't be found. It looks like the app is trying to load it from the OS installed Python, which I am a bit surprised by, since I've included --site-packages, and everything appears to be getting bundled up correctly. I poked around in the module and didn't find any hard-coded paths or anything like that, so I'm at a loss, but it looks like it's attempting to load from /usr/lib instead of my App's bundle... is that a red herring, or is it really loading from the wrong place? The _counter.so file is definitely present in the App's Contents/Resources/lib/python2.7/lib-dynload directory, but the app isn't apparently finding it when it launches. Here's the error that I'm seeing: 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/__init__.py, line 69, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/transport.py, line 32, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/util.py, line 32, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/paramiko/common.py, line 98, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/__init__.py, line 29, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/_UserFriendlyRNG.py, line 38, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaAccumulator.py, line 39, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Random/Fortuna/FortunaGenerator.py, line 35, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File build/bdist.macosx-10.7-intel/egg/Crypto/Util/Counter.py, line 30, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File Crypto/Util/_counter.pyc, line 18, in module 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File Crypto/Util/_counter.pyc, line 15, in __load 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: ImportError: '/usr/lib/python2.7/lib-dynload/Crypto/Util/_counter.so' not found Thanks for any suggestions. - Terry ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ 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] py2app: ImportError
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'. Ronald -- Sean Robinson Laboratory Technician Physics Astronomy Geology sean.robin...@sccmail.maricopa.edu quot-test.zip 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] py2app: ImportError
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... -- 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] py2app: ImportError
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 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
[Pythonmac-SIG] py2app: ImportError
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? Log from 'python setup.py py2app': running py2app creating /Users/robinson_s/Desktop/quotidian/build creating /Users/robinson_s/Desktop/quotidian/build/bdist.macosx-10.6-universal creating /Users/robinson_s/Desktop/quotidian/build/bdist.macosx-10.6-universal/python2.6-semi_standalone creating /Users/robinson_s/Desktop/quotidian/build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app creating /Users/robinson_s/Desktop/quotidian/build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/collect creating /Users/robinson_s/Desktop/quotidian/build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/temp creating /Users/robinson_s/Desktop/quotidian/dist creating build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/lib-dynload creating build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/Frameworks *** using recipe: virtualenv *** *** filtering dependencies *** 389 total 378 filtered 0 orphaned 11 remaining *** create binaries *** *** byte compile python files *** byte-compiling /Users/robinson_s/.local/lib/python2.6/site-packages/py2app-0.6.4-py2.6.egg/py2app/bootstrap/argv_emulation.py to argv_emulation.pyc byte-compiling /Users/robinson_s/.local/lib/python2.6/site-packages/py2app-0.6.4-py2.6.egg/py2app/bootstrap/boot_app.py to boot_app.pyc byte-compiling /Users/robinson_s/.local/lib/python2.6/site-packages/py2app-0.6.4-py2.6.egg/py2app/bootstrap/chdir_resource.py to chdir_resource.pyc byte-compiling /Users/robinson_s/.local/lib/python2.6/site-packages/py2app-0.6.4-py2.6.egg/py2app/bootstrap/disable_linecache.py to disable_linecache.pyc byte-compiling /Users/robinson_s/Desktop/quotidian/quotidian.py to quotidian.pyc byte-compiling /Users/robinson_s/Desktop/quotidian/quotidian/__init__.py to quotidian/__init__.pyc creating /Users/robinson_s/Desktop/quotidian/build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/collect/quotidian byte-compiling /Users/robinson_s/Desktop/quotidian/quotidian/gui/__init__.py to quotidian/gui/__init__.pyc creating /Users/robinson_s/Desktop/quotidian/build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/collect/quotidian/gui byte-compiling /Users/robinson_s/Desktop/quotidian/quotidian/queue.py to quotidian/queue.pyc byte-compiling /Users/robinson_s/Desktop/quotidian/quotidian/sound/__init__.py to quotidian/sound/__init__.pyc creating /Users/robinson_s/Desktop/quotidian/build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/collect/quotidian/sound byte-compiling /Users/robinson_s/Desktop/quotidian/quotidian/sound/linux.py to quotidian/sound/linux.pyc byte-compiling /Users/robinson_s/Desktop/quotidian/quotidian/sound/macosx.py to quotidian/sound/macosx.pyc creating /Users/robinson_s/Desktop/quotidian/build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/collect/quotidian/tests copying /Users/robinson_s/Desktop/quotidian/quotidian/tests/.directory - /Users/robinson_s/Desktop/quotidian/build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/collect/quotidian/tests *** creating application bundle: quotidian *** copying quotidian.py - /Users/robinson_s/Desktop/quotidian/dist/quotidian.app/Contents/Resources creating /Users/robinson_s/Desktop/quotidian/dist/quotidian.app/Contents/Resources/lib creating /Users/robinson_s/Desktop/quotidian/dist/quotidian.app/Contents/Resources/lib/python2.6 copying build/bdist.macosx-10.6-universal/python2.6-semi_standalone/app/site-packages.zip - /Users/robinson_s/Desktop/quotidian/dist/quotidian.app/Contents/Resources/lib/python2.6 creating /Users/robinson_s/Desktop/quotidian/dist/quotidian.app/Contents/Resources/lib/python2.6/lib-dynload creating /Users/robinson_s/Desktop/quotidian/dist/quotidian.app/Contents/Frameworks stripping quotidian stripping saved 0 bytes (173512 / 173512) Error: Traceback (most recent call last): File /Users/robinson_s/Desktop/quotidian/dist/quotidian.app/Contents/Resources/__boot__.py, line 306, in module _run('quotidian.py') File /Users/robinson_s/Desktop/quotidian/dist/quotidian.app/Contents/Resources/__boot__.py, line 303, in _run execfile(path, globals(), globals()) File
[Pythonmac-SIG] py2app ImportError
My py2app-build application crashes with an ImportError. I'm using the standard python 2.5 framework from http://www.python.org/ download/ and py2app 0.3.5 build from sources. I followed the py2app tutorial and tried in alias mode first. Here's my setup.py: -- This is a setup.py script generated by py2applet Usage: python setup.py py2app from setuptools import setup APP = ['hitaext.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': True} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) -- My app runs fine. However, after building for deployment, running my app results in the following error: -- $ rm -rf build dist python setup.py py2app ... $ dist/hitaext.app/Contents/MacOS/hitaext Traceback (most recent call last): File /Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/ dist/hitaext.app/Contents/Resources/__boot__.py, line 137, in module _run('hitaext.py') File /Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/ dist/hitaext.app/Contents/Resources/__boot__.py, line 134, in _run execfile(path, globals(), globals()) File /Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/ dist/hitaext.app/Contents/Resources/hitaext.py, line 17, in module from ielemtree import IndexElemTree File /Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/ dist/hitaext.app/Contents/Resources/lib/python2.5/ielemtree.pyc, line 11, in module ImportError: cannot import name ElementTree 2007-02-05 21:32:48.840 hitaext[4505] hitaext Error 2007-02-05 21:32:48.843 hitaext[4505] hitaext Error An unexpected error has occurred during execution of the main script ImportError: cannot import name ElementTree -- Any ideas on what went wrong and how to fix it? thanks, Erwin ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] py2app ImportError
On 6 Feb, 2007, at 9:37, Erwin Marsi wrote: My py2app-build application crashes with an ImportError. I'm using the standard python 2.5 framework from http://www.python.org/ download/ and py2app 0.3.5 build from sources. I followed the py2app tutorial and tried in alias mode first. Here's my setup.py: -- This is a setup.py script generated by py2applet Usage: python setup.py py2app from setuptools import setup APP = ['hitaext.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': True} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) -- My app runs fine. However, after building for deployment, running my app results in the following error: -- $ rm -rf build dist python setup.py py2app ... $ dist/hitaext.app/Contents/MacOS/hitaext Traceback (most recent call last): File /Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/ dist/hitaext.app/Contents/Resources/__boot__.py, line 137, in module _run('hitaext.py') File /Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/ dist/hitaext.app/Contents/Resources/__boot__.py, line 134, in _run execfile(path, globals(), globals()) File /Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/ dist/hitaext.app/Contents/Resources/hitaext.py, line 17, in module from ielemtree import IndexElemTree File /Users/erwin/Projects/Daeso/trunk/software/intern/hitaext/ dist/hitaext.app/Contents/Resources/lib/python2.5/ielemtree.pyc, line 11, in module ImportError: cannot import name ElementTree 2007-02-05 21:32:48.840 hitaext[4505] hitaext Error 2007-02-05 21:32:48.843 hitaext[4505] hitaext Error An unexpected error has occurred during execution of the main script ImportError: cannot import name ElementTree -- Any ideas on what went wrong and how to fix it? How does ielemtree import ElementTree? Does it use an import statement or does it call __import__ directly? py2app can only detect imports that are done using the import statement. Ronald thanks, Erwin ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig
Re: [Pythonmac-SIG] py2app ImportError
On 6 Feb, 2007, at 10:35, Erwin Marsi wrote: On Feb 6, 2007, at 10:23, Ronald Oussoren wrote: How does ielemtree import ElementTree? Does it use an import statement or does it call __import__ directly? py2app can only detect imports that are done using the import statement. Ronald It uses a normal import statement: from xml.etree.cElementTree import ElementTree I found the problem, xml.etree.cElementTree imports _elementtree, a C extension. That extension does a number of imports from C which py2app doesn't know about and cannot find out about automaticly. I've checked in a fix, if you upgrade modulegraph to the current trunk all should be fine (easy_install-2.5 modulegraph==dev). Ronald ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig