From zarf at klacto.net Sun Apr 8 16:20:01 2012 From: zarf at klacto.net (FZiegler) Date: Sun, 08 Apr 2012 10:20:01 -0400 Subject: [Pythonmac-SIG] Setting metadata (creator, type, or uti) Message-ID: <4F819E91.7060006@klacto.net> I've been using a dovecot IMAP server on localhost as my local mail store (to have it in standard Maildir format and accessible by any client). I also want to make it searchable in Spotlight. Ideally this could be done by appending '.eml' to every mail file so that they get picked up by Apple's mail importer; unfortunately this is ruled out by dovecot's existing scheme to name emails. The workaround I found is the Mew importer (http://www.mew.org/en/feature/spotlight.html) which can work based on Mac file type. For this I periodically set all messages' HFS file type with this script: import os, fnmatch for root, dirs, files in os.walk('/Volumes/Home/FZ/Mail'): for filename in files: if not fnmatch.fnmatch(filename, 'dovecot*'): filepath = os.path.join(root, filename) os.system('/usr/bin/SetFile -t MewX \"' + filepath + '\"') This works, but is very slow with 20,000+ system calls per run. Hence my questions: 1) Is there a more efficient way to set file type? I tried using library functions in Carbon.File.FSSpec instead, but found that they no longer work (http://bugs.python.org/issue7807). 2) Or is something else (the 'uti'?) I could set so that the mails actually get indexed by Apple's mail importer? Following is some possibly relevant output of `locate lsregister` -dump. Thanks, Francois Z. -------------------------------------------------------- type id: 20368 uti: com.apple.mail.email description: Email Message flags: exported active apple-internal trusted icon: Contents/Resources/document.icns conforms to: public.data, public.email-message tags: .eml, message/rfc822 -------------------------------------------------------- -------------------------------------------------------- type id: 21916 uti: org.mew.mew description: Mew message text flags: exported active trusted icon: delegate: Spotlight/MewImporter.mdimporter/ conforms to: public.message, public.data, public.content tags: .mew, 'MewX' -------------------------------------------------------- From ronaldoussoren at mac.com Mon Apr 9 11:51:44 2012 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Mon, 09 Apr 2012 11:51:44 +0200 Subject: [Pythonmac-SIG] Setting metadata (creator, type, or uti) In-Reply-To: <4F819E91.7060006@klacto.net> References: <4F819E91.7060006@klacto.net> Message-ID: On 8 Apr, 2012, at 16:20, FZiegler wrote: > I've been using a dovecot IMAP server on localhost as my local mail store (to have it in standard Maildir format and accessible by any client). I also want to make it searchable in Spotlight. > > Ideally this could be done by appending '.eml' to every mail file so that they get picked up by Apple's mail importer; unfortunately this is ruled out by dovecot's existing scheme to name emails. The workaround I found is the Mew importer (http://www.mew.org/en/feature/spotlight.html) which can work based on Mac file type. For this I periodically set all messages' HFS file type with this script: > > > import os, fnmatch > > for root, dirs, files in os.walk('/Volumes/Home/FZ/Mail'): > for filename in files: > if not fnmatch.fnmatch(filename, 'dovecot*'): > filepath = os.path.join(root, filename) > os.system('/usr/bin/SetFile -t MewX \"' + filepath + '\"') > > > This works, but is very slow with 20,000+ system calls per run. Hence my questions: > > 1) Is there a more efficient way to set file type? I tried using library functions in Carbon.File.FSSpec instead, but found that they no longer work (http://bugs.python.org/issue7807). MacOS.SetCreatorAndType(filename, creator, type) works both in 32-bit and 64-bit versions of python (I've tested this with 2.7). FSSpec is not available in 64-bit builds because those APIs don't exist in the 64-bit version of Carbon.framework. BTW. Neither version is available in python 3 because we dropped the Carbon bindings in python 3.0. That was done because those bindings were unmaintained and were generated from the MacOS 9 header files. > > 2) Or is something else (the 'uti'?) I could set so that the mails actually get indexed by Apple's mail importer? Following is some possibly relevant output of `locate lsregister` -dump. As far as I know there is no extended attribute for storing the UTI, otherwise you could have used that. That means you can only use Apple's importer when you use the ".eml" filename extension. Ronald > > Thanks, > Francois Z. > > -------------------------------------------------------- > type id: 20368 > uti: com.apple.mail.email > description: Email Message > flags: exported active apple-internal trusted > icon: Contents/Resources/document.icns > conforms to: public.data, public.email-message > tags: .eml, message/rfc822 > -------------------------------------------------------- > -------------------------------------------------------- > type id: 21916 > uti: org.mew.mew > description: Mew message text > flags: exported active trusted > icon: > delegate: Spotlight/MewImporter.mdimporter/ > conforms to: public.message, public.data, public.content > tags: .mew, 'MewX' > -------------------------------------------------------- > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4788 bytes Desc: not available URL: From zarf at klacto.net Mon Apr 9 18:36:54 2012 From: zarf at klacto.net (FZiegler) Date: Mon, 09 Apr 2012 12:36:54 -0400 Subject: [Pythonmac-SIG] Setting metadata (creator, type, or uti) In-Reply-To: References: <4F819E91.7060006@klacto.net> Message-ID: <4F831026.80608@klacto.net> Ronald Oussoren wrote: > > MacOS.SetCreatorAndType(filename, creator, type) works both in 32-bit and 64-bit versions of python (I've tested this with 2.7). Thanks! Indeed this works, and does exactly what I wanted -- real fast. Thanks also to Karsten for your solution, which is already much faster than mine. Francois Z. From terry.simons at gmail.com Wed Apr 11 10:51:13 2012 From: terry.simons at gmail.com (Terry Simons) Date: Wed, 11 Apr 2012 01:51:13 -0700 Subject: [Pythonmac-SIG] py2app - ImportError using pycrypto Message-ID: <5DD51BE1-7B4F-484D-BEDB-2EB8FF628E34@gmail.com> 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 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 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 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 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 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 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 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 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 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File "Crypto/Util/_counter.pyc", line 18, in 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 From ronaldoussoren at mac.com Wed Apr 11 11:17:46 2012 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 11 Apr 2012 11:17:46 +0200 Subject: [Pythonmac-SIG] py2app - ImportError using pycrypto In-Reply-To: <5DD51BE1-7B4F-484D-BEDB-2EB8FF628E34@gmail.com> References: <5DD51BE1-7B4F-484D-BEDB-2EB8FF628E34@gmail.com> Message-ID: <4890ECE2-264A-417B-BB82-122C97E833BA@mac.com> 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 > 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 > 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 > 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 > 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 > 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 > 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 > 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 > 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 > 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File "Crypto/Util/_counter.pyc", line 18, in > 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 at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4788 bytes Desc: not available URL: From terry.simons at gmail.com Wed Apr 11 18:13:39 2012 From: terry.simons at gmail.com (Terry Simons) Date: Wed, 11 Apr 2012 09:13:39 -0700 Subject: [Pythonmac-SIG] py2app - ImportError using pycrypto In-Reply-To: <4890ECE2-264A-417B-BB82-122C97E833BA@mac.com> References: <5DD51BE1-7B4F-484D-BEDB-2EB8FF628E34@gmail.com> <4890ECE2-264A-417B-BB82-122C97E833BA@mac.com> Message-ID: 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 >> 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 >> 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 >> 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 >> 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 >> 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 >> 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 >> 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 >> 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 >> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File "Crypto/Util/_counter.pyc", line 18, in >> 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 at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > From terry.simons at gmail.com Thu Apr 12 08:59:52 2012 From: terry.simons at gmail.com (Terry Simons) Date: Wed, 11 Apr 2012 23:59:52 -0700 Subject: [Pythonmac-SIG] py2app - ImportError using pycrypto In-Reply-To: References: <5DD51BE1-7B4F-484D-BEDB-2EB8FF628E34@gmail.com> <4890ECE2-264A-417B-BB82-122C97E833BA@mac.com> Message-ID: <1EBA1237-D4A1-4E3B-9077-D5A1E5BE8F18@gmail.com> 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 >>> 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 >>> 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 >>> 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 >>> 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 >>> 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 >>> 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 >>> 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 >>> 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 >>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File "Crypto/Util/_counter.pyc", line 18, in >>> 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 at python.org >>> http://mail.python.org/mailman/listinfo/pythonmac-sig >>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG >> > From ronaldoussoren at mac.com Thu Apr 12 10:30:27 2012 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 12 Apr 2012 10:30:27 +0200 Subject: [Pythonmac-SIG] py2app - ImportError using pycrypto In-Reply-To: <1EBA1237-D4A1-4E3B-9077-D5A1E5BE8F18@gmail.com> References: <5DD51BE1-7B4F-484D-BEDB-2EB8FF628E34@gmail.com> <4890ECE2-264A-417B-BB82-122C97E833BA@mac.com> <1EBA1237-D4A1-4E3B-9077-D5A1E5BE8F18@gmail.com> Message-ID: <79C85D20-747B-49B9-9C78-64D5D5978829@mac.com> 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 >>>> 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 >>>> 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 >>>> 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 >>>> 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 >>>> 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 >>>> 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 >>>> 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 >>>> 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 >>>> 4/11/12 1:29:47.273 AM [0x0-0x115115].org.pythonmac.unspecified.test_example: File "Crypto/Util/_counter.pyc", line 18, in >>>> 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 at python.org >>>> http://mail.python.org/mailman/listinfo/pythonmac-sig >>>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG >>> >> > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4788 bytes Desc: not available URL: From rowen at uw.edu Thu Apr 12 21:29:33 2012 From: rowen at uw.edu (Russell E. Owen) Date: Thu, 12 Apr 2012 12:29:33 -0700 Subject: [Pythonmac-SIG] New unofficial binary installers Message-ID: I just created some unofficial binary installers for the python.org's 64-bit python 2.7.2 for Mac OS X 10.6 and later. They are available here: and include: - pyfits 3.0.7 (did not run unit tests; I can't seem to find them) - PIL 1.1.7 (includes all dependencies and passes all tests) - pygame 1.9.1 (includes all dependencies except SCAN; of 408 tests there were 3 errors--including two png tests--and two failures) -- Russell From poalman at gmail.com Fri Apr 13 14:46:11 2012 From: poalman at gmail.com (Paul) Date: Fri, 13 Apr 2012 12:46:11 +0000 (UTC) Subject: [Pythonmac-SIG] Error upgrading py2app from 0.6.3 to 0.6.4, and building with AppKit import Message-ID: After upgrading from py2app 0.6.3 to 0.6.4 when I run my build script I get the following error: creating python loader for extension 'wx._controls_' error: /Users/testadmin/Source/PythonApp/build/bdist.macosx-10.3-fat/ python2.7-standalone/app/temp/wx/_controls_.py: No such file or directory If I switch back to 0.6.3 everything works fine again. The reason I was trying 0.6.4 is I have an odd problem where I've added some imports from the AppKit module (from AppKit import NSApp,NSApplication) and it works fine when running the program straight through python, but after building with py2app when I run it I get a "quit unexpectedly" error, with EXC_BAD_ACCESS (SIGBUS) as the reason with the following traceback in console: Traceback (most recent call last): File "/Applications/ZipCloud.app/Contents/Resources/__boot__.py", line 187, in _run('mainframe.py') File "/Applications/ZipCloud.app/Contents/Resources/__boot__.py", line 184, in _run execfile(path, globals(), globals()) File "/Applications/ZipCloud.app/Contents/Resources/mainframe.py", line 1, in import PythonApp.mainframe_main_new File "PythonApp/mainframe_main_new.pyc", line 122, in File "PythonApp/mainframe_mac.pyc", line 18, in File "PythonApp/backup.pyc", line 49, in File "PythonApp/popups.pyc", line 17, in File "PythonApp/newpops.pyc", line 6, in File "AppKit/__init__.pyc", line 9, in File "Foundation/__init__.pyc", line 10, in File "CoreFoundation/__init__.pyc", line 19, in File "objc/_bridgesupport.pyc", line 140, in initFrameworkWrapper File "objc/_bridgesupport.pyc", line 42, in _parseBridgeSupport ValueError: Don't know CF type for typestr '^{__CFAllocator=}', cannot create special wrapper I'm guessing this must be something is getting left out when the dependancies are being pulled in? but I'm really not sure! From sdl.web at gmail.com Tue Apr 17 06:11:48 2012 From: sdl.web at gmail.com (Leo) Date: Tue, 17 Apr 2012 12:11:48 +0800 Subject: [Pythonmac-SIG] Python completion in emacs fails on OSX Message-ID: <87ehrn80aj.fsf@gmail.com> It seems the python interpreter built by Apple doesn't behave like the ones built from upstream. See this: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10295#19 Any idea what's happened to python from apple? Leo From nad at acm.org Tue Apr 17 09:56:20 2012 From: nad at acm.org (Ned Deily) Date: Tue, 17 Apr 2012 00:56:20 -0700 Subject: [Pythonmac-SIG] Python completion in emacs fails on OSX References: <87ehrn80aj.fsf@gmail.com> Message-ID: In article <87ehrn80aj.fsf at gmail.com>, Leo wrote: > It seems the python interpreter built by Apple doesn't behave like the > ones built from upstream. > > See this: > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10295#19 > > Any idea what's happened to python from apple? Off the top of my head, I suspect the most likely cause to be that the Apple system pythons are built with the BSD editline library rather than with GNU readline. You could try installing the third-party "readline" package which replaces the Python standard library "readline" module with one linked with GNU readline. http://pypi.python.org/pypi/readline -- Ned Deily, nad at acm.org From sdl.web at gmail.com Tue Apr 17 07:33:04 2012 From: sdl.web at gmail.com (Leo) Date: Tue, 17 Apr 2012 13:33:04 +0800 Subject: [Pythonmac-SIG] Python completion in emacs fails on OSX References: <87ehrn80aj.fsf@gmail.com> Message-ID: <87aa2a9b3j.fsf@gmail.com> On 2012-04-17 15:56 +0800, Ned Deily wrote: > Off the top of my head, I suspect the most likely cause to be that the > Apple system pythons are built with the BSD editline library rather than > with GNU readline. You could try installing the third-party "readline" > package which replaces the Python standard library "readline" module > with one linked with GNU readline. > > http://pypi.python.org/pypi/readline I have just tested it and no, it is not due to readline. Leo From janssen at parc.com Tue Apr 17 17:27:58 2012 From: janssen at parc.com (Bill Janssen) Date: Tue, 17 Apr 2012 08:27:58 PDT Subject: [Pythonmac-SIG] Python completion in emacs fails on OSX In-Reply-To: <87ehrn80aj.fsf@gmail.com> References: <87ehrn80aj.fsf@gmail.com> Message-ID: <64907.1334676478@parc.com> This is really an Emacs issue, not a Python issue. I don't even see where they say they are both using the version of the Python interpreter. Bill Leo wrote: > It seems the python interpreter built by Apple doesn't behave like the > ones built from upstream. > > See this: > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10295#19 > > Any idea what's happened to python from apple? > > Leo > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG From joaoleao at gmx.net Tue Apr 17 17:48:41 2012 From: joaoleao at gmx.net (=?iso-8859-1?Q?Jo=E3o_Le=E3o?=) Date: Tue, 17 Apr 2012 16:48:41 +0100 Subject: [Pythonmac-SIG] Problems with CoreGraphics API post-Snow Leopard Message-ID: Hi list I have an old script using the CoreGraphics API that's no longer working properly since Snow Leopard. I' running Lion with the default Python, which is 2.7.1. I googled about this and it seems that's because Python is 64-bit now and some old data types don't work anymore. The first error I got was in the function CGBitmapContextCreateWithColor. The Console spits the following error: --- TypeError: in method 'CGBitmapContextCreateWithColor', argument 4 of type 'CGFloat const [5]' --- My code looks like this: c = CGBitmapContextCreateWithColor(new_Width, new_Height, cs, (0,0,0,0)) The problem is in the last argument "(0, 0, 0, 0)" [a color reference] which, the new API expects to be CGFloatArray. I couldn't find any documentation on how to create such an object in python but, fortunately, I found some code here http://stuffineededtoknow.blogspot.pt/2009_01_01_archive.html that solved this issue: --- bg = CGFloatArray(5) c = CGBitmapContextCreateWithColor(new_Width, new_Height, cs, bg) --- But now I'm getting another error (and I'll probably get some more) with another function that expects a CGFloat object instead of a plain integer. The code looks like this: --- self.pdf.drawPlainTextInRect(text_prov, textRect, 10) --- And the error (again caused by the last argument, in this case "10"): --- TypeError: in method 'CGContext_drawPlainTextInRect', argument 4 of type 'CGFloat' --- I'm sure that it can't be so hard to create a CGFloat but I didn't find the right documentation or sample code to do it. Does anybody know how to do this? Thanks in advance. Jo?o From janssen at parc.com Tue Apr 17 18:13:24 2012 From: janssen at parc.com (Bill Janssen) Date: Tue, 17 Apr 2012 09:13:24 PDT Subject: [Pythonmac-SIG] Problems with CoreGraphics API post-Snow Leopard In-Reply-To: References: Message-ID: <65791.1334679204@parc.com> Jo?o Le?o wrote: > But now I'm getting another error (and I'll probably get some more) with another function that expects a CGFloat object instead of a plain integer. > The code looks like this: > --- > self.pdf.drawPlainTextInRect(text_prov, textRect, 10) > --- > > And the error (again caused by the last argument, in this case "10"): > --- > TypeError: in method 'CGContext_drawPlainTextInRect', argument 4 of type 'CGFloat' > --- > > > I'm sure that it can't be so hard to create a CGFloat but I didn't find the right documentation or sample code to do it. > Does anybody know how to do this? Did you try "self.pdf.drawPlainTextInRect(text_prov, textRect, 10.0)"? Bill From joaoleao at gmx.net Tue Apr 17 18:17:47 2012 From: joaoleao at gmx.net (=?iso-8859-1?Q?Jo=E3o_Le=E3o?=) Date: Tue, 17 Apr 2012 17:17:47 +0100 Subject: [Pythonmac-SIG] Problems with CoreGraphics API post-Snow Leopard In-Reply-To: <65791.1334679204@parc.com> References: <65791.1334679204@parc.com> Message-ID: <7AF011C9-0F06-4859-90BD-EFC2FBFD5A5D@gmx.net> > Jo?o Le?o wrote: > >> But now I'm getting another error (and I'll probably get some more) with another function that expects a CGFloat object instead of a plain integer. >> The code looks like this: >> --- >> self.pdf.drawPlainTextInRect(text_prov, textRect, 10) >> --- >> >> And the error (again caused by the last argument, in this case "10"): >> --- >> TypeError: in method 'CGContext_drawPlainTextInRect', argument 4 of type 'CGFloat' >> --- >> >> >> I'm sure that it can't be so hard to create a CGFloat but I didn't find the right documentation or sample code to do it. >> Does anybody know how to do this? > > Did you try "self.pdf.drawPlainTextInRect(text_prov, textRect, 10.0)"? Yes I did, but it didn't work. Thanks anyway. > > Bill From sdl.web at gmail.com Wed Apr 18 02:04:03 2012 From: sdl.web at gmail.com (Leo) Date: Wed, 18 Apr 2012 08:04:03 +0800 Subject: [Pythonmac-SIG] Python completion in emacs fails on OSX References: <87ehrn80aj.fsf@gmail.com> <64907.1334676478@parc.com> Message-ID: <871unl9a8c.fsf@gmail.com> On 2012-04-17 23:27 +0800, Bill Janssen wrote: > This is really an Emacs issue, not a Python issue. I don't even see > where they say they are both using the version of the Python interpreter. Unthinkable. I have built python 2.7.3 from upstream and see no such bug. Something is done to python apple. Leo From sdl.web at gmail.com Wed Apr 18 15:44:37 2012 From: sdl.web at gmail.com (Leo) Date: Wed, 18 Apr 2012 21:44:37 +0800 Subject: [Pythonmac-SIG] These modules are deprecated and have been removed in Python 3.x Message-ID: On this page: http://docs.python.org/library/mac.html, so what replace these removed modules? Thanks. Leo From kw at codebykevin.com Wed Apr 18 16:00:23 2012 From: kw at codebykevin.com (Kevin Walzer) Date: Wed, 18 Apr 2012 10:00:23 -0400 Subject: [Pythonmac-SIG] These modules are deprecated and have been removed in Python 3.x In-Reply-To: References: Message-ID: <4F8EC8F7.90104@codebykevin.com> On 4/18/12 9:44 AM, Leo wrote: > On this page: http://docs.python.org/library/mac.html, so what replace > these removed modules? > > Thanks. > > Leo Nothing did, really. Those modules are legacy ones dating back to the days of OS 9, and were automatically generated from the Carbon framework's headers by a tool (bgen) that few understood a decade ago and no one understands today. Many of the functions are not 64-bit, and untangling that would be a nightmare. There are various ways to get at the functionality that these modules offered: use PyObjC; use other functions from the standard library, since these functions pre-date OS X running on top of Unix; or, if you are really in need of specific functionality offered by one of the Carbon modules, code your own C wrapper library or use Ctypes. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From sdl.web at gmail.com Wed Apr 18 16:16:16 2012 From: sdl.web at gmail.com (Leo) Date: Wed, 18 Apr 2012 22:16:16 +0800 Subject: [Pythonmac-SIG] These modules are deprecated and have been removed in Python 3.x References: <4F8EC8F7.90104@codebykevin.com> Message-ID: On 2012-04-18 22:00 +0800, Kevin Walzer wrote: > Nothing did, really. Those modules are legacy ones dating back to the > days of OS 9, and were automatically generated from the Carbon > framework's headers by a tool (bgen) that few understood a decade ago > and no one understands today. Many of the functions are not 64-bit, > and untangling that would be a nightmare. > > There are various ways to get at the functionality that these modules > offered: use PyObjC; use other functions from the standard library, > since these functions pre-date OS X running on top of Unix; or, if you > are really in need of specific functionality offered by one of the > Carbon modules, code your own C wrapper library or use Ctypes. Thank you for this information. Leo From sdl.web at gmail.com Wed Apr 18 19:16:56 2012 From: sdl.web at gmail.com (Leo) Date: Thu, 19 Apr 2012 01:16:56 +0800 Subject: [Pythonmac-SIG] Python completion in emacs fails on OSX References: <87ehrn80aj.fsf@gmail.com> <64907.1334676478@parc.com> <871unl9a8c.fsf@gmail.com> Message-ID: turns out it is apple's fault: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10295#46 Leo From nad at acm.org Wed Apr 18 20:04:16 2012 From: nad at acm.org (Ned Deily) Date: Wed, 18 Apr 2012 11:04:16 -0700 Subject: [Pythonmac-SIG] Python completion in emacs fails on OSX References: <87ehrn80aj.fsf@gmail.com> <64907.1334676478@parc.com> <871unl9a8c.fsf@gmail.com> Message-ID: In article , Leo wrote: > turns out it is apple's fault: > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10295#46 Well, it's not the fault of Apple's Pythons. If the problem is the echo, you can see exactly the same results by using a current python.org 64-/32-bit Python. Those Pythons, like the Apple-supplied system Pythons, are linked with BSD editline. If, instead, you install the corresponding python.org 32-bit-only Python, the echo remains turned off. As I mentioned before, the 32-bit-only Python is linked with GNU readline. That's the only difference I can think of that makes sense. (I see the same results with both OS X 10.6 and 10.7, BTW.) So, if there is a problem, the likely culprit is libedit, the editline library. Another clue: try using another Apple-supplied utility that is linked with libedit, for example, dscl. Same thing happens there: echo is immediately re-enabled. -- Ned Deily, nad at acm.org From sdl.web at gmail.com Wed Apr 18 20:55:37 2012 From: sdl.web at gmail.com (Leo) Date: Thu, 19 Apr 2012 02:55:37 +0800 Subject: [Pythonmac-SIG] Python completion in emacs fails on OSX References: <87ehrn80aj.fsf@gmail.com> <64907.1334676478@parc.com> <871unl9a8c.fsf@gmail.com> Message-ID: On 2012-04-19 02:04 +0800, Ned Deily wrote: > So, if there is a problem, the likely culprit is libedit, the editline > library. Another clue: try using another Apple-supplied utility that > is linked with libedit, for example, dscl. Same thing happens there: > echo is immediately re-enabled. Thank you. I can confirm it is libedit the culprit. Leo From ronaldoussoren at mac.com Thu Apr 19 11:16:02 2012 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 19 Apr 2012 11:16:02 +0200 Subject: [Pythonmac-SIG] Problems with CoreGraphics API post-Snow Leopard In-Reply-To: References: Message-ID: <864723C4-D857-4152-8449-23911D0A0C18@mac.com> On 17 Apr, 2012, at 17:48, Jo?o Le?o wrote: > Hi list > > I have an old script using the CoreGraphics API that's no longer working properly since Snow Leopard. > I' running Lion with the default Python, which is 2.7.1. > I googled about this and it seems that's because Python is 64-bit now and some old data types don't work anymore. Which library do you use? That is, is there "import CoreGraphics" at the top of your file or "import Quartz"? The former is a Apple library, the latter is part of PyObjC. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4788 bytes Desc: not available URL: From joaoleao at gmx.net Thu Apr 19 13:32:51 2012 From: joaoleao at gmx.net (=?iso-8859-1?Q?Jo=E3o_Le=E3o?=) Date: Thu, 19 Apr 2012 12:32:51 +0100 Subject: [Pythonmac-SIG] Problems with CoreGraphics API post-Snow Leopard In-Reply-To: <864723C4-D857-4152-8449-23911D0A0C18@mac.com> References: <864723C4-D857-4152-8449-23911D0A0C18@mac.com> Message-ID: <4071A8B0-5C02-4D9A-A935-93BCEA6EF838@gmx.net> On Apr 19, 2012, at 10:16 AM, Ronald Oussoren wrote: > > On 17 Apr, 2012, at 17:48, Jo?o Le?o wrote: > >> Hi list >> >> I have an old script using the CoreGraphics API that's no longer working properly since Snow Leopard. >> I' running Lion with the default Python, which is 2.7.1. >> I googled about this and it seems that's because Python is 64-bit now and some old data types don't work anymore. > > Which library do you use? That is, is there "import CoreGraphics" at the top of your file or "import Quartz"? The former is a Apple library, the latter is part of PyObjC. import CoreGraphics. It?s the Apple library. > > Ronald > From chris.barker at noaa.gov Fri Apr 20 18:37:15 2012 From: chris.barker at noaa.gov (Chris Barker) Date: Fri, 20 Apr 2012 09:37:15 -0700 Subject: [Pythonmac-SIG] New unofficial binary installers In-Reply-To: References: Message-ID: Russell, Thanks for doing these (and the others you've done) It seems to me that there is still a need for an "official" location for such binaries. Bob Ippolito used to have such a site back in the day, and while it's less necessary now (more package developers provide their own binaries), there is still a need. It would be really nice for MacPython users to have a one-stop shopping location for packages. I imagine something very simple -- a page you can download from, that could be uploaded to by a handful of us that build compatible packages. Anyone have an idea where to host such an page? -Chris On Thu, Apr 12, 2012 at 12:29 PM, Russell E. Owen wrote: > I just created some unofficial binary installers for the python.org's > 64-bit python 2.7.2 for Mac OS X 10.6 and later. > > They are available here: > > and include: > - pyfits 3.0.7 (did not run unit tests; I can't seem to find them) > - PIL 1.1.7 (includes all dependencies and passes all tests) > - pygame 1.9.1 (includes all dependencies except SCAN; of 408 tests > there were 3 errors--including two png tests--and two failures) > > -- Russell > > _______________________________________________ > Pythonmac-SIG maillist ?- ?Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG -- 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 From chris.barker at noaa.gov Mon Apr 23 20:42:18 2012 From: chris.barker at noaa.gov (Chris Barker) Date: Mon, 23 Apr 2012 11:42:18 -0700 Subject: [Pythonmac-SIG] py2app and nested packages Message-ID: Folks, py2app doesn't seem to do "the right thing" with nested packages. However, it's not entirely clear what it should do... example: the "pubsub" package is delivered with wxPython, so it is commonly imported thusly: from wx.lib.pubsub import Publisher However, in wx.lib.pubsub, there is some trickery in the __init___, so as py2app installs it, ot doesn't work (see previous messages to this and the wxPython list). However, if you do: packages = ['wx.lib.pubsub'] ... in your py2app setup.py, you get the entire pubsub package, but installed in : Peppy.app/Contents/Resources/lib/python2.7/pubsub so it will work, but only if you now import it as: from pubsub import Publisher not too heinous, but it's really nice if we don't have to change imports for the bundled version. if I add 'wx' to packages, It does work, but I've then got all of wx, all of wx.lib, etc, which is really a bit much (the resulting app bundle is 124MB, vs. 60 without specifying the wx package) At first, I thought I'd want: wx/lib/pubsub/.... put on sys.path, with wx and lib empty except the specified dirs. However, that would put two "wx" dirs on sys.path, which would not be good (assuming wx is used...) Would it be possible for the packages specification to be processed after modulegraph is run, and it would then see that "wx" and "wx.lib" are there, and then put all of pubsub in there? Or maybe put the parts of wx and wx.lib that were already going to be included outside the zip bundle? -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 From Jack.Jansen at cwi.nl Mon Apr 23 22:23:51 2012 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Mon, 23 Apr 2012 22:23:51 +0200 Subject: [Pythonmac-SIG] Wanted: list admin for the PythonMac mailing list Message-ID: <82D215EB-BF33-4CE5-BE85-298F800FF40A@cwi.nl> Folks, as you've probably noticed:-) the amount of time I spend on the pythonmac-sig mailing list has considerably diminished over the last couple of years. Not that I'm not interested, but I simply don't have the time:-( However, I was still one of the two list maintainers, together with Skip. However, he has called it quits, so I'm now apparently the only list maintainer. It's not a lot of work, really nothing more than looking through the held emails once every week or so. Usually there's a few of them, usually they are all spam, but occasionally there is something that should be let through. Think of an investment of half a minute per week. Then you need to help epoepl with trouble unsubscribing once every year or so. It may be required to take emergency measures once in a very blue moon (I think it happened once in the last 15 years, on one of the many mailing lists I've maintained) such as temporarily shutting the list down in case of spam storms. So, I want a volunteer to be list maintainer. If you already know mailman that's a pre, but learning it doesn't take long either (it's in Python, so it's high quality software:-). I'll continue as a maintainer (as long as you let me:-), but i don't want to be the sole person responsible. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From chris.barker at noaa.gov Mon Apr 23 23:13:40 2012 From: chris.barker at noaa.gov (Chris Barker) Date: Mon, 23 Apr 2012 14:13:40 -0700 Subject: [Pythonmac-SIG] py2app and nested packages In-Reply-To: References: Message-ID: Another couple py2app questions: I"ve discovered that my app is HUGE! -- I already expected that, but this is a bit out of bounds. The reason: The scipy and matplotlib packages bring in all of scipy, numpy, and matplotlib uncompressed. This gets pretty darn big, particularly when you're using one or two simple functions from scipy, for instance. I know why they do that -- there are a number of dynamic inports, and folks often include matplotlib and/or scipy in apps where people may be scripting, etc, and using features that aren't always imported by the app. And this way, apps using those libs "just work" which is great. However, it would be nice to be able to override soem of this: Is there a way to "turn off" a recipe (other than deleting it from the install)? - Is there a way to apply excludes after the recipe? As far as I can tell, if the recipe includes it, excludes doesn't remove it. -Chris On Mon, Apr 23, 2012 at 11:42 AM, Chris Barker wrote: > Folks, > > py2app doesn't seem to do "the right thing" with nested packages. > However, it's not entirely clear what it should do... > > example: the "pubsub" package is delivered with wxPython, so it is > commonly imported thusly: > > from wx.lib.pubsub import Publisher > > However, in wx.lib.pubsub, there is some trickery in the __init___, so > as py2app installs it, ot doesn't work (see previous messages to this > and the wxPython list). However, if you do: > > packages = ['wx.lib.pubsub'] ?... > > in your py2app setup.py, you get the entire pubsub package, but installed in : > > Peppy.app/Contents/Resources/lib/python2.7/pubsub > > so it will work, but only if you now import it as: > > from pubsub import Publisher > > not too heinous, but it's really nice if we don't have to change > imports for the bundled version. > > if I add 'wx' to packages, It does work, but I've then got all of wx, > all of wx.lib, etc, which is ?really a bit much (the resulting app > bundle is 124MB, vs. 60 without specifying the wx package) > > At first, I thought I'd want: > > wx/lib/pubsub/.... > > put on sys.path, with wx and lib empty except the specified dirs. > However, that would put two "wx" dirs on sys.path, which would not be > good (assuming wx is used...) > > Would it be possible for the packages specification to be processed > after modulegraph is run, and it would then see that "wx" and "wx.lib" > are there, and then put all of pubsub in there? Or maybe put the parts > of wx and wx.lib that were already going to be included outside the > zip bundle? > > -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 -- 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 From ronaldoussoren at mac.com Tue Apr 24 13:29:51 2012 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 24 Apr 2012 13:29:51 +0200 Subject: [Pythonmac-SIG] py2app and nested packages In-Reply-To: References: Message-ID: <861B866B-D73D-47FE-BBEE-412F4C3D6B0E@mac.com> On 23 Apr, 2012, at 20:42, Chris Barker wrote: > Folks, > > py2app doesn't seem to do "the right thing" with nested packages. > However, it's not entirely clear what it should do... > > example: the "pubsub" package is delivered with wxPython, so it is > commonly imported thusly: > > from wx.lib.pubsub import Publisher wx.lib.pubsub is a bad example, it manipulates __path__ which causes problems with py2app because it cannot detect this. I added a recipe to py2app's repository a while ago that should fix this particular problem. > > However, in wx.lib.pubsub, there is some trickery in the __init___, so > as py2app installs it, ot doesn't work (see previous messages to this > and the wxPython list). However, if you do: > > packages = ['wx.lib.pubsub'] ... > > in your py2app setup.py, you get the entire pubsub package, but installed in : > > Peppy.app/Contents/Resources/lib/python2.7/pubsub That's a bug, the code that implements the packages options assumes that all mentioned packages are toplevel packages. It should be fairly easy to fix that, although this requires some path manipulation trickery because the subpackage will be in a different location that the parent: the parent is in site-packages.zip while the child is not. > > so it will work, but only if you now import it as: > > from pubsub import Publisher > > not too heinous, but it's really nice if we don't have to change > imports for the bundled version. > > if I add 'wx' to packages, It does work, but I've then got all of wx, > all of wx.lib, etc, which is really a bit much (the resulting app > bundle is 124MB, vs. 60 without specifying the wx package) > > At first, I thought I'd want: > > wx/lib/pubsub/.... > > put on sys.path, with wx and lib empty except the specified dirs. > However, that would put two "wx" dirs on sys.path, which would not be > good (assuming wx is used...) > > Would it be possible for the packages specification to be processed > after modulegraph is run, and it would then see that "wx" and "wx.lib" > are there, and then put all of pubsub in there? Or maybe put the parts > of wx and wx.lib that were already going to be included outside the > zip bundle? The option "packages" currently always stores the included package outside of site-packages.zip to ensure that data files can be loaded in the old pre-pkgresources way (that is, by opening paths relative to somepackage.__file__). Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4788 bytes Desc: not available URL: From ronaldoussoren at mac.com Tue Apr 24 13:49:08 2012 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 24 Apr 2012 13:49:08 +0200 Subject: [Pythonmac-SIG] py2app and nested packages In-Reply-To: References: Message-ID: <83BFD112-42F7-4BBE-9194-CCFA2839E37D@mac.com> On 23 Apr, 2012, at 23:13, Chris Barker wrote: > Another couple py2app questions: > > I"ve discovered that my app is HUGE! -- I already expected that, but > this is a bit out of bounds. The reason: > > The scipy and matplotlib packages bring in all of scipy, numpy, and > matplotlib uncompressed. This gets pretty darn big, particularly when > you're using one or two simple functions from scipy, for instance. > > I know why they do that -- there are a number of dynamic inports, and > folks often include matplotlib and/or scipy in apps where people may > be scripting, etc, and using features that aren't always imported by > the app. And this way, apps using those libs "just work" which is > great. > > However, it would be nice to be able to override soem of this: > > Is there a way to "turn off" a recipe (other than deleting it from the install)? No, and I'd prefer to fix recipes instead of having a way to disable them. The numpy/scipy recipes are probably as aggressive as they are because that fixes the immediate problem with minimal effort while writing the recipe. The recipe should get a way to specify which dynamic imports are present, simular to the hardcoded knowlegde about the stdlib in modulegraph. That way py2app can include only the bits that are really necessary. IIRC the matplotlib recipe includes the entire package because of the data files that are in the package, including only the code doesn't work. > > - Is there a way to apply excludes after the recipe? As far as I can > tell, if the recipe includes it, excludes doesn't remove it. That's correct, and is a bug: user specified actions should override automatic actions, including the recipes. Ronald > > > -Chris > > > > On Mon, Apr 23, 2012 at 11:42 AM, Chris Barker wrote: >> Folks, >> >> py2app doesn't seem to do "the right thing" with nested packages. >> However, it's not entirely clear what it should do... >> >> example: the "pubsub" package is delivered with wxPython, so it is >> commonly imported thusly: >> >> from wx.lib.pubsub import Publisher >> >> However, in wx.lib.pubsub, there is some trickery in the __init___, so >> as py2app installs it, ot doesn't work (see previous messages to this >> and the wxPython list). However, if you do: >> >> packages = ['wx.lib.pubsub'] ... >> >> in your py2app setup.py, you get the entire pubsub package, but installed in : >> >> Peppy.app/Contents/Resources/lib/python2.7/pubsub >> >> so it will work, but only if you now import it as: >> >> from pubsub import Publisher >> >> not too heinous, but it's really nice if we don't have to change >> imports for the bundled version. >> >> if I add 'wx' to packages, It does work, but I've then got all of wx, >> all of wx.lib, etc, which is really a bit much (the resulting app >> bundle is 124MB, vs. 60 without specifying the wx package) >> >> At first, I thought I'd want: >> >> wx/lib/pubsub/.... >> >> put on sys.path, with wx and lib empty except the specified dirs. >> However, that would put two "wx" dirs on sys.path, which would not be >> good (assuming wx is used...) >> >> Would it be possible for the packages specification to be processed >> after modulegraph is run, and it would then see that "wx" and "wx.lib" >> are there, and then put all of pubsub in there? Or maybe put the parts >> of wx and wx.lib that were already going to be included outside the >> zip bundle? >> >> -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 > > > > -- > > 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 > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4788 bytes Desc: not available URL: From chris.barker at noaa.gov Wed Apr 25 02:17:44 2012 From: chris.barker at noaa.gov (Chris Barker) Date: Tue, 24 Apr 2012 17:17:44 -0700 Subject: [Pythonmac-SIG] py2app and nested packages In-Reply-To: <861B866B-D73D-47FE-BBEE-412F4C3D6B0E@mac.com> References: <861B866B-D73D-47FE-BBEE-412F4C3D6B0E@mac.com> Message-ID: On Tue, Apr 24, 2012 at 4:29 AM, Ronald Oussoren >> example: the "pubsub" package is delivered with wxPython, so it is >> commonly imported thusly: >> >> from wx.lib.pubsub import Publisher > > wx.lib.pubsub is a bad example, it manipulates __path__ which causes problems with py2app because it cannot detect this. ?I added a recipe to py2app's repository a while ago that should fix this particular problem. I thought I had the latest -- I'll go check that out. Also, there is a bit of trick if you force it to import it's dyanamic module, but if you've solved that one, great! > That's a bug, the code that implements the packages options assumes that all mentioned packages are toplevel packages. ?It should be fairly easy to fix that, although this requires some path manipulation trickery because the subpackage will be in a different location that the parent: the parent is in site-packages.zip while the child is not. right -- do you have an idea how to solve that? I don't! > The option "packages" currently always stores the included package outside of site-packages.zip to ensure that data files can be loaded in the old pre-pkgresources way (that is, by opening paths relative to somepackage.__file__). which is useful, but another thought -- maybe there could be two options: "packages" and "full_packages" or something -- so one would simple add the package to the modulegraph, to catch dynamic imports, and the other would do what is done now -- include the whole darn thing. One other issue with the "whole darn thing" option, is that you get the *.py, *.pyc, Na *.pyo files -- so it's maybe three times as big as it could be -- I wonder if it's worth cleaning that up. >> Is there a way to "turn off" a recipe (other than deleting it from the install)? > No, and I'd prefer to fix recipes instead of having a way to disable them. I understand that, and generally agree -- but it may be that there is no one recipe that works for everyone. For example, Scipy is weird enough that probably the only way to be sure it'll work in all cases is to include the whole darn thing -- but in my case at least, I'm using a couple functions in scipy.special, and it works fine if that is all I include. Maybe if there is a way to pass options to recipes? > The (scipy) recipe should get a way to specify which dynamic imports are present, simular to the hardcoded knowledge about the stdlib in modulegraph. That way py2app can include only the bits that are really necessary. If you give me a pointer - maybe to the similar modulegraph code, perhaps I could work on that. >> IIRC the matplotlib recipe includes the entire package because of the data files that are in the package, including only the code doesn't work. I've poked into this more -- it turn out that there is special-case code in matplotlib itself for py2exe that looks for the data-files in a different place when sys.frozen -- I'm adding some code for py2app as well -- if I get that working, I can submit a patch to MPL and the recipe. Is there a way to specify data files in a recipe? >>- Is there a way to apply excludes after the recipe? As far as I can >> tell, if the recipe includes it, excludes doesn't remove it. > That's correct, and is a bug: user specified actions should override > automatic actions, including the recipes. OK -- I suspect the issue is there is no way to exclude stuff that is going to go outside of the zip file -- the full packages. It looks like what it does is remove it from modulegraph only. Thanks for your work (and ideas) on this. -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 From ronaldoussoren at mac.com Wed Apr 25 14:29:19 2012 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 25 Apr 2012 14:29:19 +0200 Subject: [Pythonmac-SIG] py2app and nested packages In-Reply-To: References: <861B866B-D73D-47FE-BBEE-412F4C3D6B0E@mac.com> Message-ID: <7DA2DE5D-DCBC-404E-83CD-0A243374ED43@mac.com> On 25 Apr, 2012, at 2:17, Chris Barker wrote: > On Tue, Apr 24, 2012 at 4:29 AM, Ronald Oussoren > >>> example: the "pubsub" package is delivered with wxPython, so it is >>> commonly imported thusly: >>> >>> from wx.lib.pubsub import Publisher >> >> wx.lib.pubsub is a bad example, it manipulates __path__ which causes problems with py2app because it cannot detect this. I added a recipe to py2app's repository a while ago that should fix this particular problem. > > > I thought I had the latest -- I'll go check that out. Knowing me I probably forgot to check in the updated recipe :-(. I also lost track on whether or not all changes are released on PyPI. > > Also, there is a bit of trick if you force it to import it's dyanamic > module, but if you've solved that one, great! IIRC that dynamic import is completely unnecessary and probably won't work when wx is in a zip file. > > >> That's a bug, the code that implements the packages options assumes that all mentioned packages are toplevel packages. It should be fairly easy to fix that, although this requires some path manipulation trickery because the subpackage will be in a different location that the parent: the parent is in site-packages.zip while the child is not. > > right -- do you have an idea how to solve that? I don't! The copying part is easy, just create the right directory structure (packages = ["wx.pubsub"] -> create "wx/pubsub" in the application bundle). Ensuring that __import__ finds the subpackage is harder, I'll have to experiment to find a working solution that won't cause nausea in anyone looking at the code. > >> The option "packages" currently always stores the included package outside of site-packages.zip to ensure that data files can be loaded in the old pre-pkgresources way (that is, by opening paths relative to somepackage.__file__). > > which is useful, but another thought -- maybe there could be two options: > > "packages" and "full_packages" or something -- so one would simple add > the package to the modulegraph, to catch dynamic imports, and the > other would do what is done now -- include the whole darn thing. > > One other issue with the "whole darn thing" option, is that you get > the *.py, *.pyc, Na *.pyo files -- so it's maybe three times as big as > it could be -- I wonder if it's worth cleaning that up. Adding "full_packages" for the current behavior and giving "packages" a semantics that's simular to "modules" would be useful. > >>> Is there a way to "turn off" a recipe (other than deleting it from the install)? > >> No, and I'd prefer to fix recipes instead of having a way to disable them. > > I understand that, and generally agree -- but it may be that there is > no one recipe that works for everyone. For example, Scipy is weird > enough that probably the only way to be sure it'll work in all cases > is to include the whole darn thing -- but in my case at least, I'm > using a couple functions in scipy.special, and it works fine if that > is all I include. > > Maybe if there is a way to pass options to recipes? I guess you're right, there has to be a way to configure recipes and that includes disabling them completely. Matplotlib is another example where this would be useful: it should be possible to specify that your app uses a particular backend without including the entire tree. > >> The (scipy) recipe should get a way to specify which dynamic imports are present, simular to the hardcoded knowledge about the stdlib in modulegraph. That way py2app can include only the bits that are really necessary. > > If you give me a pointer - maybe to the similar modulegraph code, > perhaps I could work on that. The modulegraph code I refer to is modulegraph.find_moduels.get_implies (). The wx recipe in the py2app tree () basicly does the same thing from the outside. > >>> IIRC the matplotlib recipe includes the entire package because of the data files that are in the package, including only the code doesn't work. > > I've poked into this more -- it turn out that there is special-case > code in matplotlib itself for py2exe that looks for the data-files in > a different place when sys.frozen -- I'm adding some code for py2app > as well -- if I get that working, I can submit a patch to MPL and the > recipe. > > Is there a way to specify data files in a recipe? Good question, and it seems the anwer is no (looking at ). Adding an option for that would be easy enough though. > >>> - Is there a way to apply excludes after the recipe? As far as I can >>> tell, if the recipe includes it, excludes doesn't remove it. > >> That's correct, and is a bug: user specified actions should override > automatic actions, including the recipes. > > OK -- I suspect the issue is there is no way to exclude stuff that is > going to go outside of the zip file -- the full packages. It looks > like what it does is remove it from modulegraph only. > > Thanks for your work (and ideas) on this. Speaking of ideas.... I'm pretty sure that py2app is not compatible with packaging/distutils2, and I don't want to maintain a codebase that works with all flavor of distutils (the current distutils, setuptools, distribute, distutils2 and packaging). In the medium term it would be better to make py2app a standalone application instead of a distutils extension, with clear integration points for the packaging tools (such hooks for fetching dependencies and building extensions). That will have to wait for the next release of pyobjc though, that process is moving forward way too slow even without spending time on a py2app redesign. Ronald > > -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 > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4788 bytes Desc: not available URL: From rowen at uw.edu Wed Apr 25 22:51:56 2012 From: rowen at uw.edu (Russell E. Owen) Date: Wed, 25 Apr 2012 13:51:56 -0700 Subject: [Pythonmac-SIG] py2app and nested packages References: <861B866B-D73D-47FE-BBEE-412F4C3D6B0E@mac.com> <7DA2DE5D-DCBC-404E-83CD-0A243374ED43@mac.com> Message-ID: In article <7DA2DE5D-DCBC-404E-83CD-0A243374ED43 at mac.com>, Ronald Oussoren wrote: > On 25 Apr, 2012, at 2:17, Chris Barker wrote: > > > On Tue, Apr 24, 2012 at 4:29 AM, Ronald Oussoren > >> The option "packages" currently always stores the included package outside > >> of site-packages.zip to ensure that data files can be loaded in the old > >> pre-pkgresources way (that is, by opening paths relative to > >> somepackage.__file__). > > > > which is useful, but another thought -- maybe there could be two options: > > > > "packages" and "full_packages" or something -- so one would simple add > > the package to the modulegraph, to catch dynamic imports, and the > > other would do what is done now -- include the whole darn thing. > > > > One other issue with the "whole darn thing" option, is that you get > > the *.py, *.pyc, Na *.pyo files -- so it's maybe three times as big as > > it could be -- I wonder if it's worth cleaning that up. > > Adding "full_packages" for the current behavior and giving "packages" a > semantics that's simular to "modules" would be useful. Please consider retaining the current meaning for the current name and pick a new name for the new meaning (if you can figure one out that makes sense). That would preserve backwards compatibility. Is the inclusion of .pyc and .pyo files a significant problem? If they are not already present then they will be regenerated next time the application is run. Though if some .py files are never loaded then the associated .pyc and .pyo files are wasted space. -- Russell From j.kossick at googlemail.com Sun Apr 29 08:43:25 2012 From: j.kossick at googlemail.com (Jonathan Kossick) Date: Sun, 29 Apr 2012 14:43:25 +0800 Subject: [Pythonmac-SIG] py2app and zlib ... In-Reply-To: References: Message-ID: Hello, I already worked with py2exe and just started to use py2app. Actually I have some problems to include the zlib library. Under py2exe I includet the library in the options but under Mac I get this error: error: cannot copy tree '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py': not a directory Do you have any Idea how to fix this? My setup.py file: from setuptools import setup APP = ['startr.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': True, "packages": ["lxml","gzip"]} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], name='programm', ) -------------- next part -------------- An HTML attachment was scrubbed... URL: From charlie.clark at clark-consulting.eu Mon Apr 30 13:26:20 2012 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Mon, 30 Apr 2012 13:26:20 +0200 Subject: [Pythonmac-SIG] Help with Py2app Message-ID: Hi, I'm trying to update the setup script for the LinkChecker project http://linkchecker.sourceforge.net/ because it no longer builds the app and does not work reliably in a virtualenv. I am hoping to build a standalone app and package it as a DMG as the project author no longer has access to Apple hardware. The existing procedure is a bit convoluted in that it is actually driven by a makefile although `bin/python setup.py py2app` should in theory be sufficient. The existing setup.py is monolithic and fairly complicated so I tried to break out the py2app part into a separate script. When I did this and followed the py2app documentation it became clear that the script needs to be updated to use setuptools, at least for the extensions. My knowledge of writing setup scripts is extremely limited. LinkChecker is a QT project and needs Python-SIP. Unfortunately I haven't worked out how the recipe works. Does the py2app automatically detect the dependency and build and package the shared libraries automatically? Thanks for any help. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Kronenstr. 27a D?sseldorf D- 40217 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From kw at codebykevin.com Mon Apr 30 15:25:43 2012 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 30 Apr 2012 09:25:43 -0400 Subject: [Pythonmac-SIG] py2app strips symlinks in frameworks, need to keep them Message-ID: <4F9E92D7.3080200@codebykevin.com> I've had an app rejected from the Mac App Store because required symlinks were not present in the bundled Python framework: Malformed Framework - The framework bundle Python (QuickWho.app/Contents/Frameworks/Python.framework/Versions/2.7) must contain a symbolic link 'Python' -> 'Versions/Current/Python'. Refer to the Anatomy of Framework Bundles for more information. Malformed Framework - The framework bundle Python (QuickWho.app/Contents/Frameworks/Python.framework/Versions/2.7) must contain a symbolic link 'Resources' -> 'Versions/Current/Resources'. Refer to the Anatomy of Framework Bundles for more information. Malformed Framework - The framework bundle Python (QuickWho.app/Contents/Frameworks/Python.framework/Versions/2.7) 'Versions' directory must contain a symbolic link 'Current' resolving to a specific version directory. Refer to the Anatomy of Framework Bundles for more information. These symlinks are present in the original framework on my system, but they appear to be stripped out by py2app. Is there a flag I can pass to py2app to retain these symlinks? I can try to add them manually later in my build script, but it's a pain and I'd rather have py2app not strip them out in the first place. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com From charlie.clark at clark-consulting.eu Mon Apr 30 15:35:31 2012 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Mon, 30 Apr 2012 15:35:31 +0200 Subject: [Pythonmac-SIG] py2app strips symlinks in frameworks, need to keep them In-Reply-To: <4F9E92D7.3080200@codebykevin.com> References: <4F9E92D7.3080200@codebykevin.com> Message-ID: Am 30.04.2012, 15:25 Uhr, schrieb Kevin Walzer : > Is there a flag I can pass to py2app to retain these symlinks? I can try > to add them manually later in my build script, but it's a pain and I'd > rather have py2app not strip them out in the first place. You might try: --semi-standalone (-s) depend on an existing installation of Python Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Kronenstr. 27a D?sseldorf D- 40217 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From kw at codebykevin.com Mon Apr 30 15:44:01 2012 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 30 Apr 2012 09:44:01 -0400 Subject: [Pythonmac-SIG] py2app strips symlinks in frameworks, need to keep them In-Reply-To: References: <4F9E92D7.3080200@codebykevin.com> Message-ID: <4F9E9721.4010808@codebykevin.com> On 4/30/12 9:35 AM, Charlie Clark wrote: > > --semi-standalone (-s) depend on an existing installation of Python > Not an option in my case, alas, but thanks for the suggestion. --K -- Kevin Walzer Code by Kevin http://www.codebykevin.com From chris.barker at noaa.gov Mon Apr 30 18:59:59 2012 From: chris.barker at noaa.gov (Chris Barker) Date: Mon, 30 Apr 2012 09:59:59 -0700 Subject: [Pythonmac-SIG] Help with Py2app In-Reply-To: References: Message-ID: On Mon, Apr 30, 2012 at 4:26 AM, Charlie Clark > I'm trying to update the setup script for the LinkChecker project > http://linkchecker.sourceforge.net/ because it no longer builds the app and > does not work reliably in a virtualenv. darn... > I am hoping to build a standalone > app and package it as a DMG as the project author no longer > has access to Apple hardware. thanks for contributing in this way! > although `bin/python setup.py py2app` should in theory be > sufficient. it should, yes, though at times I've had to add explicte most-processing code -- I usually do it in pyton in teh setup.py, but in some ways makefile might be easier if you're more familiar with shell scripting. I also use a shell script to build the dmg. > tried to break out the py2app part into a separate script. > and followed the py2app documentation it became clear that the script needs > to be updated to use setuptools, at least for the extensions. I don't know that py2app reslies on setuptools for anything. > LinkChecker is a QT project and needs Python-SIP. Unfortunately I haven't > worked out how the recipe works. Does the py2app automatically detect the > dependency and build and package the shared libraries automatically? it shoujld, yes -- the idea of recipies is that they "jsut work" for the end user. If it's not, then it's a bug -- hopefully someone here can help you find and fix it. please post: your setup.py the errors you get when running the .app Also, what I usually do is look inside the generated bundle and see what's there -- if you find what's missing, you can often figure out how to fix it. you can unzip the site-packages zip file, to see what's in there. HTH, -Chris > Thanks for any help. > > Charlie > -- > Charlie Clark > Managing Director > Clark Consulting & Research > German Office > Kronenstr. 27a > D?sseldorf > D- 40217 > Tel: +49-211-600-3657 > Mobile: +49-178-782-6226 > _______________________________________________ > Pythonmac-SIG maillist ?- ?Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG -- 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 From charlie.clark at clark-consulting.eu Mon Apr 30 19:20:53 2012 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Mon, 30 Apr 2012 19:20:53 +0200 Subject: [Pythonmac-SIG] Help with Py2app In-Reply-To: References: Message-ID: Am 30.04.2012, 18:59 Uhr, schrieb Chris Barker : > darn... Yeah, well I least I bumped the MacPorts port and that works like a charm. It'll even give you DMG if you ask nicely. Unfortunately the DMG contains symlinks to the libraries and binaries so it isn't redistributable. >> I am hoping to build a standalone >> app and package it as a DMG as the project author no longer >> has access to Apple hardware. > thanks for contributing in this way! > >> although `bin/python setup.py py2app` should in theory be >> sufficient. > it should, yes, though at times I've had to add explicte > most-processing code -- I usually do it in pyton in teh setup.py, but > in some ways makefile might be easier if you're more familiar with > shell scripting. I also use a shell script to build the dmg. I'm happier with Python. >> tried to break out the py2app part into a separate script. > >> and followed the py2app documentation it became clear that the script >> needs >> to be updated to use setuptools, at least for the extensions. > I don't know that py2app reslies on setuptools for anything. Maybe it doesn't but I got an error when I moved the relevant part of setup.py over to a new file generated by py2applet. It was complaining about the Extensions not being Extension instances. Turned out distutils.core.Extension instances are not welcome in setuptools. >> LinkChecker is a QT project and needs Python-SIP. Unfortunately I >> haven't >> worked out how the recipe works. Does the py2app automatically detect >> the >> dependency and build and package the shared libraries automatically? > it shoujld, yes -- the idea of recipies is that they "jsut work" for > the end user. If it's not, then it's a bug -- hopefully someone here > can help you find and fix it. > please post: > your setup.py The original is here: http://linkchecker.git.sourceforge.net/git/gitweb.cgi?p=linkchecker/linkchecker;a=blob_plain;f=setup.py;hb=HEAD And my feeble attempt: http://pastebin.com/ASzHipCe > the errors you get when running the .app Bastian's done some fixing, although I've had to give my virtualenv access to my system site-packages because of Sip. We really need a pip compatible version of that. When running the setup.py we're now down to: Traceback (most recent call last): File "setup.py", line 833, in setup(**args) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup dist.run_commands() File "setup.py", line 360, in run_commands super(MyDistribution, self).run_commands() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "setup.py", line 702, in run py2app_build.run(self) File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/py2app/build_app.py", line 480, in run self._run() File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/py2app/build_app.py", line 637, in _run self.run_normal() File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/py2app/build_app.py", line 723, in run_normal py_files, extensions = self.finalize_modulefinder(mf) File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/py2app/build_app.py", line 690, in finalize_modulefinder py_files, extensions = parse_mf_results(mf) File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/modulegraph/find_modules.py", line 93, in parse_mf_results raise TypeError("Don't know how to handle '%s'" % repr(src)) TypeError: Don't know how to handle ''/Users/charlieclark/Sites/LinkChecker/linkchecker-gui'' I think I've borked my virtualenv because I'm not getting that far when I run my modified setup fuchsia:LinkChecker charlieclark$ bin/python app.py py2app Traceback (most recent call last): File "app.py", line 69, in include_dirs = include_dirs File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup _setup_distribution = dist = klass(attrs) File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 260, in __init__ File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 284, in fetch_build_eggs File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 563, in resolve to_activate = [] File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 799, in best_match dists = self._distmap.setdefault(dist.key,[]) File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 811, in obtain ``VersionConflict`` if an unsuitable version of the project is already File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/dist.py", line 327, in fetch_build_egg File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 446, in easy_install File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 476, in install_item File "/Users/charlieclark/Sites/LinkChecker/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/easy_install.py", line 642, in install_eggs distutils.errors.DistutilsError: Couldn't find a setup script in /var/folders/q0/r5j5dzp55p734_sdh1cblxn80000gn/T/easy_install-00i3bl/sip-4.13.3-snapshot-31ad477ff5ae.zip > Also, what I usually do is look inside the generated bundle and see > what's there -- if you find what's missing, you can often figure out > how to fix it. Not getting that far. I hope this makes more sense to you than it does to me! Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Kronenstr. 27a D?sseldorf D- 40217 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From chris.barker at noaa.gov Mon Apr 30 20:08:31 2012 From: chris.barker at noaa.gov (Chris Barker) Date: Mon, 30 Apr 2012 11:08:31 -0700 Subject: [Pythonmac-SIG] Help with Py2app In-Reply-To: References: Message-ID: On Mon, Apr 30, 2012 at 10:20 AM, Charlie Clark >>> tried to break out the py2app part into a separate script. I'd go farther with this... >> I don't know that py2app reslies on setuptools for anything. > > Maybe it doesn't but I got an error when I moved the relevant part of > setup.py over to a new file generated by py2applet. It was complaining about > the Extensions not being Extension instances. right... >>> dependency and build and package the shared libraries automatically? note here -- it should include them, but having it both build and package in one step may not work... >> please post: >> your setup.py > And my feeble attempt: > > http://pastebin.com/ASzHipCe OK -- to keep this all cleaner, I'd completely separate building and py2app-ing. So the steps would be: python setup.py install (or install, or develop) make sure it's all running in that environment. Then: python setup.py py2app having py2app use the distutils API was a nifty idea, but I'm not sure it's bought us anythign bu confusion in practice. The the setup.py would either be completely separate, or you can have a clause in there: if "py2app" in sys.argv: (or somethign like that) # do the py2app stuff here they key is not to try to use the same call to distutils.setup to build, install, and py2app. I usually end up with essentially completely different setup.py for installing, py2exe and py2app, though they may be in the same file or not. HTH, -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 From charlie.clark at clark-consulting.eu Mon Apr 30 20:19:01 2012 From: charlie.clark at clark-consulting.eu (Charlie Clark) Date: Mon, 30 Apr 2012 20:19:01 +0200 Subject: [Pythonmac-SIG] Help with Py2app In-Reply-To: References: Message-ID: Am 30.04.2012, 20:08 Uhr, schrieb Chris Barker : > I'd go farther with this... > >>> I don't know that py2app reslies on setuptools for anything. >> >> Maybe it doesn't but I got an error when I moved the relevant part of >> setup.py over to a new file generated by py2applet. It was complaining >> about >> the Extensions not being Extension instances. > right... > >>>> dependency and build and package the shared libraries automatically? > note here -- it should include them, but having it both build and > package in one step may not work... Happy with multiple steps. >>> please post: >>> your setup.py > >> And my feeble attempt: >> >> http://pastebin.com/ASzHipCe > OK -- to keep this all cleaner, I'd completely separate building and > py2app-ing. So the steps would be: > python setup.py install (or install, or develop) This runs fine, as long as SIP is installed. How do I add "requires" to the setup? > make sure it's all running in that environment. Then: > python setup.py py2app > having py2app use the distutils API was a nifty idea, but I'm not sure > it's bought us anythign bu confusion in practice. The the setup.py > would either be completely separate, or you can have a clause in > there: > if "py2app" in sys.argv: (or somethign like that) > # do the py2app stuff here > they key is not to try to use the same call to distutils.setup to > build, install, and py2app. > I usually end up with essentially completely different setup.py for > installing, py2exe and py2app, though they may be in the same file or No problem with that. What dance should I be doing to get py2applet to generate the right script once everything has been built. Am I right in thinking that I need to write my own script to generate a pkg or dmg? Easy enough to adapt the existing code from setup I guess if only I knew where to plug it in. Charlie -- Charlie Clark Managing Director Clark Consulting & Research German Office Kronenstr. 27a D?sseldorf D- 40217 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 From chris.barker at noaa.gov Mon Apr 30 23:16:51 2012 From: chris.barker at noaa.gov (Chris Barker) Date: Mon, 30 Apr 2012 14:16:51 -0700 Subject: [Pythonmac-SIG] Help with Py2app In-Reply-To: References: Message-ID: (dont' forget to include pythonmac-sig -- it's not doen with a standard reply.) On Mon, Apr 30, 2012 at 2:07 PM, Charlie Clark wrote: >> That's a setuptools (or distribute) feature, and should be in the >> primary setup.py that the main developer uses on other platforms. > > Well, where should it go in the existing setup.py? I just tried it in the > args but no joy. it goes in "requires" somwhere -- check the setuptools docs. >>>> python setup.py py2app >> yup -- a dmg is easy, a one liner, something like: >> /usr/bin/hdiutil create -srcfolder dist -volname "Name_of_the_volume" >> -ov "The_name_of_the_file" >> there is bdist.mpkg, but I think that's only for python packages, not >> app bundles. > > > Can I add that to my build script? you can use an os.system callina python script, but I usually jsut run it separately. > I'm now getting the same error as when running the original setup.py > > ? ?raise TypeError("Don't know how to handle '%s'" % repr(src)) > TypeError: Don't know how to handle > ''/Users/charlieclark/Sites/LinkChecker/linkchecker-gui'' what is link-checker-gui ? from that error, it looks like neither a module (clearly not - it's not called *.py) or a package (would be a directory). Also, it's in your home dir -- so why is it getting found by modulegraph? > At least I've got it pointing at the right script. So it can't resolve the > dependencies? that looks like something else than not finding a dependency. -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