From hengist.podd at virgin.net Sat Aug 1 14:42:33 2009 From: hengist.podd at virgin.net (has) Date: Sat, 1 Aug 2009 13:42:33 +0100 Subject: [Pythonmac-SIG] create appscript reference from aedesc In-Reply-To: References: Message-ID: Magnus Herold wrote: > Hi All, > > I'm trying to write an Automator action using Python, and I'm not yet > that familiar with the lower levels of Mac programming. > > The input should be a list of iTunes track objects, and I get an > NSAppleEventDescriptor object. I know how to extract the AEDescs from > that, but I can't find a way turn these into appscript references that > I can use normally to say e.g. track.name.set('blabla'). It's possible, but a non-trivial problem if you aren't already familiar with the inner workings of both Apple events and appscript. I don't have time to work on it myself, but could provide a few pointers on where to start looking. How keen are you to get your hands dirty? has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From sanroque.tech at gmail.com Sun Aug 2 04:03:57 2009 From: sanroque.tech at gmail.com (Preston Holmes) Date: Sat, 1 Aug 2009 19:03:57 -0700 Subject: [Pythonmac-SIG] create appscript reference from aedesc In-Reply-To: <7cef4a3c0907261350h3d137090u3a3423ac03101602@mail.gmail.com> References: <7cef4a3c0907261350h3d137090u3a3423ac03101602@mail.gmail.com> Message-ID: <6179EEC3-3025-4DA1-B15A-5461976FF890@gmail.com> Can you use appscript? http://appscript.sourceforge.net/py-appscript/index.html its much easier than earlier python AE stuff. -Preston On Jul 26, 2009, at 1:50 PM, Magnus Herold wrote: > Hi All, > > I'm trying to write an Automator action using Python, and I'm not yet > that familiar with the lower levels of Mac programming. > > The input should be a list of iTunes track objects, and I get an > NSAppleEventDescriptor object. I know how to extract the AEDescs from > that, but I can't find a way turn these into appscript references that > I can use normally to say e.g. track.name.set('blabla'). > > Can someone point me in the right direction? > > Thanks, Magnus > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From aahz at pythoncraft.com Mon Aug 3 18:23:56 2009 From: aahz at pythoncraft.com (Aahz) Date: Mon, 3 Aug 2009 09:23:56 -0700 Subject: [Pythonmac-SIG] py2app vs PyObjCTools Message-ID: <20090803162356.GA5267@panix.com> I'm using py2app 0.3.6 with PyObjC 2.2b2, and py2app is refusing to copy pyobjc_framework_Cocoa-2.2b2-py2.6-macosx-10.3-fat.egg/PyObjCTools/NibClassBuilder into site-packages.zip. The weird thing is that I *do* get PyObjCTools/__init__.pyo, but none of the other files in the package. I've tried setting both 'packages' and 'includes' in setup.py, but it's not working. Suggestions? -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "...string iteration isn't about treating strings as sequences of strings, it's about treating strings as sequences of characters. The fact that characters are also strings is the reason we have problems, but characters are strings for other good reasons." --Aahz From hraban at fiee.net Mon Aug 3 22:58:18 2009 From: hraban at fiee.net (Henning Hraban Ramm) Date: Mon, 3 Aug 2009 22:58:18 +0200 Subject: [Pythonmac-SIG] py2app vs PyObjCTools In-Reply-To: <20090803162356.GA5267@panix.com> References: <20090803162356.GA5267@panix.com> Message-ID: <8B1684B2-91E2-41CC-B73B-63AB560615C9@fiee.net> Am 2009-08-03 um 18:23 schrieb Aahz: > I'm using py2app 0.3.6 with PyObjC 2.2b2, and py2app is refusing to > copy > pyobjc_framework_Cocoa-2.2b2-py2.6-macosx-10.3-fat.egg/PyObjCTools/ > NibClassBuilder > into site-packages.zip. The weird thing is that I *do* get > PyObjCTools/__init__.pyo, but none of the other files in the package. > I've tried setting both 'packages' and 'includes' in setup.py, but > it's > not working. > Suggestions? py2app can't handle zipped eggs. Install your eggs with "easy_install - Z" (or "pip unzip"). HTH - don't know if your problems are related to that. Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: Signierter Teil der Nachricht URL: From aahz at pythoncraft.com Mon Aug 3 23:44:55 2009 From: aahz at pythoncraft.com (Aahz) Date: Mon, 3 Aug 2009 14:44:55 -0700 Subject: [Pythonmac-SIG] py2app vs PyObjCTools In-Reply-To: <8B1684B2-91E2-41CC-B73B-63AB560615C9@fiee.net> References: <20090803162356.GA5267@panix.com> <8B1684B2-91E2-41CC-B73B-63AB560615C9@fiee.net> Message-ID: <20090803214455.GA19632@panix.com> On Mon, Aug 03, 2009, Henning Hraban Ramm wrote: > Am 2009-08-03 um 18:23 schrieb Aahz: >> >> I'm using py2app 0.3.6 with PyObjC 2.2b2, and py2app is refusing to >> copy >> pyobjc_framework_Cocoa-2.2b2-py2.6-macosx-10.3-fat.egg/PyObjCTools/NibClassBuilder >> into site-packages.zip. The weird thing is that I *do* get >> PyObjCTools/__init__.pyo, but none of the other files in the package. >> I've tried setting both 'packages' and 'includes' in setup.py, but >> it's not working. Suggestions? > > py2app can't handle zipped eggs. Install your eggs with "easy_install - > Z" (or "pip unzip"). That's a fair question -- I've run into that before and I've made sure all packages are unzipped. My suspicion at this point is that py2app can't deal with distributed eggs. That is, three PyObjC eggs contain part of PyObjCTools: aahz Python/2.6/site-packages: find . -name PyObjCTools ./pyobjc_core-2.2b2-py2.6-macosx-10.3-fat.egg/PyObjCTools ./pyobjc_framework_Cocoa-2.2b2-py2.6-macosx-10.3-fat.egg/PyObjCTools ./pyobjc_framework_ExceptionHandling-2.2b2-py2.6.egg/PyObjCTools Should I just merge them all into a single egg, maybe? -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "...string iteration isn't about treating strings as sequences of strings, it's about treating strings as sequences of characters. The fact that characters are also strings is the reason we have problems, but characters are strings for other good reasons." --Aahz From Brendan.Simon at eTRIX.com.au Wed Aug 5 04:29:04 2009 From: Brendan.Simon at eTRIX.com.au (Brendan Simon (eTRIX)) Date: Wed, 05 Aug 2009 12:29:04 +1000 Subject: [Pythonmac-SIG] py2app creating semi_standalone instead of standalone app Message-ID: <4A78EE70.6030709@eTRIX.com.au> I have a wxPython app which works on my Mac. I created an app bundle and this works on my Mac and my friends Mac :) All good, except that if I give my friend the source code and get him to create the app, the app is created as semi_standalone, and the app does not work as some modules cant be found. I am assuming the problems is is related to the semi_standalone versus standalone, but not 100% sure. Any idea why my friend's build is semi_standalone and mine is standalone ?? It's the same source. Any ideas on how to make standalone explicit with py2app ?? I see the --semi-standalone option in py2applet, but I don't think my friend should have to run pyapplet, right ??? Setup is already created. Hmmm, maybe I have explicitly specify standalone in setup.py somewhere ??? Thanks, Brendan. -------------- next part -------------- A non-text attachment was scrubbed... Name: Brendan_Simon.vcf Type: text/x-vcard Size: 267 bytes Desc: not available URL: From Brendan.Simon at eTRIX.com.au Wed Aug 5 04:35:44 2009 From: Brendan.Simon at eTRIX.com.au (Brendan Simon (eTRIX)) Date: Wed, 05 Aug 2009 12:35:44 +1000 Subject: [Pythonmac-SIG] py2app creating semi_standalone instead of standalone app In-Reply-To: <4A78EE70.6030709@eTRIX.com.au> References: <4A78EE70.6030709@eTRIX.com.au> Message-ID: <4A78F000.8000305@eTRIX.com.au> Maybe it has something to do with this statement in the py2app website. If the --semi-standalone option is used (forced if a vendor Python is being used), then the not_stdlib_filter will be automatically added to ensure that the Python standard library is not included. My python is 2.5.4 from Python.org. My freind's python is python 2.5.1 (standard on Leopard from Apple). I presume my friends python is "a vendor Python" and thus semi-standalone is being forced. Still not sure what the correct fix is :( Brendan Simon (eTRIX) wrote: > I have a wxPython app which works on my Mac. I created an app bundle > and this works on my Mac and my friends Mac :) > > All good, except that if I give my friend the source code and get him to > create the app, the app is created as semi_standalone, and the app does > not work as some modules cant be found. I am assuming the problems is > is related to the semi_standalone versus standalone, but not 100% sure. > > Any idea why my friend's build is semi_standalone and mine is standalone > ?? It's the same source. > > Any ideas on how to make standalone explicit with py2app ?? > > I see the --semi-standalone option in py2applet, but I don't think my > friend should have to run pyapplet, right ??? Setup is already created. > Hmmm, maybe I have explicitly specify standalone in setup.py somewhere ??? > > Thanks, Brendan. > > -------------- next part -------------- A non-text attachment was scrubbed... Name: Brendan_Simon.vcf Type: text/x-vcard Size: 267 bytes Desc: not available URL: From hraban at fiee.net Wed Aug 5 09:37:51 2009 From: hraban at fiee.net (Henning Hraban Ramm) Date: Wed, 5 Aug 2009 09:37:51 +0200 Subject: [Pythonmac-SIG] py2app creating semi_standalone instead of standalone app In-Reply-To: <4A78F000.8000305@eTRIX.com.au> References: <4A78EE70.6030709@eTRIX.com.au> <4A78F000.8000305@eTRIX.com.au> Message-ID: <1F85F535-82A5-4B3A-9BE7-0E1368F9D3A2@fiee.net> Am 2009-08-05 um 04:35 schrieb Brendan Simon (eTRIX): > Maybe it has something to do with this statement in the py2app > website. > > If the --semi-standalone option is used (forced if a vendor Python > is being used), then the not_stdlib_filter will be automatically > added to ensure that the Python standard library is not included. > > > My python is 2.5.4 from Python.org. My freind's python is python > 2.5.1 > (standard on Leopard from Apple). > I presume my friends python is "a vendor Python" and thus > semi-standalone is being forced. exactly > Still not sure what the correct fix is :( If you want to create a standalone app, you must install a standard python (and the necessary modules), as you can't distribute Apple's. Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: Signierter Teil der Nachricht URL: From Brendan.Simon at eTRIX.com.au Wed Aug 5 13:20:37 2009 From: Brendan.Simon at eTRIX.com.au (Brendan Simon (eTRIX)) Date: Wed, 05 Aug 2009 21:20:37 +1000 Subject: [Pythonmac-SIG] Pythonmac-SIG Digest, Vol 76, Issue 4 In-Reply-To: References: Message-ID: <4A796B05.5010305@eTRIX.com.au> > Subject: > Re: [Pythonmac-SIG] py2app creating semi_standalone instead of > standalone app > From: > Henning Hraban Ramm > Date: > Wed, 5 Aug 2009 09:37:51 +0200 > To: > pythonmac-sig at python.org > > To: > pythonmac-sig at python.org > > > Am 2009-08-05 um 04:35 schrieb Brendan Simon (eTRIX): > >> Maybe it has something to do with this statement in the py2app website. >> >> If the --semi-standalone option is used (forced if a vendor Python >> is being used), then the not_stdlib_filter will be automatically >> added to ensure that the Python standard library is not included. >> >> >> My python is 2.5.4 from Python.org. My freind's python is python 2.5.1 >> (standard on Leopard from Apple). >> I presume my friends python is "a vendor Python" and thus >> semi-standalone is being forced. > > exactly > >> Still not sure what the correct fix is :( > > If you want to create a standalone app, you must install a standard > python (and the necessary modules), as you can't distribute Apple's. Really ?!? I think you may be serious !!! If it's true it is close to unbelievable. Isn't python "free" as a general rule ??? This is a stinky thing that MS would do !!! The "copyright" statement doesn't mention anything about Apple. Nor if i type "license()" k9m:src brendan$ /usr/bin/python Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> copyright Copyright (c) 2001-2007 Python Software Foundation. All Rights Reserved. Copyright (c) 2000 BeOpen.com. All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved. Anyway, I guess if it is true, then the easy work around is to install an updated python from python.org :) Cheers, Brendan. -------------- next part -------------- A non-text attachment was scrubbed... Name: Brendan_Simon.vcf Type: text/x-vcard Size: 267 bytes Desc: not available URL: From Chris.Barker at noaa.gov Wed Aug 5 17:28:10 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 05 Aug 2009 08:28:10 -0700 Subject: [Pythonmac-SIG] Pythonmac-SIG Digest, Vol 76, Issue 4 In-Reply-To: <4A796B05.5010305@eTRIX.com.au> References: <4A796B05.5010305@eTRIX.com.au> Message-ID: <4A79A50A.7000502@noaa.gov> Brendan Simon (eTRIX) wrote: >> If you want to create a standalone app, you must install a standard >> python (and the necessary modules), as you can't distribute Apple's. > > Really ?!? I think you may be serious !!! Well, it's certainly true that py2app is designed that way. In any case, if you want something that can really act as a stand-alone, you don't want it to be built with a Python that only works on 10.5. > If it's true it is close to > unbelievable. Isn't python "free" as a general rule ??? > This is a stinky thing that MS would do !!! Apple has done no shortage of such "stinky things" they are NOT an open-source company by any means. > The "copyright" statement doesn't mention anything about Apple. Python itself, and the standard library, are not copyrighted by Apple. However, that doesn't mean that you can re-distribute an Apple-built binary. Aside from that, Apple has added a couple modules that they do hold the copyright on. I suspect that when py2app was designed, it was decided to simply avoid any possible licensing issues. There are plenty of other reasons to use the python.org build anyway. -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 dpeterson at enthought.com Wed Aug 5 18:00:44 2009 From: dpeterson at enthought.com (Dave Peterson) Date: Wed, 05 Aug 2009 11:00:44 -0500 Subject: [Pythonmac-SIG] py2app creating semi_standalone instead of standalone app In-Reply-To: <4A78F000.8000305@eTRIX.com.au> References: <4A78EE70.6030709@eTRIX.com.au> <4A78F000.8000305@eTRIX.com.au> Message-ID: <4A79ACAC.8020504@enthought.com> Brendan Simon (eTRIX) wrote: > Maybe it has something to do with this statement in the py2app website. > > If the --semi-standalone option is used (forced if a vendor Python > is being used), then the not_stdlib_filter will be automatically > added to ensure that the Python standard library is not included. > > > My python is 2.5.4 from Python.org. My freind's python is python 2.5.1 > (standard on Leopard from Apple). > I presume my friends python is "a vendor Python" and thus > semi-standalone is being forced. > > Still not sure what the correct fix is :( > I don't have the code in front of me, but I put something like "semi_standalone = False" in my project's keyword options to force it not to be standalone. -- Dave From schmir at gmail.com Thu Aug 6 09:03:12 2009 From: schmir at gmail.com (Ralf Schmitt) Date: Thu, 6 Aug 2009 09:03:12 +0200 Subject: [Pythonmac-SIG] OS X port of bbfreeze Message-ID: <932f8baf0908060003x2ab97d4fy27cc224cec65133b@mail.gmail.com> Hi all, I'm the author of bbfreeze, which is a tool similar to py2app/py2exe. It currently supports linux and windows. I've started doing a port to OS X last year, but didn't finish it. Now I'm seeking for volunteers, who might be interested in finishing it. bbfreeze uses py2app's modulegraph library and is able to handle egg files and the pkg_resources module. Regards, - Ralf PyPI: http://pypi.python.org/pypi/bbfreeze/0.95.4 hg repo: http://systemexit.de/repo/bbfreeze From aahz at pythoncraft.com Fri Aug 7 00:25:22 2009 From: aahz at pythoncraft.com (Aahz) Date: Thu, 6 Aug 2009 15:25:22 -0700 Subject: [Pythonmac-SIG] Success: PyObjC, PyCurl, and Tiger Message-ID: <20090806222522.GA13928@panix.com> Posting this so that other people can Google it: I have an app that needs to run on both 10.5 (Leopard) and 10.4 (Tiger). We've been building it with PyObjC 1.4 and PyCurl 7.19.x, and I've been trying to upgrade it to PyObjC 2.2 to simplify our builds because we have a second app that needs FSEvents (and therefore PyObjC 2.2). After a lot of poking around, I finally figured out that Tiger needs PyCurl 7.13.1 per /Developer/SDKs/MacOSX10.4u.sdk/usr/include/curl/curlver.h That gets my app mostly working on Tiger, but I needed to downgrade to PyObjC 1.4 because 2.2 isn't clean on Tiger yet. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "...string iteration isn't about treating strings as sequences of strings, it's about treating strings as sequences of characters. The fact that characters are also strings is the reason we have problems, but characters are strings for other good reasons." --Aahz From tfekete at gmail.com Fri Aug 7 00:21:00 2009 From: tfekete at gmail.com (Tibor Fekete) Date: Fri, 7 Aug 2009 00:21:00 +0200 Subject: [Pythonmac-SIG] MacPython Leopard help needed Message-ID: <55fce46f0908061521u5bdc62f2yfba97ce6e81cbdb7@mail.gmail.com> Hi there, under http://wiki.python.org/moin/MacPython/Leopard there is a walkthrough how one should install a mac native idle for python. The creation of the softlink (sudo ln -s /System/Library/Frameworks/Python.framework/ Python.framework) fails since the current directory already has a Python.framework dir with some juice in it instead of /System/Library/Frameworks so the above command returns an error: $ cd /Library/Frameworks $ sudo ln -s /System/Library/Frameworks/Python.framework/ Python.framework ln: Python.framework/: File exists $ ls -al Python.framework/ total 0 drwxr-xr-x 3 root admin 102 J?l 16 2006 . drwxrwxrwx 14 root admin 476 J?l 7 16:49 .. drwxr-xr-x 3 root admin 102 J?l 16 2006 Versions Should I create the softlink vice versa? Thanks for your help in advance. Best, Feka -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Fri Aug 7 20:22:14 2009 From: nad at acm.org (Ned Deily) Date: Fri, 07 Aug 2009 11:22:14 -0700 Subject: [Pythonmac-SIG] MacPython Leopard help needed References: <55fce46f0908061521u5bdc62f2yfba97ce6e81cbdb7@mail.gmail.com> Message-ID: In article <55fce46f0908061521u5bdc62f2yfba97ce6e81cbdb7 at mail.gmail.com>, Tibor Fekete wrote: > under http://wiki.python.org/moin/MacPython/Leopard there is a walkthrough > how one should install a mac native idle for python. > > The creation of the softlink (sudo ln -s > /System/Library/Frameworks/Python.framework/ > Python.framework) fails since the current directory already has a > Python.framework dir with some juice in it instead of > /System/Library/Frameworks so the above command returns an error: > > $ cd /Library/Frameworks > $ sudo ln -s /System/Library/Frameworks/Python.framework/ Python.framework > ln: Python.framework/: File exists > $ ls -al Python.framework/ > total 0 > drwxr-xr-x 3 root admin 102 J?l 16 2006 . > drwxrwxrwx 14 root admin 476 J?l 7 16:49 .. > drwxr-xr-x 3 root admin 102 J?l 16 2006 Versions Chances are you've previously installed one or more Pythons using a python.org installer; they get installed at /Library/Frameworks/Python.framework. If you are sure you don't need any of them, you could just delete that directory. If you don't want to delete versions other than 2.5, you also may be able to get things to work by making the symlink further down, so [untested]: $ cd /Library/Frameworks/Python.framework/Versions $ sudo rm -r 2.5 # if necessary $ sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.5 2.5 On the other hand, the 2.5 IDLE.app has a number of bugs that have been fixed in later releases and Python 2.5 is getting old (the Apple-supplied 2.5 is even older); if it's possible, I'd recommend installing and using the python.org 2.6.2 (or even 3.1 if you want to be on the cutting edge). Which Python distribution to use on OSX is a frequent discussion topic and there are other options and other pros and cons; search the archives if interested. Whatever you do, don't try to delete or alter the Apple-maintained Python 2.5 files in /System/Library. -- Ned Deily, nad at acm.org From charles.hartman at conncoll.edu Sat Aug 8 04:56:46 2009 From: charles.hartman at conncoll.edu (Charles Hartman) Date: Fri, 7 Aug 2009 22:56:46 -0400 Subject: [Pythonmac-SIG] aligning proportional text Message-ID: <764E6F46-AA82-4B59-952C-3F89DD8E776C@conncoll.edu> This may not be the right list, but I think the question may be at least partly Mac-specific. I have lines of text in a proportional font. Within each line I have the index of a certain character. I want to adjust each line horizontally so those indexed characters are vertically aligned. Since I obviously can't just count characters as with a monospaced font, how do I go about translating from character index in the line to pixels? Any hint much appreciated. (Any nudge toward pre-existing libraries or functions, even more!) This is all within wxPython, if that matters; I don't see anything in the wx.StyledTextControl documentation that looks helpful, and I imagine I need something lower- level. Charles Hartman From Brendan.Simon at eTRIX.com.au Sat Aug 8 15:13:42 2009 From: Brendan.Simon at eTRIX.com.au (Brendan Simon (eTRIX)) Date: Sat, 08 Aug 2009 23:13:42 +1000 Subject: [Pythonmac-SIG] Including images (jpg) in app bundle Message-ID: <4A7D7A06.2010600@eTRIX.com.au> I have a jpg image which is displayed in my wxPython app. It is loaded from an 'image' directory. eg. image/mypic.jpg This works fine when I type "python mywxapp" from the command line, but when I build an app bundle it doesn't work. I've tried two options (see below). Both copy the jpg to the Resourses directory, but I loose the images/ directory. What's the best/appropriate way to get image files in the app ?? It has to work with manual invocation too. Put image files in the same directory as the source ??? Thanks, Brendan. DATA_FILES = [ 'images/mypic.jpg' ] OPTIONS = { 'argv_emulation' : True, } setup( app = APP, data_files = DATA_FILES, options = { 'py2app' : OPTIONS }, setup_requires=['py2app'], ) and: DATA_FILES = [] OPTIONS = { 'argv_emulation' : True, 'resources' : 'images/mypic.jpg', } setup( app = APP, data_files = DATA_FILES, options = { 'py2app' : OPTIONS }, setup_requires=['py2app'], ) -------------- next part -------------- A non-text attachment was scrubbed... Name: Brendan_Simon.vcf Type: text/x-vcard Size: 267 bytes Desc: not available URL: From kw at codebykevin.com Sat Aug 8 21:10:50 2009 From: kw at codebykevin.com (Kevin Walzer) Date: Sat, 08 Aug 2009 15:10:50 -0400 Subject: [Pythonmac-SIG] Making a Python application scriptable via AppleScript Message-ID: <4A7DCDBA.9060705@codebykevin.com> What options currently exist for making a Python application on the Mac scriptable via AppleScript, i.e. allowing it to respond to Apple events and making Python data objects and functions accessible from AppleScript? I'm aware of AppScript, but as I understand it, this module is designed more to allow Python apps to drive *other* AppleScriptable apps via the OSA. I'm interested in the opposite. I understand that there used to be some modules to support this, but they appear to be deprecated. Any advice is apprecaited. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From nad at acm.org Sun Aug 9 00:02:53 2009 From: nad at acm.org (Ned Deily) Date: Sat, 08 Aug 2009 15:02:53 -0700 Subject: [Pythonmac-SIG] Making a Python application scriptable via AppleScript References: <4A7DCDBA.9060705@codebykevin.com> Message-ID: In article <4A7DCDBA.9060705 at codebykevin.com>, Kevin Walzer wrote: > What options currently exist for making a Python application on the Mac > scriptable via AppleScript, i.e. allowing it to respond to Apple events > and making Python data objects and functions accessible from AppleScript? > > I'm aware of AppScript, but as I understand it, this module is designed > more to allow Python apps to drive *other* AppleScriptable apps via the > OSA. I'm interested in the opposite. I understand that there used to be > some modules to support this, but they appear to be deprecated. > > Any advice is apprecaited. I have no personal experience but I imagine, perhaps naively, that the "right way" to do that these days would be to use PyObjC and py2app to create a Cocoa application and then build upon Cocoa's built-in support for Apple events. Presumably that would include supplying an sdef and modifying the app bundle's Info.plist to enable scripting as outlined here: http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoa Applications/SApps_implement/SAppsImplement.html#//apple_ref/doc/uid/2000 0037-BAJBBDFE -- Ned Deily, nad at acm.org From hengist.podd at virgin.net Sun Aug 9 15:30:38 2009 From: hengist.podd at virgin.net (has) Date: Sun, 9 Aug 2009 14:30:38 +0100 Subject: [Pythonmac-SIG] Making a Python application scriptable via AppleScript In-Reply-To: References: Message-ID: Kevin Walzer wrote: > What options currently exist for making a Python application on the > Mac scriptable via AppleScript, i.e. allowing it to respond to Apple > events and making Python data objects and functions accessible from > AppleScript? > > I'm aware of AppScript, but as I understand it, this module is > designed more to allow Python apps to drive *other* AppleScriptable > apps via the OSA. I'm interested in the opposite. I understand that > there used to be some modules to support this, but they appear to be > deprecated. If it's a PyObjC-based app then use Cocoa Scripting. It has some issues but will still be quicker than rolling your own. Alternatively, py-aemreceive (in the appscript svn) provides basic support for handling Apple events in Python-based apps. It doesn't provide a framework for implementing an Apple Event Object Model though, so if you want to do that then you'd need to roll your own support (aem references provide a visitor API, AEM_resolve, as a starting point). HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From daniel at keystonewood.com Mon Aug 10 14:40:27 2009 From: daniel at keystonewood.com (Daniel Miller) Date: Mon, 10 Aug 2009 08:40:27 -0400 Subject: [Pythonmac-SIG] Including images (jpg) in app bundle In-Reply-To: <4A7D7A06.2010600@eTRIX.com.au> References: <4A7D7A06.2010600@eTRIX.com.au> Message-ID: On Aug 8, 2009, at 9:13 AM, Brendan Simon (eTRIX) wrote: > I have a jpg image which is displayed in my wxPython app. It is > loaded > from an 'image' directory. > eg. image/mypic.jpg > > This works fine when I type "python mywxapp" from the command line, > but > when I build an app bundle it doesn't work. > I've tried two options (see below). Both copy the jpg to the > Resourses > directory, but I loose the images/ directory. > > What's the best/appropriate way to get image files in the app ?? > It has > to work with manual invocation too. Try this in setup.py, which will put the images in an 'images' subdirectory under Resources in your app bundle: DATA_FILES = [ ('images', 'images/mypic.jpg') ] OPTIONS = { 'argv_emulation' : True } Then do something like this in your app: imagedir = os.path.join(os.environ.get('RESOURCEPATH', '.'), 'images') mypic = os.path.join(imagedir, 'mypic.jpg') The RESOURCEPATH environment variable is set by py2app. If it exists, you can assume that the app is bundled and adjust the image path accordingly. ~ Daniel From leknarf at pacbell.net Mon Aug 10 17:51:27 2009 From: leknarf at pacbell.net (Scott Frankel) Date: Mon, 10 Aug 2009 08:51:27 -0700 Subject: [Pythonmac-SIG] py2app cannot move to target thread error Message-ID: <8ACF0495-1315-49E3-AA61-97642257A1ED@pacbell.net> Hello, I'm troubleshooting a PyQt-PostgreSQL py2app error: "Cannot move to target thread". Note that a test app builds and runs happily. The error only comes up when I add PyQt4.QtSql' to py2app's option includes. eg: This works: OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4._qt']} This doesn't: OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4._qt', 'PyQt4.QtSql']} Researching the error, I've set DYLD_PRINT_LIBRARIES=1 in my shell and am looking for duplicate instances of Qt libraries. I'm not seeing anything obvious. But I also don't know exactly what to look for. For example, should I be concerned with dyld output running the app or building it? I created my build environment using macports. It looks like the correct libs are being accessed. The last of the dyld output looks like this: dyld: loaded: /opt/local/libexec/qt4-mac/plugins/sqldrivers/ libqsqlpsql.bundle dyld: loaded: /opt/local/lib/postgresql83/libpq.5.dylib dyld: loaded: /opt/local/libexec/qt4-mac/lib/QtSql.framework/Versions/ 4/QtSql dyld: loaded: /opt/local/libexec/qt4-mac/lib/QtCore.framework/Versions/ 4/QtCore dyld: loaded: /opt/local/lib/libz.1.dylib dyld: loaded: /opt/local/lib/libssl.0.9.8.dylib dyld: loaded: /opt/local/lib/libcrypto.0.9.8.dylib QObject::moveToThread: Current thread (0x1d17d0) is not the object's thread (0x1a7820). Cannot move to target thread (0x1a7820) Suggestions? Thanks in advance! Scott From pedrooconnell at gmail.com Tue Aug 11 21:25:15 2009 From: pedrooconnell at gmail.com (pedro) Date: Tue, 11 Aug 2009 15:25:15 -0400 Subject: [Pythonmac-SIG] run python script on another computer's terminal (LAN) Message-ID: Hi, does anyone know how to send a command that is within a python script to another computer's terminal. This is what it looks like in Applescript. tell application "Terminal" of machine "eppc://USERNAME:PASSWORD at COMPUTER2.local" do script "ls" end tell I basically want something like os.system('ls') to be run on another computer in my LAN. Thanks Pete From pythonmac at rebertia.com Tue Aug 11 21:35:21 2009 From: pythonmac at rebertia.com (Chris Rebert) Date: Tue, 11 Aug 2009 15:35:21 -0400 Subject: [Pythonmac-SIG] run python script on another computer's terminal (LAN) In-Reply-To: References: Message-ID: <50697b2c0908111235j42440662ic7cdffa611f96175@mail.gmail.com> On Tue, Aug 11, 2009 at 3:25 PM, pedro wrote: > > Hi, does anyone know how to send a command that is within a python > script to another computer's terminal. This is what it looks like in > Applescript. > > tell application "Terminal" of machine > "eppc://USERNAME:PASSWORD at COMPUTER2.local" > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?do script "ls" > ? ? ? ? ? ? ? ? ? ? ? ?end tell What is "eppc://"? I can't seem to find anything on it. Cheers, Chris -- http://blog.rebertia.com From nad at acm.org Tue Aug 11 22:41:03 2009 From: nad at acm.org (Ned Deily) Date: Tue, 11 Aug 2009 13:41:03 -0700 Subject: [Pythonmac-SIG] run python script on another computer's terminal (LAN) References: <50697b2c0908111235j42440662ic7cdffa611f96175@mail.gmail.com> Message-ID: In article <50697b2c0908111235j42440662ic7cdffa611f96175 at mail.gmail.com>, Chris Rebert wrote: > On Tue, Aug 11, 2009 at 3:25 PM, pedro wrote: > > Hi, does anyone know how to send a command that is within a python > > script to another computer's terminal. This is what it looks like in > > Applescript. > > tell application "Terminal" of machine > > "eppc://USERNAME:PASSWORD at COMPUTER2.local" > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?do script "ls" > > ? ? ? ? ? ? ? ? ? ? ? ?end tell > What is "eppc://"? I can't seem to find anything on it. "eppc:" is the protocol-identifier for Remote Apple Events, i.e. executing AppleScripts on remote machines. (That's what that Sharing system preference is for.) You want to install and use appscript. Something like this should work: >>> from appscript import * >>> term=app("Terminal",url="eppc://USERNAME:PASSWORD at COMPUTER2.local") >>> term.do_script("ls") http://appscript.sourceforge.net/py-appscript/doc/appscript-manual/07_app licationobjects.html -- Ned Deily, nad at acm.org From nad at acm.org Tue Aug 11 23:55:45 2009 From: nad at acm.org (Ned Deily) Date: Tue, 11 Aug 2009 14:55:45 -0700 Subject: [Pythonmac-SIG] run python script on another computer's terminal (LAN) References: <50697b2c0908111235j42440662ic7cdffa611f96175@mail.gmail.com> Message-ID: In article , Ned Deily wrote: > In article > <50697b2c0908111235j42440662ic7cdffa611f96175 at mail.gmail.com>, > Chris Rebert wrote: > > On Tue, Aug 11, 2009 at 3:25 PM, pedro wrote: > > > Hi, does anyone know how to send a command that is within a python > > > script to another computer's terminal. This is what it looks like in > > > Applescript. > > > tell application "Terminal" of machine > > > "eppc://USERNAME:PASSWORD at COMPUTER2.local" > > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?do script "ls" > > > ? ? ? ? ? ? ? ? ? ? ? ?end tell > > What is "eppc://"? I can't seem to find anything on it. > > "eppc:" is the protocol-identifier for Remote Apple Events, i.e. > executing AppleScripts on remote machines. (That's what that Sharing > system preference is for.) > > You want to install and use appscript. Something like this should work: > > >>> from appscript import * > >>> term=app("Terminal",url="eppc://USERNAME:PASSWORD at COMPUTER2.local") > >>> term.do_script("ls") > > http://appscript.sourceforge.net/py-appscript/doc/appscript-manual/07_app > licationobjects.html Sorry, something-like-this won't quite work. Reading better and testing, something like this: >>> from appscript import * >>> term=app(url="eppc://USERNAME:PASSWORD at COMPUTER2.local/Terminal") >>> term.do_script("ls") has a better chance of working. -- Ned Deily, nad at acm.org From pedrooconnell at gmail.com Tue Aug 11 21:41:32 2009 From: pedrooconnell at gmail.com (Pete O'Connell) Date: Tue, 11 Aug 2009 15:41:32 -0400 Subject: [Pythonmac-SIG] run python script on another computer's terminal (LAN) In-Reply-To: <50697b2c0908111235j42440662ic7cdffa611f96175@mail.gmail.com> References: <50697b2c0908111235j42440662ic7cdffa611f96175@mail.gmail.com> Message-ID: <8e423ca70908111241k315ef452y502dfc0fbcb95b83@mail.gmail.com> Hi, eppc is what you use in applescript when you want to have an app on another computer on you network perform a task. This is what Remote Apple Events is for in the System Preferences>Sharing dialog. Pete On Tue, Aug 11, 2009 at 3:35 PM, Chris Rebert wrote: > On Tue, Aug 11, 2009 at 3:25 PM, pedro wrote: > > > > Hi, does anyone know how to send a command that is within a python > > script to another computer's terminal. This is what it looks like in > > Applescript. > > > > tell application "Terminal" of machine > > "eppc://USERNAME:PASSWORD at COMPUTER2.local" > > do script "ls" > > end tell > > What is "eppc://"? I can't seem to find anything on it. > > Cheers, > Chris > -- > http://blog.rebertia.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From njriley at illinois.edu Tue Aug 11 22:31:57 2009 From: njriley at illinois.edu (Nicholas Riley) Date: Tue, 11 Aug 2009 15:31:57 -0500 Subject: [Pythonmac-SIG] run python script on another computer's terminal (LAN) In-Reply-To: <50697b2c0908111235j42440662ic7cdffa611f96175@mail.gmail.com> References: <50697b2c0908111235j42440662ic7cdffa611f96175@mail.gmail.com> Message-ID: <20090811203157.GA22258@illinois.edu> On Tue, Aug 11, 2009 at 03:35:21PM -0400, Chris Rebert wrote: > What is "eppc://"? I can't seem to find anything on it. It's remote Apple Events (previously known as "Program Sharing"). You can turn it on in Sharing System Preferences. Unfortunately in OS X, remote Apple Events are very flaky. I'd suggest the original questioner just use SSH, either with the built-in OpenSSH through subprocess or with paramiko (http://www.lag.net/paramiko/). I've replaced all my use of remote Apple Events with it. -- Nicholas Riley From gabriel.rossetti at arimaz.com Wed Aug 12 11:41:12 2009 From: gabriel.rossetti at arimaz.com (Gabriel Rossetti) Date: Wed, 12 Aug 2009 11:41:12 +0200 Subject: [Pythonmac-SIG] py2app & multiple executable files with a main launcher Message-ID: <4A828E38.3070905@arimaz.com> Hello, I am trying to bundle an application I wrote usinf py2app. The application has a launcher "launcher.py" and a Python script "main.py" that calls the launcher several times in sub-processes with diff args. I successfully did this with py2exe for windows. I had py2exe generate "launcher.exe" and "main.exe" and when I run "main.exe" it does what it's supposed to correctly. I can't get this to work with py2app though. it won't allow me to generate several executable files. Does anyone know how to do this or have a better idea? I have to run multiple sub programmes in parallel but I'd like to only have one entry-point (the user just needs to click on one file) to run it. Thanks, Gabriel From alexandre at quessy.net Wed Aug 12 15:06:42 2009 From: alexandre at quessy.net (Alexandre Quessy) Date: Wed, 12 Aug 2009 09:06:42 -0400 Subject: [Pythonmac-SIG] run python script on another computer's terminal (LAN) In-Reply-To: <20090811203157.GA22258@illinois.edu> References: <50697b2c0908111235j42440662ic7cdffa611f96175@mail.gmail.com> <20090811203157.GA22258@illinois.edu> Message-ID: <72236ba90908120606y5b49fd64iea64fb3d0aa7e8bb@mail.gmail.com> Hi! Do you want to see the output in the remote computer's display? If so, screen might help you. You could also use the "open" command to open the Terminal supplying it a command. The "xterm" terminal in X11 is nice for that. (or better: rxvt) If you just want to get the resulting output, use either subprocess, commands or pxssh ! Anyways, ssh is the way to go. You can look at my "lunch" script for inspiration. https://svn.sat.qc.ca/trac/postures/wiki/Lunch a 2009/8/11 Nicholas Riley : > On Tue, Aug 11, 2009 at 03:35:21PM -0400, Chris Rebert wrote: >> What is "eppc://"? I can't seem to find anything on it. > > It's remote Apple Events (previously known as "Program Sharing"). ?You > can turn it on in Sharing System Preferences. > > Unfortunately in OS X, remote Apple Events are very flaky. ?I'd > suggest the original questioner just use SSH, either with the built-in > OpenSSH through subprocess or with paramiko > (http://www.lag.net/paramiko/). ?I've replaced all my use of remote > Apple Events with it. > > -- > Nicholas Riley > _______________________________________________ > Pythonmac-SIG maillist ?- ?Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- Alexandre Quessy http://alexandre.quessy.net/ From gabriel.rossetti at arimaz.com Wed Aug 12 16:41:16 2009 From: gabriel.rossetti at arimaz.com (Gabriel Rossetti) Date: Wed, 12 Aug 2009 16:41:16 +0200 Subject: [Pythonmac-SIG] py2app & multiprocessing Message-ID: <4A82D48C.7010905@arimaz.com> Hello everyone, I am trying to use py2app with multiprocessing but it doesn't work correctly, I get this : ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib-dynload/multiprocessing/_multiprocessing.so' not found I don't understand why it is looking for that there since multiprocessing is not installed there. I told it to include the multiprocessing package and it doesn't complain when I run python setup.py py2app. Does anyone have an idea? Thanks, Gabriel From anjiro at cc.gatech.edu Wed Aug 12 17:13:13 2009 From: anjiro at cc.gatech.edu (Daniel Ashbrook) Date: Wed, 12 Aug 2009 11:13:13 -0400 Subject: [Pythonmac-SIG] py2app & multiprocessing In-Reply-To: <4A82D48C.7010905@arimaz.com> References: <4A82D48C.7010905@arimaz.com> Message-ID: I don't know the answer to this question, but I wanted to warn you: be careful using multiprocessing with PyObjc. I never was able to get it into a easy test case, but sometimes one or more of my multiprocessing processes would never return when used in conjunction with PyObjc, and the program would endlessly loop waiting for results. I eventually had to move all of the multiprocessing to an external process launched with Popen. dan On Aug 12, 2009, at 10:41a, Gabriel Rossetti wrote: > Hello everyone, I am trying to use py2app with multiprocessing but > it doesn't work correctly, I get this : > > ImportError: '/System/Library/Frameworks/Python.framework/Versions/ > 2.5/lib-dynload/multiprocessing/_multiprocessing.so' not found > > I don't understand why it is looking for that there since > multiprocessing is not installed there. I told it to include the > multiprocessing package and it doesn't complain when I run python > setup.py py2app. > > Does anyone have an idea? > > Thanks, > Gabriel > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From gabriel.rossetti at arimaz.com Wed Aug 12 17:38:30 2009 From: gabriel.rossetti at arimaz.com (Gabriel Rossetti) Date: Wed, 12 Aug 2009 17:38:30 +0200 Subject: [Pythonmac-SIG] py2app & multiprocessing In-Reply-To: References: <4A82D48C.7010905@arimaz.com> Message-ID: <4A82E1F6.3000008@arimaz.com> Thank you Daniel for your comment, I am having a rather hard time porting my app to Mac. It works great on linux, it also works on windows, but on Mac it goes crazy, it even locks up the OS (all I can do is move the mouse pinwheel of death around but no clicks, no keyboard, no SSH, nothing) and I have to had reboot it. It uses a combination of Twisted and wxPython and is rather large, so I don't know where this comes from, it could be wx, twisted or the two together. Anyways, I was thinking of using multiprocessing instead of Popen because Popen could not find my files when using py2app, even though they were in the same directory as the main exec. I even tried putting the execs in the resource dir but no luck, so I thought maybe Popen would work better since it does not use files. Gabriel Daniel Ashbrook wrote: > I don't know the answer to this question, but I wanted to warn you: be > careful using multiprocessing with PyObjc. I never was able to get it > into a easy test case, but sometimes one or more of my multiprocessing > processes would never return when used in conjunction with PyObjc, and > the program would endlessly loop waiting for results. I eventually had > to move all of the multiprocessing to an external process launched > with Popen. > > dan > > > On Aug 12, 2009, at 10:41a, Gabriel Rossetti wrote: > >> Hello everyone, I am trying to use py2app with multiprocessing but it >> doesn't work correctly, I get this : >> >> ImportError: >> '/System/Library/Frameworks/Python.framework/Versions/2.5/lib-dynload/multiprocessing/_multiprocessing.so' >> not found >> >> I don't understand why it is looking for that there since >> multiprocessing is not installed there. I told it to include the >> multiprocessing package and it doesn't complain when I run python >> setup.py py2app. >> >> Does anyone have an idea? >> >> Thanks, >> Gabriel >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > From pedrooconnell at gmail.com Wed Aug 12 17:43:26 2009 From: pedrooconnell at gmail.com (pedro) Date: Wed, 12 Aug 2009 11:43:26 -0400 Subject: [Pythonmac-SIG] run python script on another computer's terminal (LAN) References: <50697b2c0908111235j42440662ic7cdffa611f96175@mail.gmail.com> Message-ID: On 2009-08-11 17:55:45 -0400, Ned Deily said: > In article , > Ned Deily wrote: >> In article >> <50697b2c0908111235j42440662ic7cdffa611f96175 at mail.gmail.com>, >> Chris Rebert wrote: >>> On Tue, Aug 11, 2009 at 3:25 PM, pedro wrote: >>>> Hi, does anyone know how to send a command that is within a python >>>> script to another computer's terminal. This is what it looks like in >>>> Applescript. >>>> tell application "Terminal" of machine >>>> "eppc://USERNAME:PASSWORD at COMPUTER2.local" >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?do script "ls" >>>> ? ? ? ? ? ? ? ? ? ? ? ?end tell >>> What is "eppc://"? I can't seem to find anything on it. >> >> "eppc:" is the protocol-identifier for Remote Apple Events, i.e. >> executing AppleScripts on remote machines. (That's what that Sharing >> system preference is for.) >> >> You want to install and use appscript. Something like this should work: >> >>>>> from appscript import * >>>>> term=app("Terminal",url="eppc://USERNAME:PASSWORD at COMPUTER2.local") >>>>> term.do_script("ls") >> >> http://appscript.sourceforge.net/py-appscript/doc/appscript-manual/07_app >> licationobjects.html > > Sorry, something-like-this won't quite work. Reading better and > testing, something like this: > >>>> from appscript import * >>>> term=app(url="eppc://USERNAME:PASSWORD at COMPUTER2.local/Terminal") >>>> term.do_script("ls") > > has a better chance of working. Hi Ned appscript works perfectly. Thanks for the tip. Paramiko looks promising once I get some linux Boxes on the farm, thanks Nicholas. Pete From aahz at pythoncraft.com Wed Aug 12 21:59:23 2009 From: aahz at pythoncraft.com (Aahz) Date: Wed, 12 Aug 2009 12:59:23 -0700 Subject: [Pythonmac-SIG] py2app & multiprocessing In-Reply-To: <4A82D48C.7010905@arimaz.com> References: <4A82D48C.7010905@arimaz.com> Message-ID: <20090812195923.GA4962@panix.com> On Wed, Aug 12, 2009, Gabriel Rossetti wrote: > > Hello everyone, I am trying to use py2app with multiprocessing but it > doesn't work correctly, I get this : > > ImportError: > '/System/Library/Frameworks/Python.framework/Versions/2.5/lib-dynload/multiprocessing/_multiprocessing.so' > not found > > I don't understand why it is looking for that there since > multiprocessing is not installed there. I told it to include the > multiprocessing package and it doesn't complain when I run python > setup.py py2app. My experience with py2app so far is strictly with non-system Python, maybe that would work better for you? Especially given that 2.6.2 includes multiprocessing. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "...string iteration isn't about treating strings as sequences of strings, it's about treating strings as sequences of characters. The fact that characters are also strings is the reason we have problems, but characters are strings for other good reasons." --Aahz From Chris.Barker at noaa.gov Wed Aug 12 22:15:29 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 12 Aug 2009 13:15:29 -0700 Subject: [Pythonmac-SIG] py2app & multiprocessing In-Reply-To: <4A82E1F6.3000008@arimaz.com> References: <4A82D48C.7010905@arimaz.com> <4A82E1F6.3000008@arimaz.com> Message-ID: <4A8322E1.60303@noaa.gov> Gabriel Rossetti wrote: > no SSH, nothing) and I have to had reboot it. It uses a combination of > Twisted and wxPython and is rather large, so I don't know where this > comes from, it could be wx, twisted or the two together. It's probably not wx -- it is used a fair bit on Macs. I don't know how much Twisted is used on the Mac. It might be worth asking on a Twisted list. Also, have you tried just a simple Twisted app on its own? And yes, I suppose the two together could be an issue. Oh, and do you have these problems running without py2app? > Popen could > not find my files when using py2app, This should be a simple path issue -- a few judicious print statements should help here. > even though they were in the same > directory as the main exec. I even tried putting the execs in the > resource dir but no luck, hmm -- I think that is indeed where the working dir is set by py2app when starting op. try: print os.getcwd() you can look in the "Console" app to see stuff printed to stdout. -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 dpeterson at enthought.com Wed Aug 12 22:22:48 2009 From: dpeterson at enthought.com (Dave Peterson) Date: Wed, 12 Aug 2009 15:22:48 -0500 Subject: [Pythonmac-SIG] py2app & multiprocessing In-Reply-To: <4A8322E1.60303@noaa.gov> References: <4A82D48C.7010905@arimaz.com> <4A82E1F6.3000008@arimaz.com> <4A8322E1.60303@noaa.gov> Message-ID: <4A832498.9050100@enthought.com> Christopher Barker wrote: > hmm -- I think that is indeed where the working dir is set by py2app > when starting op. try: > > print os.getcwd() > > you can look in the "Console" app to see stuff printed to stdout. Or you can just open up a terminal and explicitly run the executable like so: /path/to/my/AppBundle/Contents/MacOSX/myexecutable This is useful for getting stderr and stdout both. -- Dave From Chris.Barker at noaa.gov Wed Aug 12 22:30:13 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 12 Aug 2009 13:30:13 -0700 Subject: [Pythonmac-SIG] py2app & multiple executable files with a main launcher In-Reply-To: <4A828E38.3070905@arimaz.com> References: <4A828E38.3070905@arimaz.com> Message-ID: <4A832655.5000804@noaa.gov> Gabriel Rossetti wrote: > I am trying to bundle an application I wrote usinf py2app. The > application has a launcher "launcher.py" and a Python script "main.py" > that calls the launcher several times in sub-processes with diff args. I wanted to do something like this a while back (quite a while!). Check out this thread: http://mail.python.org/pipermail/pythonmac-sig/2005-August/014928.html In particular, this post: http://mail.python.org/pipermail/pythonmac-sig/2005-August/014940.html And no, I never did get that going -- we found another solution. -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 nathan.stocks at gmail.com Wed Aug 12 22:48:38 2009 From: nathan.stocks at gmail.com (Nathan) Date: Wed, 12 Aug 2009 14:48:38 -0600 Subject: [Pythonmac-SIG] py2app & multiprocessing In-Reply-To: <4A8322E1.60303@noaa.gov> References: <4A82D48C.7010905@arimaz.com> <4A82E1F6.3000008@arimaz.com> <4A8322E1.60303@noaa.gov> Message-ID: <96c9d6a80908121348x7e29d001q674ccc0bd649048e@mail.gmail.com> On Wed, Aug 12, 2009 at 2:15 PM, Christopher Barker wrote: > Gabriel Rossetti wrote: >> >> no SSH, nothing) and I have to had reboot it. It uses a combination of >> Twisted and wxPython and is rather large, so I don't know where this comes >> from, it could be wx, twisted or the two together. > > It's probably not wx -- it is used a fair bit on Macs. > > I don't know how much Twisted is used on the Mac. It might be worth asking > on a Twisted list. Also, have you tried just a simple Twisted app on its > own? I use Twisted successfully on my Mac all the time. I haven't run into any mac-specific twisted bugs, but then I'm not a power twisted user either. ~ Nathan From Brendan.Simon at eTRIX.com.au Fri Aug 14 02:16:49 2009 From: Brendan.Simon at eTRIX.com.au (Brendan Simon (eTRIX)) Date: Fri, 14 Aug 2009 10:16:49 +1000 Subject: [Pythonmac-SIG] argv_emulation for url open events Message-ID: <4A84ACF1.9040202@eTRIX.com.au> argv emulation does not work for url open events. eg. click on webbrowser with link to "myurl:myinfo" does not put "myurl:myinfo" into sys.argv. I modified the py2app argv_emulation.py to support this and have attached a patch. Is there a py2app developer who could have a look at this, test, and commit to the py2app source code so that it will be available in the next release. My python and Mac OS X skills are "raw" so please feel free to modify it in any way to improve it :) Thanks, Brendan. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: argv_emulation.py.url.patch URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Brendan_Simon.vcf Type: text/x-vcard Size: 267 bytes Desc: not available URL: From Brendan.Simon at eTRIX.com.au Fri Aug 14 02:18:32 2009 From: Brendan.Simon at eTRIX.com.au (Brendan Simon (eTRIX)) Date: Fri, 14 Aug 2009 10:18:32 +1000 Subject: [Pythonmac-SIG] argv_emulation for url open events In-Reply-To: <4A84ACF1.9040202@eTRIX.com.au> References: <4A84ACF1.9040202@eTRIX.com.au> Message-ID: <4A84AD58.2060205@eTRIX.com.au> Forgot to mention that the original argv_emulation.py file that I modified was in the following directory :- /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/bootstrap Cheers, Brendan. Brendan Simon (eTRIX) wrote: > argv emulation does not work for url open events. eg. click on > webbrowser with link to "myurl:myinfo" does not put "myurl:myinfo" into > sys.argv. > > I modified the py2app argv_emulation.py to support this and have > attached a patch. > > Is there a py2app developer who could have a look at this, test, and > commit to the py2app source code so that it will be available in the > next release. > My python and Mac OS X skills are "raw" so please feel free to modify it > in any way to improve it :) > > Thanks, Brendan. > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: Brendan_Simon.vcf Type: text/x-vcard Size: 267 bytes Desc: not available URL: From aahz at pythoncraft.com Fri Aug 14 02:30:42 2009 From: aahz at pythoncraft.com (Aahz) Date: Thu, 13 Aug 2009 17:30:42 -0700 Subject: [Pythonmac-SIG] argv_emulation for url open events In-Reply-To: <4A84ACF1.9040202@eTRIX.com.au> References: <4A84ACF1.9040202@eTRIX.com.au> Message-ID: <20090814003042.GA21569@panix.com> On Fri, Aug 14, 2009, Brendan Simon (eTRIX) wrote: > > argv emulation does not work for url open events. eg. click on > webbrowser with link to "myurl:myinfo" does not put "myurl:myinfo" into > sys.argv. > > I modified the py2app argv_emulation.py to support this and have > attached a patch. You probably want to upload the patch: http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html#online-resources http://trac.pythonmac.org/py2app/ However, the latter URL doesn't seem to be working.... -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "...string iteration isn't about treating strings as sequences of strings, it's about treating strings as sequences of characters. The fact that characters are also strings is the reason we have problems, but characters are strings for other good reasons." --Aahz From gabriel.rossetti at arimaz.com Fri Aug 14 16:52:15 2009 From: gabriel.rossetti at arimaz.com (Gabriel Rossetti) Date: Fri, 14 Aug 2009 16:52:15 +0200 Subject: [Pythonmac-SIG] py2app & multiprocessing In-Reply-To: <4A8322E1.60303@noaa.gov> References: <4A82D48C.7010905@arimaz.com> <4A82E1F6.3000008@arimaz.com> <4A8322E1.60303@noaa.gov> Message-ID: <4A857A1F.2080100@arimaz.com> Christopher Barker wrote: > Gabriel Rossetti wrote: >> no SSH, nothing) and I have to had reboot it. It uses a combination >> of Twisted and wxPython and is rather large, so I don't know where >> this comes from, it could be wx, twisted or the two together. > > It's probably not wx -- it is used a fair bit on Macs. > > I don't know how much Twisted is used on the Mac. It might be worth > asking on a Twisted list. Also, have you tried just a simple Twisted > app on its own? > > And yes, I suppose the two together could be an issue. Yes actually, it was the two together. I used something someone had told me about a some time ago, that is to use the wx eventloop as the main eventloop and have twisted's run in a separate thread, it now works fine on Mac. I'm still working on the pz2app part though, I'll kep everyone updated. Gabriel > > Oh, and do you have these problems running without py2app? > >> Popen could not find my files when using py2app, > > This should be a simple path issue -- a few judicious print statements > should help here. > > > even though they were in the same >> directory as the main exec. I even tried putting the execs in the >> resource dir but no luck, > > hmm -- I think that is indeed where the working dir is set by py2app > when starting op. try: > > print os.getcwd() > > you can look in the "Console" app to see stuff printed to stdout. > > -Chris > From gabriel.rossetti at arimaz.com Fri Aug 14 17:04:56 2009 From: gabriel.rossetti at arimaz.com (Gabriel Rossetti) Date: Fri, 14 Aug 2009 17:04:56 +0200 Subject: [Pythonmac-SIG] py2app & multiple executable files with a main launcher In-Reply-To: <4A832655.5000804@noaa.gov> References: <4A828E38.3070905@arimaz.com> <4A832655.5000804@noaa.gov> Message-ID: <4A857D18.3010708@arimaz.com> Christopher Barker wrote: > Gabriel Rossetti wrote: >> I am trying to bundle an application I wrote usinf py2app. The >> application has a launcher "launcher.py" and a Python script >> "main.py" that calls the launcher several times in sub-processes with >> diff args. > > I wanted to do something like this a while back (quite a while!). > Check out this thread: > > http://mail.python.org/pipermail/pythonmac-sig/2005-August/014928.html > > In particular, this post: > > http://mail.python.org/pipermail/pythonmac-sig/2005-August/014940.html > > And no, I never did get that going -- we found another solution. > > -Chris > > Thanks Chris, are you able to tell me what solution you found? Gabriel From hpj at urpla.net Fri Aug 14 17:27:09 2009 From: hpj at urpla.net (Hans-Peter Jansen) Date: Fri, 14 Aug 2009 17:27:09 +0200 Subject: [Pythonmac-SIG] Mac OS-X 10.5 and "two icons bouncing in the dock" problem Message-ID: <200908141727.09490.hpj@urpla.net> Hi, attached PyQt script demonstrates an ugly issue, I'm desperately fighting with since a couple of days :-(. Issue: when starting the app via double click or single click on dock icon or dropping a plain/text file on dock or application icon, all actions lead to two bouncing icons. The one with the blue spot is the good one, that stops bouncing after start-up. The bad one will stop bouncing eventually, and shows "Application not responding" in its context menu then. As long as the bad one exists, dropping files on the good one will be ignored. After killing (and sometimes removing from the dock is necessary) all is well - one can drop files one the good one and on the app icon, all behaves well, up to the point of being terminated, then this ugly game starts again. The issue is not depending on the arch, but on OS-X 10.5. It does not happen with 10.4. It may be related to pyinstaller, but since I need to deploy the app on arbitrary 10.4 and later systems, omitting it is not an option. Pre conditions: OS-X 10.5(.7/.8) with ppc or x86 arch Xcode 3.1.3 Python-2.6.2 Qt-4.5.2 sip-4.8.2 PyQt-4.5.4 Build it this way: tar xvzf launchprob.tar.gz && cd launchprob && ./build.sh -debug This command will fetch pyinstaller's SVN trunk, build pyinstaller, generate the app itself: LaunchProb.app. It can be moved to any system, as long as all required packages are cleanly built for both archs(*) and the minimum OS-X release is 10.4. Any ideas how to solve this issue are greatly appreciated. Thanks, Pete (*) I can provide more details for this on request -------------- next part -------------- A non-text attachment was scrubbed... Name: launchprob.tar.gz Type: application/x-tgz Size: 2848 bytes Desc: not available URL: From janssen at parc.com Fri Aug 14 18:06:28 2009 From: janssen at parc.com (Bill Janssen) Date: Fri, 14 Aug 2009 09:06:28 PDT Subject: [Pythonmac-SIG] Mac OS-X 10.5 and "two icons bouncing in the dock" problem In-Reply-To: <200908141727.09490.hpj@urpla.net> References: <200908141727.09490.hpj@urpla.net> Message-ID: <30250.1250265988@parc.com> I guess the question is, why two dock icons? I'm seeing something perhaps similar; I have a Python-Cocoa app that when started will cause one of those pop-up windows, "App quit unexpectedly, do you want to submit a bug report to Apple", and the crash report shows that a multi-threaded program crashed in thread 0 with SEGV attempting to access location 0. But the app seems to be running, just fine. When I poked at it a bit more, it looks like using "open" or double-click to launch the app somehow causes two instances to start (fork, somewhere?), and one of them is bad. This is with Xcode 3.1.3 and OS X 10.5, but no Qt, no Python-2.6.2. Bill From Chris.Barker at noaa.gov Fri Aug 14 21:25:25 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 14 Aug 2009 12:25:25 -0700 Subject: [Pythonmac-SIG] py2app & multiple executable files with a main launcher In-Reply-To: <4A857D18.3010708@arimaz.com> References: <4A828E38.3070905@arimaz.com> <4A832655.5000804@noaa.gov> <4A857D18.3010708@arimaz.com> Message-ID: <4A85BA25.3080507@noaa.gov> Gabriel Rossetti wrote: > Christopher Barker wrote: >> And no, I never did get that going -- we found another solution. > Thanks Chris, are you able to tell me what solution you found? I don't think it's relevant to your problem, but we ended up embedding the whole darn thing in a wxPython application. Here's a PyCon presentation about it: http://us.pycon.org/2009/conference/schedule/event/92/ -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 Chris.Barker at noaa.gov Fri Aug 14 22:13:51 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 14 Aug 2009 13:13:51 -0700 Subject: [Pythonmac-SIG] Mac OS-X 10.5 and "two icons bouncing in the dock" problem In-Reply-To: <200908141727.09490.hpj@urpla.net> References: <200908141727.09490.hpj@urpla.net> Message-ID: <4A85C57F.1060109@noaa.gov> Hans-Peter Jansen wrote: > The issue is not depending on the arch, but on OS-X 10.5. It does not happen > with 10.4. It may be related to pyinstaller, but since I need to deploy the > app on arbitrary 10.4 and later systems, omitting it is not an option. Well, it looks like Mac support it brand new (an not yet in a release version) for PyInstaller, so that is a likely culprit. Have you tried py2app? Anyway, It's great to hear that PyInstaller is working on Mac Support -- it'll be great to have a bundler that works on all three Major (and a few minor) platforms. Does it build a "proper" application bundle? Has it been working well for you otherwise? -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 hpj at urpla.net Fri Aug 14 23:03:49 2009 From: hpj at urpla.net (Hans-Peter Jansen) Date: Fri, 14 Aug 2009 23:03:49 +0200 Subject: [Pythonmac-SIG] =?iso-8859-1?q?Mac_OS-X_10=2E5_and_=22two_icons_b?= =?iso-8859-1?q?ouncing_in_the_dock=22_=09problem?= In-Reply-To: <4A85C57F.1060109@noaa.gov> References: <200908141727.09490.hpj@urpla.net> <4A85C57F.1060109@noaa.gov> Message-ID: <200908142303.49728.hpj@urpla.net> Am Freitag, 14. August 2009 schrieb Christopher Barker: > Hans-Peter Jansen wrote: > > The issue is not depending on the arch, but on OS-X 10.5. It does not > > happen with 10.4. It may be related to pyinstaller, but since I need to > > deploy the app on arbitrary 10.4 and later systems, omitting it is not > > an option. > > Well, it looks like Mac support it brand new (an not yet in a release > version) for PyInstaller, so that is a likely culprit. > > Have you tried py2app? Yes, 5 minutes ago. Apart from version.plist missing in Python 2.6.2 framework and faking one, it did work, indeed. > Anyway, It's great to hear that PyInstaller is working on Mac Support -- > it'll be great to have a bundler that works on all three Major (and a > few minor) platforms. Yes, that's pretty cool. > Does it build a "proper" application bundle? That's not ready yet, but it's on the way. > Has it been working well > for you otherwise? Yes, it does (after fixing a few bugs, that prevented it from being really bi arch aka. universal build). Pete From hpj at urpla.net Fri Aug 14 23:41:36 2009 From: hpj at urpla.net (Hans-Peter Jansen) Date: Fri, 14 Aug 2009 23:41:36 +0200 Subject: [Pythonmac-SIG] Mac OS-X 10.5 and "two icons bouncing in the dock" problem In-Reply-To: <30250.1250265988@parc.com> References: <200908141727.09490.hpj@urpla.net> <30250.1250265988@parc.com> Message-ID: <200908142341.37088.hpj@urpla.net> Hi Bill, Am Freitag, 14. August 2009 schrieb Bill Janssen: > I guess the question is, why two dock icons? I'm seeing something > perhaps similar; I have a Python-Cocoa app that when started will cause > one of those pop-up windows, "App quit unexpectedly, do you want to > submit a bug report to Apple", and the crash report shows that a > multi-threaded program crashed in thread 0 with SEGV attempting to > access location 0. But the app seems to be running, just fine. When I > poked at it a bit more, it looks like using "open" or double-click to > launch the app somehow causes two instances to start (fork, somewhere?), > and one of them is bad. This is with Xcode 3.1.3 and OS X 10.5, but no > Qt, no Python-2.6.2. Yes, Mac OS-X desktop services looks flaky from certain perspectives (yours and mine ;) I did found a fishy smelling fork in pyinstaller bootstrap code, and eliminated it already, but still no cigar :(. This is my first project on the Mac and I'm pretty fed up from puny sources, combined with low S/N ratio when it comes to technical issues (apart from this thread at least). Could you give me some hints how you debug such things? Thanks, Pete -------------- next part -------------- A non-text attachment was scrubbed... Name: pyinstaller.diff Type: text/x-diff Size: 1081 bytes Desc: not available URL: From janssen at parc.com Sat Aug 15 00:16:44 2009 From: janssen at parc.com (Bill Janssen) Date: Fri, 14 Aug 2009 15:16:44 PDT Subject: [Pythonmac-SIG] Mac OS-X 10.5 and "two icons bouncing in the dock" problem In-Reply-To: <200908142341.37088.hpj@urpla.net> References: <200908141727.09490.hpj@urpla.net> <30250.1250265988@parc.com> <200908142341.37088.hpj@urpla.net> Message-ID: <39498.1250288204@parc.com> Anything having to do with Finder or the Dock (or Activity Monitor, for that matter) seems to be somewhat over-simplified and mysterious. "Not responding", in Activity Monitor, for instance, seems to be due to an undocumented window server probe of processes marked somehow as applications, for which Python has no built-in support. I find Thread Viewer helpful in looking at programs. But even better is to build your own version of the system Python (2.5.1) with debugging symbols, and use that instead of /usr/bin/python (or, of course, you could use a different version of Python entirely). Then you can point gdb at that running application, and using the Python gdb macros, http://wiki.python.org/moin/DebuggingWithGdb, you can see exactly what's going on in all the threads. I don't use pyinstaller, either. I just build a standard OS X install bundle by hand, and then as I develop just change the contents of of the Resource subdirectory. Bill From alexandre at quessy.net Sat Aug 15 15:16:01 2009 From: alexandre at quessy.net (Alexandre Quessy) Date: Sat, 15 Aug 2009 09:16:01 -0400 Subject: [Pythonmac-SIG] py2app & multiprocessing In-Reply-To: <4A857A1F.2080100@arimaz.com> References: <4A82D48C.7010905@arimaz.com> <4A82E1F6.3000008@arimaz.com> <4A8322E1.60303@noaa.gov> <4A857A1F.2080100@arimaz.com> Message-ID: <72236ba90908150616v3be8ba0bp488028b5ac28caaa@mail.gmail.com> Hi everyone, I use Twisted everyday, and have worked on a wx GUI for an application using it. We also use Py2App to bundle it up. It works flawlessly. I use the Twisted main loop, which controls the wx events loop. To make both of them work together, you need to do the following : {{{ from twisted.internet import wxreactor wxreactor.install() }}} You can check our RawMaterials application since it is free software. It has a lot of dependencies, so it is rather difficult to build. https://svn.sat.qc.ca/trac/rawmaterials/browser/trunk/src/RawMaterials.py We use a shell script to build and copy things in the .app : https://svn.sat.qc.ca/trac/rawmaterials/browser/trunk/src/make_app.sh I would say the problem is probably more about multiprocessing than wx and twisted. Using subprocess, or pexpect, or commands might be a better idea. a 2009/8/14 Gabriel Rossetti : > Christopher Barker wrote: >> >> Gabriel Rossetti wrote: >>> >>> no SSH, nothing) and I have to had reboot it. It uses a combination of >>> Twisted and wxPython and is rather large, so I don't know where this comes >>> from, it could be wx, twisted or the two together. >> >> It's probably not wx -- it is used a fair bit on Macs. >> >> I don't know how much Twisted is used on the Mac. It might be worth asking >> on a Twisted list. Also, have you tried just a simple Twisted app on its >> own? >> >> And yes, I suppose the two together could be an issue. > > Yes actually, it was the two together. I used something someone had told me > about a some time ago, that is to use the wx eventloop as the main eventloop > and have twisted's run in a separate thread, it now works fine on Mac. > > I'm still working on the pz2app part though, I'll kep everyone updated. > > Gabriel > >> >> Oh, and do you have these problems running without py2app? >> >>> Popen could not find my files when using py2app, >> >> This should be a simple path issue -- a few judicious print statements >> should help here. >> >> > even though they were in the same >>> >>> directory as the main exec. I even tried putting the execs in the >>> resource dir but no luck, >> >> hmm -- I think that is indeed where the working dir is set by py2app when >> starting op. try: >> >> print os.getcwd() >> >> you can look in the "Console" app to see stuff printed to stdout. >> >> -Chris >> > _______________________________________________ > Pythonmac-SIG maillist ?- ?Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- Alexandre Quessy http://alexandre.quessy.net/ From pedrooconnell at gmail.com Mon Aug 17 05:37:16 2009 From: pedrooconnell at gmail.com (Pete) Date: Sun, 16 Aug 2009 23:37:16 -0400 Subject: [Pythonmac-SIG] no module named appscript error Message-ID: Hi When I create an app using py2app, I get this error: "no module named appscript" When I run the python script that the app is based on, appscript is working fine. Anyone know what would be causing this? Thanks Pete From nad at acm.org Mon Aug 17 06:27:48 2009 From: nad at acm.org (Ned Deily) Date: Sun, 16 Aug 2009 21:27:48 -0700 Subject: [Pythonmac-SIG] no module named appscript error References: Message-ID: In article , Pete wrote: > Hi When I create an app using py2app, I get this error: > "no module named appscript" > > When I run the python script that the app is based on, appscript is > working fine. > Anyone know what would be causing this? appscript is not part of the standard library. Have you included it in a packages option to py2app? -- Ned Deily, nad at acm.org From pedrooconnell at gmail.com Mon Aug 17 07:43:42 2009 From: pedrooconnell at gmail.com (pedro) Date: Mon, 17 Aug 2009 01:43:42 -0400 Subject: [Pythonmac-SIG] no module named appscript error References: Message-ID: On 2009-08-17 00:27:48 -0400, Ned Deily said: > In article , Pete > wrote: >> Hi When I create an app using py2app, I get this error: >> "no module named appscript" >> >> When I run the python script that the app is based on, appscript is >> working fine. >> Anyone know what would be causing this? > > appscript is not part of the standard library. Have you included it in > a packages option to py2app? Hi, so any third party modules should be imported into the setup.py script, correct? Pete From hengist.podd at virgin.net Mon Aug 17 14:36:44 2009 From: hengist.podd at virgin.net (has) Date: Mon, 17 Aug 2009 13:36:44 +0100 Subject: [Pythonmac-SIG] no module named appscript error In-Reply-To: References: Message-ID: <845487CB-39CA-4761-83E4-1111DAE71D17@virgin.net> Pete wrote: > Hi When I create an app using py2app, I get this error: > "no module named appscript" > > When I run the python script that the app is based on, appscript is > working fine. > Anyone know what would be causing this? If you've installed one or more copies of Python yourself, make sure you're building your application with the same version of Python that you're testing on. Also, make sure any third-party .eggs used by your app are installed in unzipped form (easy_install -Z module_name); py2app currently doesn't work with zipped .eggs. HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From ronaldoussoren at mac.com Tue Aug 18 08:07:10 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 18 Aug 2009 08:07:10 +0200 Subject: [Pythonmac-SIG] no module named appscript error In-Reply-To: References: Message-ID: <74A79C18-456C-4D31-BD84-94F38488263E@mac.com> On 17 Aug, 2009, at 6:27, Ned Deily wrote: > In article , Pete > > wrote: >> Hi When I create an app using py2app, I get this error: >> "no module named appscript" >> >> When I run the python script that the app is based on, appscript is >> working fine. >> Anyone know what would be causing this? > > appscript is not part of the standard library. Have you included it > in > a packages option to py2app? That's a red herring. Py2app should automaticly detect that appscript is used. The output of "python setup.py py2app" is rather verbose, but it should help in finding the issue. Does the output mention appscript, and does it mention other modules/packages that it cannot find? Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From madzientist at gmail.com Tue Aug 18 19:02:58 2009 From: madzientist at gmail.com (Suresh Krishna) Date: Tue, 18 Aug 2009 19:02:58 +0200 Subject: [Pythonmac-SIG] os 9.2 Message-ID: hi, i have to work with mac OS 9.2 for legacy reasons...is there a compiled version of python for this os ? i need to get input about variable values from the user and then print out some text files that make use of this input. a gui would be nice, but keyboard based input would be ok too... thanks much, suresh ps. if there isn't a version of python that will work, perhaps you could suggest some other scripting language for 0S 9.2 ? From nad at acm.org Tue Aug 18 20:18:29 2009 From: nad at acm.org (Ned Deily) Date: Tue, 18 Aug 2009 11:18:29 -0700 Subject: [Pythonmac-SIG] os 9.2 References: Message-ID: In article , "Suresh Krishna" wrote: > i have to work with mac OS 9.2 for legacy reasons...is there a > compiled version of python for this os ? i need to get input about > variable values from the user and then print out some text files that > make use of this input. a gui would be nice, but keyboard based input > would be ok too... Try here: http://homepages.cwi.nl/~jack/macpython/download.html Good luck! -- Ned Deily, nad at acm.org From bgquest at gmail.com Wed Aug 19 19:29:13 2009 From: bgquest at gmail.com (beegee beegee) Date: Wed, 19 Aug 2009 22:59:13 +0530 Subject: [Pythonmac-SIG] having problems executing pylot Message-ID: <4644d56e0908191029r643e447bvc13718d0b3b12b40@mail.gmail.com> I am new to python (i have version 2.5 on my machine), I have a mac os tiger 10.4.11 with 1 GB ram I just downloaded a performance testing tool called pylot I downloaded the entire folder to my desktop I am expected to run the following command python run.py -g I tried the following a. I right clicked on the file run.py and selected aquamacs and then did a start interpreter it opened the file but i am lost i don't know how to run this command will someone please tell me how i could run this file and any other file written in notepad or whatever using python file.py etc? b. I opened my terminal window, and typed python run.py -g i either got a syntax error or file does not exist please help (the instructions are in this link: http://www.pylot.org/gettingstarted.html) -------------- next part -------------- An HTML attachment was scrubbed... URL: From leknarf at pacbell.net Wed Aug 19 19:41:06 2009 From: leknarf at pacbell.net (Scott Frankel) Date: Wed, 19 Aug 2009 10:41:06 -0700 Subject: [Pythonmac-SIG] py2app cannot move to target thread error In-Reply-To: <8ACF0495-1315-49E3-AA61-97642257A1ED@pacbell.net> References: <8ACF0495-1315-49E3-AA61-97642257A1ED@pacbell.net> Message-ID: <49EE8EAF-12F4-4C96-9392-AF3895D876B1@pacbell.net> Hello, I'm stuck somewhere between macports and py2app. I'm hopeful that someone here may be able to offer some advice on how to rectify my build environment. Exporting DYLD_PRINT_LIBRARIES=1 and running a test app built with QtSql support and another one without it, I'm pretty sure that the following line is the clue: dyld: loaded: /opt/local/libexec/qt4-mac/plugins/sqldrivers/ libqsqlpsql.bundle My question is, how do I access/get/compile the PSQL support my app requires? My environment's qt4-mac, python26, and py2app are from macports. The qt4-mac has the psql dependency: py26-py2app-devel @0.4.2_1 (active) py26-pyqt4 @4.5.4_0 (active) qt4-mac @4.5.1_0+psql (active) Thanks in advance! Scott On Aug 10, 2009, at 8:51 AM, Scott Frankel wrote: > > Hello, > > I'm troubleshooting a PyQt-PostgreSQL py2app error: "Cannot move to > target thread". Note that a test app builds and runs happily. The > error only comes up when I add PyQt4.QtSql' to py2app's option > includes. eg: > > This works: > OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4._qt']} > > This doesn't: > OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4._qt', > 'PyQt4.QtSql']} > > Researching the error, I've set DYLD_PRINT_LIBRARIES=1 in my shell > and am looking for duplicate instances of Qt libraries. I'm not > seeing anything obvious. But I also don't know exactly what to look > for. > > For example, should I be concerned with dyld output running the app > or building it? > > I created my build environment using macports. It looks like the > correct libs are being accessed. The last of the dyld output looks > like this: > > dyld: loaded: /opt/local/libexec/qt4-mac/plugins/sqldrivers/ > libqsqlpsql.bundle > dyld: loaded: /opt/local/lib/postgresql83/libpq.5.dylib > dyld: loaded: /opt/local/libexec/qt4-mac/lib/QtSql.framework/ > Versions/4/QtSql > dyld: loaded: /opt/local/libexec/qt4-mac/lib/QtCore.framework/ > Versions/4/QtCore > dyld: loaded: /opt/local/lib/libz.1.dylib > dyld: loaded: /opt/local/lib/libssl.0.9.8.dylib > dyld: loaded: /opt/local/lib/libcrypto.0.9.8.dylib > QObject::moveToThread: Current thread (0x1d17d0) is not the object's > thread (0x1a7820). > Cannot move to target thread (0x1a7820) > > > Suggestions? > > Thanks in advance! > Scott > > > > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From dhubleizh at o2.pl Thu Aug 20 01:32:58 2009 From: dhubleizh at o2.pl (=?ISO-8859-2?Q?Cezary_Krzy=BFanowski?=) Date: Thu, 20 Aug 2009 01:32:58 +0200 Subject: [Pythonmac-SIG] Don't bundle everything in a framework Message-ID: <8BDE93F4-8B2D-42CD-8E10-866DF262A719@o2.pl> Hi! I've been using py2app quite some time now and I've been lovin' it. But the thing is, that my final bundles get *very* large, I mean a Qt gui application could reach up to 100MB (before the ugly dSYM deleting, but it still gets to 60MB afterwards) and wxWidgets application up to 40-50MB. Is there a way to bundle only some modules from those huge frameworks? I mean both Qt and Wx can be built as many dynamic libraries composing the whole framework. In a C++ application I'd link and then distribute only those modules I use. That's not the case in py2app, where absolutely everything from a framework gets bundled, even when properly built modular Qt and Wx. The only solution to this I've found is to build python bindings for only selected modules and use that custom built when packaging. That's a bit annoying and I've got that working only with Qt --- wx doesn't have explicit --disable-module-x or --disable-library-x config switch, and going through 5 pages of --disable/enable features and their deps is a hell. The size is a problem for me, cause I've wrote a status icon for a wiki, that is supposed to be small, tidy and minimal, but I get a dmg of 25MB (Qt case). I've tried all the --exclude and --exclude-dynlib, or using __import__ or using from wx import something_more_special or deleting and manually adding, but I can't get that working. Czarek From Chris.Barker at noaa.gov Thu Aug 20 05:54:53 2009 From: Chris.Barker at noaa.gov (Chris Barker) Date: Wed, 19 Aug 2009 20:54:53 -0700 Subject: [Pythonmac-SIG] os 9.2 In-Reply-To: References: Message-ID: <4A8CC90D.7040105@noaa.gov> Suresh Krishna wrote: > i have to work with mac OS 9.2 for legacy reasons...is there a > compiled version of python for this os ? It looks like Jack Jansen's old page is still there, complete with downloads: http://homepages.cwi.nl/~jack/macpython/download.html Look for EasyDialogs, I think it's called, for simple GUIs. Also, TKinter worked, I think. good luck! -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 bgquest at gmail.com Thu Aug 20 10:15:41 2009 From: bgquest at gmail.com (beegee beegee) Date: Thu, 20 Aug 2009 13:45:41 +0530 Subject: [Pythonmac-SIG] problems with executing python files Message-ID: <4644d56e0908200115s4a77a4f8n6d97f5ea9e698aff@mail.gmail.com> I am new to python (i have version 2.5 on my machine), I have a mac os tiger 10.4.11 with 1 GB ram I just downloaded a performance testing tool called pylot I downloaded the entire folder to my desktop I am expected to run the following command python run.py -g I tried the following a. I right clicked on the file run.py and selected aquamacs and then did a start interpreter it opened the file but i am lost i don't know how to run this command will someone please tell me how i could run this file and any other file written in notepad or whatever using python file.py etc? b. I opened my terminal window, and typed python run.py -g i either got a syntax error or file does not exist please help (the instructions are in this link: http://www.pylot.org/gettingstarted.html) -------------- next part -------------- An HTML attachment was scrubbed... URL: From pythonmac at rebertia.com Thu Aug 20 10:17:53 2009 From: pythonmac at rebertia.com (Chris Rebert) Date: Thu, 20 Aug 2009 01:17:53 -0700 Subject: [Pythonmac-SIG] problems with executing python files In-Reply-To: <4644d56e0908200115s4a77a4f8n6d97f5ea9e698aff@mail.gmail.com> References: <4644d56e0908200115s4a77a4f8n6d97f5ea9e698aff@mail.gmail.com> Message-ID: <50697b2c0908200117k7f6fc105y62687ffab486ca11@mail.gmail.com> On Thu, Aug 20, 2009 at 1:15 AM, beegee beegee wrote: > b. I opened my terminal window, and typed python run.py -g > > i either got a syntax error or > file does not exist please help Please include the exact error message and shell session transcript. Cheers, Chris -- http://blog.rebertia.com From gabriel.rossetti at arimaz.com Thu Aug 20 13:26:57 2009 From: gabriel.rossetti at arimaz.com (Gabriel Rossetti) Date: Thu, 20 Aug 2009 13:26:57 +0200 Subject: [Pythonmac-SIG] py2app & multiprocessing In-Reply-To: <72236ba90908150616v3be8ba0bp488028b5ac28caaa@mail.gmail.com> References: <4A82D48C.7010905@arimaz.com> <4A82E1F6.3000008@arimaz.com> <4A8322E1.60303@noaa.gov> <4A857A1F.2080100@arimaz.com> <72236ba90908150616v3be8ba0bp488028b5ac28caaa@mail.gmail.com> Message-ID: <4A8D3301.1090104@arimaz.com> Hello Alexandre, His is how I had it before, but it was causing me problems and I was told that it's better tu run them in separate threads. Do you use twistd (.tac files)? I'll have a look at your application, thanks! Gabriel Alexandre Quessy wrote: > Hi everyone, > I use Twisted everyday, and have worked on a wx GUI for an application > using it. We also use Py2App to bundle it up. It works flawlessly. I > use the Twisted main loop, which controls the wx events loop. > > To make both of them work together, you need to do the following : > > {{{ > from twisted.internet import wxreactor > wxreactor.install() > }}} > > You can check our RawMaterials application since it is free software. > It has a lot of dependencies, so it is rather difficult to build. > https://svn.sat.qc.ca/trac/rawmaterials/browser/trunk/src/RawMaterials.py > We use a shell script to build and copy things in the .app : > https://svn.sat.qc.ca/trac/rawmaterials/browser/trunk/src/make_app.sh > > I would say the problem is probably more about multiprocessing than wx > and twisted. Using subprocess, or pexpect, or commands might be a > better idea. > > a > > 2009/8/14 Gabriel Rossetti : > >> Christopher Barker wrote: >> >>> Gabriel Rossetti wrote: >>> >>>> no SSH, nothing) and I have to had reboot it. It uses a combination of >>>> Twisted and wxPython and is rather large, so I don't know where this comes >>>> from, it could be wx, twisted or the two together. >>>> >>> It's probably not wx -- it is used a fair bit on Macs. >>> >>> I don't know how much Twisted is used on the Mac. It might be worth asking >>> on a Twisted list. Also, have you tried just a simple Twisted app on its >>> own? >>> >>> And yes, I suppose the two together could be an issue. >>> >> Yes actually, it was the two together. I used something someone had told me >> about a some time ago, that is to use the wx eventloop as the main eventloop >> and have twisted's run in a separate thread, it now works fine on Mac. >> >> I'm still working on the pz2app part though, I'll kep everyone updated. >> >> Gabriel >> >> >>> Oh, and do you have these problems running without py2app? >>> >>> >>>> Popen could not find my files when using py2app, >>>> >>> This should be a simple path issue -- a few judicious print statements >>> should help here. >>> >>> >>>> even though they were in the same >>>> >>>> directory as the main exec. I even tried putting the execs in the >>>> resource dir but no luck, >>>> >>> hmm -- I think that is indeed where the working dir is set by py2app when >>> starting op. try: >>> >>> print os.getcwd() >>> >>> you can look in the "Console" app to see stuff printed to stdout. >>> >>> -Chris >>> >>> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> >> > > > > From alexandre at quessy.net Thu Aug 20 14:06:11 2009 From: alexandre at quessy.net (Alexandre Quessy) Date: Thu, 20 Aug 2009 08:06:11 -0400 Subject: [Pythonmac-SIG] py2app & multiprocessing In-Reply-To: <4A8D3301.1090104@arimaz.com> References: <4A82D48C.7010905@arimaz.com> <4A82E1F6.3000008@arimaz.com> <4A8322E1.60303@noaa.gov> <4A857A1F.2080100@arimaz.com> <72236ba90908150616v3be8ba0bp488028b5ac28caaa@mail.gmail.com> <4A8D3301.1090104@arimaz.com> Message-ID: <72236ba90908200506u2bd80930p81ce93d5e2a2fce9@mail.gmail.com> Hi again, I think using multiprocessing should be the way to go, so that you use twisted for the main event loop in one process, and wx for the main event loop in the other. In a simple way, you can also build your own custom multiprocessing tool. You just need one system calls, and one network connection. (for controlling the other process) Like this : pid = os.fork() if pid == 0: # child # no need to call os.execv(), since your code is in python # open TCP socket as a receiver # start event loop else: # child child_pid = pid # open TCP socket as a sender # start event loop ...and no, I am not using twistd. For now, I prefer not to rely on any other executable, and start the main loop in my app. reactor.run() You can also look at some other free software I am working on : * Lunch : https://svn.sat.qc.ca/trac/postures/wiki/Lunch * ToonLoop : http://www.toonloop.com/ * Miville : https://svn.sat.qc.ca/trac/miville * RawMaterials : https://svn.sat.qc.ca/trac/rawmaterials They all use twisted, but RawMaterials is the only for Mac. (the code is rather old and should be updated.) ToonLoop should be ported to mac with a app bundle soon. It is a live stop motion software, which is also the topic of my master. What does your application do ? Is it free software as well ? Ciao, -- Alexandre Quessy http://alexandre.quessy.net/ 2009/8/20 Gabriel Rossetti : > Hello Alexandre, > > His is how I had it before, but it was causing me problems and I was told > that it's better tu run them in separate threads. Do you use twistd (.tac > files)? I'll have a look at your application, thanks! > > Gabriel > > Alexandre Quessy wrote: >> >> Hi everyone, >> I use Twisted everyday, and have worked on a wx GUI for an application >> using it. We also use Py2App to bundle it up. It works flawlessly. I >> use the Twisted main loop, which controls the wx events loop. >> >> To make both of them work together, you need to do the following : >> >> {{{ >> from twisted.internet import wxreactor >> wxreactor.install() >> }}} >> >> You can check our RawMaterials application since it is free software. >> It has a lot of dependencies, so it is rather difficult to build. >> https://svn.sat.qc.ca/trac/rawmaterials/browser/trunk/src/RawMaterials.py >> We use a shell script to build and copy things in the .app : >> https://svn.sat.qc.ca/trac/rawmaterials/browser/trunk/src/make_app.sh >> >> I would say the problem is probably more about multiprocessing than wx >> and twisted. Using subprocess, or pexpect, or commands might be a >> better idea. >> >> a >> >> 2009/8/14 Gabriel Rossetti : >> >>> >>> Christopher Barker wrote: >>> >>>> >>>> Gabriel Rossetti wrote: >>>> >>>>> >>>>> no SSH, nothing) and I have to had reboot it. It uses a combination of >>>>> Twisted and wxPython and is rather large, so I don't know where this >>>>> comes >>>>> from, it could be wx, twisted or the two together. >>>>> >>>> >>>> It's probably not wx -- it is used a fair bit on Macs. >>>> >>>> I don't know how much Twisted is used on the Mac. It might be worth >>>> asking >>>> on a Twisted list. Also, have you tried just a simple Twisted app on its >>>> own? >>>> >>>> And yes, I suppose the two together could be an issue. >>>> >>> >>> Yes actually, it was the two together. I used something someone had told >>> me >>> about a some time ago, that is to use the wx eventloop as the main >>> eventloop >>> and have twisted's run in a separate thread, it now works fine on Mac. >>> >>> I'm still working on the pz2app part though, I'll kep everyone updated. >>> >>> Gabriel >>> >>> >>>> >>>> Oh, and do you have these problems running without py2app? >>>> >>>> >>>>> >>>>> Popen could not find my files when using py2app, >>>>> >>>> >>>> This should be a simple path issue -- a few judicious print statements >>>> should help here. >>>> >>>> >>>>> >>>>> even though they were in the same >>>>> >>>>> directory as the main exec. I even tried putting the execs in the >>>>> resource dir but no luck, >>>>> >>>> >>>> hmm -- I think that is indeed where the working dir is set by py2app >>>> when >>>> starting op. try: >>>> >>>> print os.getcwd() >>>> >>>> you can look in the "Console" app to see stuff printed to stdout. >>>> >>>> -Chris >>>> >>>> >>> >>> _______________________________________________ >>> Pythonmac-SIG maillist ?- ?Pythonmac-SIG at python.org >>> http://mail.python.org/mailman/listinfo/pythonmac-sig >>> >>> >> >> >> >> > From oag at optusnet.com.au Wed Aug 19 05:03:33 2009 From: oag at optusnet.com.au (Oliver Goodman) Date: Wed, 19 Aug 2009 13:03:33 +1000 Subject: [Pythonmac-SIG] py2app import errors Message-ID: <845D195D-8DDA-458F-A3C2-BC88C2B180C5@optusnet.com.au> Hi, I'm having problems getting py2app to work for me. The program (minimal test case): # test.py from Crypto.Cipher import DES3 if __name__ == '__main__': pass Runs fine on the command line. Then I do: mymble:bob oag$ rm -rf build/ dist/ mymble:bob oag$ py2applet --make-setup test.py Existing setup.py detected, replace? [Y/n] y Wrote setup.py mymble:bob oag$ python setup.py py2app running py2app creating /Users/oag/Projects/python/bob/build creating /Users/oag/Projects/python/bob/build/bdist.macosx-10.5-i386 creating /Users/oag/Projects/python/bob/build/bdist.macosx-10.5-i386/ python2.5-semi_standalone creating /Users/oag/Projects/python/bob/build/bdist.macosx-10.5-i386/ python2.5-semi_standalone/app creating /Users/oag/Projects/python/bob/build/bdist.macosx-10.5-i386/ python2.5-semi_standalone/app/collect creating /Users/oag/Projects/python/bob/build/bdist.macosx-10.5-i386/ python2.5-semi_standalone/app/temp creating /Users/oag/Projects/python/bob/dist creating build/bdist.macosx-10.5-i386/python2.5-semi_standalone/app/ lib-dynload creating build/bdist.macosx-10.5-i386/python2.5-semi_standalone/app/ Frameworks *** filtering dependencies *** 199 total 191 filtered 0 orphaned 8 remaining *** create binaries *** creating /Users/oag/Projects/python/bob/build/bdist.macosx-10.5-i386/ python2.5-semi_standalone/app/temp/Crypto creating /Users/oag/Projects/python/bob/build/bdist.macosx-10.5-i386/ python2.5-semi_standalone/app/temp/Crypto/Cipher creating python loader for extension 'Crypto.Cipher.DES3' *** byte compile python files *** byte-compiling /Library/Python/2.5/site-packages/Crypto/Cipher/ __init__.py to Crypto/Cipher/__init__.pyc creating /Users/oag/Projects/python/bob/build/bdist.macosx-10.5-i386/ python2.5-semi_standalone/app/collect/Crypto creating /Users/oag/Projects/python/bob/build/bdist.macosx-10.5-i386/ python2.5-semi_standalone/app/collect/Crypto/Cipher byte-compiling /Library/Python/2.5/site-packages/Crypto/__init__.py to Crypto/__init__.pyc byte-compiling /Library/Python/2.5/site-packages/py2app-0.3.6- py2.5.egg/py2app/bootstrap/argv_emulation.py to argv_emulation.pyc byte-compiling /Library/Python/2.5/site-packages/py2app-0.3.6- py2.5.egg/py2app/bootstrap/boot_app.py to boot_app.pyc byte-compiling /Library/Python/2.5/site-packages/py2app-0.3.6- py2.5.egg/py2app/bootstrap/chdir_resource.py to chdir_resource.pyc byte-compiling /Library/Python/2.5/site-packages/py2app-0.3.6- py2.5.egg/py2app/bootstrap/disable_linecache.py to disable_linecache.pyc byte-compiling /Users/oag/Projects/python/bob/test.py to test.pyc byte-compiling /Users/oag/Projects/python/bob/build/bdist.macosx-10.5- i386/python2.5-semi_standalone/app/temp/Crypto/Cipher/DES3.py to Crypto/Cipher/DES3.pyc *** creating application bundle: test *** copying /System/Library/Frameworks/Python.framework/Versions/2.5/ Resources/Python.app/Contents/Resources/PythonApplet.icns -> /Users/ oag/Projects/python/bob/dist/test.app/Contents/Resources copying test.py -> /Users/oag/Projects/python/bob/dist/test.app/ Contents/Resources creating /Users/oag/Projects/python/bob/dist/test.app/Contents/ Resources/lib creating /Users/oag/Projects/python/bob/dist/test.app/Contents/ Resources/lib/python2.5 copying build/bdist.macosx-10.5-i386/python2.5-semi_standalone/app/ site-packages.zip -> /Users/oag/Projects/python/bob/dist/test.app/ Contents/Resources/lib/python2.5 creating /Users/oag/Projects/python/bob/dist/test.app/Contents/ Resources/lib/python2.5/lib-dynload creating /Users/oag/Projects/python/bob/dist/test.app/Contents/ Frameworks creating /Users/oag/Projects/python/bob/dist/test.app/Contents/ Resources/lib/python2.5/lib-dynload/Crypto creating /Users/oag/Projects/python/bob/dist/test.app/Contents/ Resources/lib/python2.5/lib-dynload/Crypto/Cipher copying /Library/Python/2.5/site-packages/Crypto/Cipher/DES3.so -> / Users/oag/Projects/python/bob/dist/test.app/Contents/Resources/lib/ python2.5/lib-dynload/Crypto/Cipher stripping DES3.so stripping test stripping saved 71852 bytes (138156 / 210008) mymble:bob oag$ open dist/test.app/ Running it gives me: 19/08/09 12:54:17 PM [0x0-0x3d13d1].org.pythonmac.unspecified.test[11989] ImportError: '/ System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ lib-dynload/Crypto/Cipher/DES3.so' not found My setup is standard and I haven't done anything non-obvious. computer: Mac OS X 10.5.8 Intel Core 2 Duo python: Python 2.5.1 (r251:54863, Feb 9 2009, 18:49:36) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin py2app version: 0.3.6 pycrypto: 2.0.1 for py2.5 (egg in site-packages) I also tried adding the --site-packages flag and -i Crypto.Cipher.DES3 to no avail. -Oliver From aahz at pythoncraft.com Thu Aug 20 17:47:53 2009 From: aahz at pythoncraft.com (Aahz) Date: Thu, 20 Aug 2009 08:47:53 -0700 Subject: [Pythonmac-SIG] py2app import errors In-Reply-To: <845D195D-8DDA-458F-A3C2-BC88C2B180C5@optusnet.com.au> References: <845D195D-8DDA-458F-A3C2-BC88C2B180C5@optusnet.com.au> Message-ID: <20090820154753.GA12686@panix.com> On Wed, Aug 19, 2009, Oliver Goodman wrote: > > I'm having problems getting py2app to work for me. > > The program (minimal test case): > > # test.py > from Crypto.Cipher import DES3 Is Crypto in a zipped .egg? If yes, you need to unzip it. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "Given that C++ has pointers and typecasts, it's really hard to have a serious conversation about type safety with a C++ programmer and keep a straight face. It's kind of like having a guy who juggles chainsaws wearing body armor arguing with a guy who juggles rubber chickens wearing a T-shirt about who's in more danger." --Roy Smith From bgquest at gmail.com Thu Aug 20 18:41:37 2009 From: bgquest at gmail.com (beegee beegee) Date: Thu, 20 Aug 2009 22:11:37 +0530 Subject: [Pythonmac-SIG] Unable to execute python file Message-ID: <4644d56e0908200941g538a1d02yea512538071eeaee@mail.gmail.com> Hey guysI need some help here I am new to python, I have a mac os tiger 10.4.11 I just downloaded a performance testing tool called pylot I downloaded the entire folder to my desktop I am expected to run the following command python run.py -g (the instructions are in this link: http://www.pylot.org/gettingstarted.html) I opened the terminal window and typed python run.py -g and I got the message shown below I then opened aquamacs and clicked on file -> open in mode->python and selected the file run.py I need to run the command run.py -g How can I do this? I right clicked on the file run.py and opened it with IDLE please see the image below -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgquest at gmail.com Thu Aug 20 19:47:11 2009 From: bgquest at gmail.com (beegee beegee) Date: Thu, 20 Aug 2009 23:17:11 +0530 Subject: [Pythonmac-SIG] check if wxpython has been installed properly Message-ID: <4644d56e0908201047w7aba0d97v8138d02c9d7171d0@mail.gmail.com> hi guys i opened my terminal window on a mac os x tiger 10.4.11 and tried to do the following guruprasad-gopinaths-computer:~/Desktop/pylot guruprasadgopinath$ python run.py -g Pylot was unable to start the GUI. Check if wxPython is installed properly. guruprasad-gopinaths-computer:~/Desktop/pylot guruprasadgopinath$ please suggest what to do -------------- next part -------------- An HTML attachment was scrubbed... URL: From santagada at gmail.com Fri Aug 21 14:30:56 2009 From: santagada at gmail.com (Leonardo Santagada) Date: Fri, 21 Aug 2009 09:30:56 -0300 Subject: [Pythonmac-SIG] Is anyone getting strange bus errors with macports python 2.6? Message-ID: This is the bug i've been getting: http://trac.macports.org/ticket/20286 Can anyone else confirm this, or maybe even better, have an idea on what is going on? -- Leonardo Santagada santagada at gmail.com From bschollnick at UR.Rochester.edu Fri Aug 21 18:53:03 2009 From: bschollnick at UR.Rochester.edu (Benjamin Schollnick) Date: Fri, 21 Aug 2009 12:53:03 -0400 Subject: [Pythonmac-SIG] Authentication via python? In-Reply-To: <490787F8.5070101@codebykevin.com> Message-ID: Folks, I know that I was able to use the Authorization module on 10.5, but I?m testing this on Snow Leopard, and I?m getting tons of errors when I attempt to install it on Snow Leopard.... Is there any updates to Authorization, or a better work around? - Benjamin On 10/28/08 5:45 PM, "Kevin Walzer" wrote: > Benjamin Schollnick wrote: >> > Folks, >> > >> > I?m working on some time machine scripting... In a gist, there is a >> > .Backup.log file that I want to access via readline & python.... >> > >>> >>From the MOSX gui, it appears some of the files require root access (eg. >> > Authentication dialog pops up). Now, I am using the applet maker to >> compile >> > the python to a GUI stub, so I can?t SUDO the python script... Is there >> > some method that I can use to authenticate via the python script >> internally? >> > >> > I?m in the middle of a google search on this, but I am having no luck at >> > refining my search phrase currently (Macintosh python authenticate)... >> > >> > - Benjamin > > > Take a look at Bob Ippolito's authorization package: > > http://www.undefined.org/python/#Authorization > > > -- > Kevin Walzer > Code by Kevin > http://www.codebykevin.com > - Benjamin ------------- University Information Technology Information Technology Specialist In an Emergency, first contact the University IT Help Desk: Extension 52000 (585-275-2000) Then feel free to contact me at: Email - Benjamin.Schollnick at rochester.edu Cell - (585)747-2349 Desk - Extension 55462 (585-275-5462) ------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at acm.org Fri Aug 21 19:25:54 2009 From: nad at acm.org (Ned Deily) Date: Fri, 21 Aug 2009 10:25:54 -0700 Subject: [Pythonmac-SIG] Is anyone getting strange bus errors with macports python 2.6? References: Message-ID: In article , Leonardo Santagada wrote: > This is the bug i've been getting: > > http://trac.macports.org/ticket/20286 > > Can anyone else confirm this, or maybe even better, have an idea on > what is going on? This may be a red herring, but since you mention mimetypes.py in the macports bug report, you might want to take a look at the current ongoing discussion in the Python issue tracker about mimetypes.py and some major fixes for it: http://bugs.python.org/issue6626 -- Ned Deily, nad at acm.org From bschollnick at UR.Rochester.edu Fri Aug 21 20:42:31 2009 From: bschollnick at UR.Rochester.edu (Benjamin Schollnick) Date: Fri, 21 Aug 2009 14:42:31 -0400 Subject: [Pythonmac-SIG] Py2App for Python 2.6? In-Reply-To: Message-ID: Folks, It?s been a long time, since I looked at Mac python bundlers.... And especially with Snow Leopard, what?s the state of Py2App? Are there any other recommendations for making applications out Python scripts? I need to ensure support for Leopard, and Snow Leopard.... - Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From bschollnick at UR.Rochester.edu Fri Aug 21 21:01:18 2009 From: bschollnick at UR.Rochester.edu (Benjamin Schollnick) Date: Fri, 21 Aug 2009 15:01:18 -0400 Subject: [Pythonmac-SIG] Py2App for Python 2.6? In-Reply-To: Message-ID: Okay, I see py2app has had some changes, but I can?t seem to find more detail on the changes for setup.py file... I can?t seem to get py2app to bundle up wxpython with the application... Setup.py: """ This is a setup.py script generated by py2applet Usage: python setup.py py2app """ from setuptools import setup import wx APP = ['run_installers.py'] DATA_FILES = [] OPTIONS = {'argv_emulation': True} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'] ) If change setup_requires=['py2app'] to setup_requires=['py2app', ?wx?] I receive: dhcp105-53:installer Ben$ python setup.py py2app /Library/Python/2.6/site-packages/Pyrex/Compiler/Errors.py:17: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6 self.message = message Couldn't find index page for 'wx' (maybe misspelled?) No local packages or download links found for wx So I have removed the ?wx? from the setup_requires line, and instead attempted to force in the inclusion: python setup.py py2app --includes=wx --packages=wx And it appeared to bundle but if I run the application I receive an GUI import error ?importError: No Module named wx?. Can anyone advise? - Benjamin On 8/21/09 2:42 PM, "Benjamin Schollnick" wrote: > Folks, > > It?s been a long time, since I looked at Mac python bundlers.... And > especially with Snow Leopard, what?s the state of Py2App? Are there any other > recommendations for making applications out Python scripts? I need to ensure > support for Leopard, and Snow Leopard.... > > - Ben > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig - Benjamin ------------- University Information Technology Information Technology Specialist In an Emergency, first contact the University IT Help Desk: Extension 52000 (585-275-2000) Then feel free to contact me at: Email - Benjamin.Schollnick at rochester.edu Cell - (585)747-2349 Desk - Extension 55462 (585-275-5462) ------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From emoy at apple.com Sat Aug 22 00:12:20 2009 From: emoy at apple.com (Edward Moy) Date: Fri, 21 Aug 2009 15:12:20 -0700 Subject: [Pythonmac-SIG] check if wxpython has been installed properly In-Reply-To: <4644d56e0908201047w7aba0d97v8138d02c9d7171d0@mail.gmail.com> References: <4644d56e0908201047w7aba0d97v8138d02c9d7171d0@mail.gmail.com> Message-ID: <85DE486D-FE25-4AAA-AD7C-556A92A3ACC5@apple.com> I seem to think that on Tiger, one needed to use pythonw to get GUI access (the regular python is just the plain command line tool, and the window server doesn't allow plain commands to access the GUI). This was changed in Leopard so that either python or pythonw worked. Ed On Aug 20, 2009, at 10:47 AM, beegee beegee wrote: > hi guys i opened my terminal window on a mac os x tiger 10.4.11 > and tried to do the following > > > guruprasad-gopinaths-computer:~/Desktop/pylot guruprasadgopinath$ > python run.py -g > Pylot was unable to start the GUI. Check if wxPython is installed > properly. > guruprasad-gopinaths-computer:~/Desktop/pylot guruprasadgopinath$ > > please suggest what to do > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From Chris.Barker at noaa.gov Sat Aug 22 02:22:34 2009 From: Chris.Barker at noaa.gov (Chris Barker) Date: Fri, 21 Aug 2009 17:22:34 -0700 Subject: [Pythonmac-SIG] check if wxpython has been installed properly In-Reply-To: <85DE486D-FE25-4AAA-AD7C-556A92A3ACC5@apple.com> References: <4644d56e0908201047w7aba0d97v8138d02c9d7171d0@mail.gmail.com> <85DE486D-FE25-4AAA-AD7C-556A92A3ACC5@apple.com> Message-ID: <4A8F3A4A.2090006@noaa.gov> Edward Moy wrote: > I seem to think that on Tiger, one needed to use pythonw to get GUI > access (the regular python is just the plain command line tool, and the > window server doesn't allow plain commands to access the GUI). This was > changed in Leopard so that either python or pythonw worked. > On Aug 20, 2009, at 10:47 AM, beegee beegee wrote: > >> hi guys i opened my terminal window on a mac os x tiger 10.4.11 >> and tried to do the following does pyplot specify what versions of python and wxPython it needs? Anyway, try typing " python then at the python prompt, type: import wx then wx.__version__ and tell us what you get And yes, you might try it with pythonw and see what you get. -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 cmiller at securityevaluators.com Sat Aug 22 05:53:15 2009 From: cmiller at securityevaluators.com (Charles Miller) Date: Fri, 21 Aug 2009 22:53:15 -0500 Subject: [Pythonmac-SIG] Using Finder to open app by id Message-ID: How can you run the following Applescript in py-appscript? I've tried everything I can think of. tell application "Finder" to open application file id "com.apple.Preview" Obviously, I just want to launch Preview from within py-appscript. I really want to do this in py-appscript as opposed to just popen/system or something because I'd like to eventually do it remotely (without ssh) so I can run Preview remotely and operate on the GUI remotely using applescript. Thanks, Charlie From nad at acm.org Sat Aug 22 08:55:08 2009 From: nad at acm.org (Ned Deily) Date: Fri, 21 Aug 2009 23:55:08 -0700 Subject: [Pythonmac-SIG] Using Finder to open app by id References: Message-ID: In article , Charles Miller wrote: > How can you run the following Applescript in py-appscript? I've tried > everything I can think of. > > tell application "Finder" to open application file id > "com.apple.Preview" > > Obviously, I just want to launch Preview from within py-appscript. I > really want to do this in py-appscript as opposed to just popen/system > or something because I'd like to eventually do it remotely (without > ssh) so I can run Preview remotely and operate on the GUI remotely > using applescript. You don't need to involve the Finder: >>> from appscript import * >>> preview = app(id='com.apple.Preview') >>> preview.run() >>> preview.open('/Developer/About Xcode Tools.pdf') http://appscript.sourceforge.net/py-appscript/doc/appscript-manual/07_app licationobjects.html -- Ned Deily, nad at acm.org From cmiller at securityevaluators.com Sat Aug 22 16:39:55 2009 From: cmiller at securityevaluators.com (Charles Miller) Date: Sat, 22 Aug 2009 09:39:55 -0500 Subject: [Pythonmac-SIG] Using Finder to open app by id Message-ID: <3AE7CF31-E00C-447A-B6BF-0ED8A99F88D9@securityevaluators.com> Thanks. You're right of course, and thanks for the response. However, using such a method remotely won't work because you can't send the run command if the application isn't running already. RuntimeError: Can't get terminology for application (aem.Application(url='eppc://user:pass at 192.168.1.3/Preview')): Command failed: Application isn't running. (-600) So I was hoping to figure out how to do that AppleScript line locally, and then try to do it remotely as well. The real AppleScript I wish to run in py-appscript is: set remoteMachine to "eppc://user:pass at 192.168.1.3" set remoteFinder to application "Finder" of machine remoteMachine using terms from application "Finder" tell remoteFinder open application file id "com.apple.Preview" end tell end using terms from But I figured I'd start easier and just try to launch a local app with Finder. Any ideas on how to do the original question (or even better the above) using py-appscript? Thanks a million. Charlie From henry.olders at mcgill.ca Sat Aug 22 18:25:40 2009 From: henry.olders at mcgill.ca (Henry Olders) Date: Sat, 22 Aug 2009 12:25:40 -0400 Subject: [Pythonmac-SIG] Using Finder to open app by id In-Reply-To: <3AE7CF31-E00C-447A-B6BF-0ED8A99F88D9@securityevaluators.com> References: <3AE7CF31-E00C-447A-B6BF-0ED8A99F88D9@securityevaluators.com> Message-ID: On 22-Aug-09, at 10:39 , Charles Miller wrote: > Thanks. You're right of course, and thanks for the response. > However, using such a method remotely won't work because you can't > send the run command if the application isn't running already. > > RuntimeError: Can't get terminology for application > (aem.Application(url='eppc://user:pass at 192.168.1.3/Preview')): Command > failed: Application isn't running. (-600) I'm wondering if the above error occurs because Preview is not AppleScriptable. Henry From cmiller at securityevaluators.com Sat Aug 22 19:35:50 2009 From: cmiller at securityevaluators.com (Charles Miller) Date: Sat, 22 Aug 2009 12:35:50 -0500 Subject: [Pythonmac-SIG] Using Finder to open app by id In-Reply-To: References: <3AE7CF31-E00C-447A-B6BF-0ED8A99F88D9@securityevaluators.com> Message-ID: <872D9344-774F-4EED-BA94-ED565F7E046D@securityevaluators.com> Thanks for the thought. Unfortunately, the same thing happens with TextEdit, for example. (BTW, you can make Preview AppleScriptable by following directions here http://www.macworld.com/article/53391/2006/10/previewscript.html) The AppleScript Language Guide states that one of the four requirements for doing remote applescript is "If the specified remote application is not running, you must run it." Charlie > > > I'm wondering if the above error occurs because Preview is not > AppleScriptable. > > Henry From half.italian at gmail.com Sat Aug 22 20:03:14 2009 From: half.italian at gmail.com (Sean DiZazzo) Date: Sat, 22 Aug 2009 11:03:14 -0700 Subject: [Pythonmac-SIG] Using Finder to open app by id In-Reply-To: <872D9344-774F-4EED-BA94-ED565F7E046D@securityevaluators.com> References: <3AE7CF31-E00C-447A-B6BF-0ED8A99F88D9@securityevaluators.com> <872D9344-774F-4EED-BA94-ED565F7E046D@securityevaluators.com> Message-ID: <7baa94f60908221103v145f7dddpd2a83b79c22c7ed8@mail.gmail.com> Why not just ssh in and run "open /Applications/Preview.app" ? On Sat, Aug 22, 2009 at 10:35 AM, Charles Miller < cmiller at securityevaluators.com> wrote: > Thanks for the thought. Unfortunately, the same thing happens with > TextEdit, for example. (BTW, you can make Preview AppleScriptable by > following directions here > http://www.macworld.com/article/53391/2006/10/previewscript.html) > > The AppleScript Language Guide states that one of the four requirements for > doing remote applescript is "If the specified remote application is not > running, you must run it." > > Charlie > > > >> >> I'm wondering if the above error occurs because Preview is not >> AppleScriptable. >> >> Henry >> > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cmiller at securityevaluators.com Sat Aug 22 20:05:35 2009 From: cmiller at securityevaluators.com (Charles Miller) Date: Sat, 22 Aug 2009 13:05:35 -0500 Subject: [Pythonmac-SIG] Using Finder to open app by id In-Reply-To: <7baa94f60908221103v145f7dddpd2a83b79c22c7ed8@mail.gmail.com> References: <3AE7CF31-E00C-447A-B6BF-0ED8A99F88D9@securityevaluators.com> <872D9344-774F-4EED-BA94-ED565F7E046D@securityevaluators.com> <7baa94f60908221103v145f7dddpd2a83b79c22c7ed8@mail.gmail.com> Message-ID: That is certainly an option, but I'm trying to script everything from Python and so having to popen a call to ssh to login and start preview is pretty heavy compared to sending a simple applescript event. Charlie On Aug 22, 2009, at 1:03 PM, Sean DiZazzo wrote: > Why not just ssh in and run "open /Applications/Preview.app" ? > > On Sat, Aug 22, 2009 at 10:35 AM, Charles Miller > wrote: > Thanks for the thought. Unfortunately, the same thing happens with > TextEdit, for example. (BTW, you can make Preview AppleScriptable > by following directions here http://www.macworld.com/article/53391/2006/10/previewscript.html) > > The AppleScript Language Guide states that one of the four > requirements for doing remote applescript is "If the specified > remote application is not running, you must run it." > > Charlie > > > > > I'm wondering if the above error occurs because Preview is not > AppleScriptable. > > Henry > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From nad at acm.org Sat Aug 22 21:25:33 2009 From: nad at acm.org (Ned Deily) Date: Sat, 22 Aug 2009 12:25:33 -0700 Subject: [Pythonmac-SIG] Using Finder to open app by id References: <3AE7CF31-E00C-447A-B6BF-0ED8A99F88D9@securityevaluators.com> Message-ID: In article <3AE7CF31-E00C-447A-B6BF-0ED8A99F88D9 at securityevaluators.com>, Charles Miller wrote: > So I was hoping to figure out how to do that AppleScript line locally, > and then try to do it remotely as well. The real AppleScript I wish > to run in py-appscript is: > > set remoteMachine to "eppc://user:pass at 192.168.1.3" > set remoteFinder to application "Finder" of machine remoteMachine > using terms from application "Finder" > tell remoteFinder > open application file id "com.apple.Preview" > end tell > end using terms from > > But I figured I'd start easier and just try to launch a local app with > Finder. Any ideas on how to do the original question (or even better > the above) using py-appscript? Thanks a million. After some experimenting, I was able to use a remote Finder to either just launch Preview or open a document and launch Preview. Here's what worked: >>> from appscript import * >>> remote_finder = app(url='eppc://user:pass at hostname/Finder') >>> # launch Preview >>> remote_finder.startup_disk.folders["Applications"].application_files[ 'Preview'].open() >>> # alternatively, open document with default application, >>> # launching if necessary >>> remote_finder.startup_disk.folders['Developer'].files[ 'About Xcode Tools.pdf'].open() I was able to launch by bundle id locally: >>> local_finder = app('Finder') >>> local_finder.startup_disk.folders["Applications"].application_files[ its.id == "com.apple.Preview"].open() but remote references failed with: OSERROR: -1731 MESSAGE: Unknown object type. I'm sure HAS can explain what needs to be done to make such something like that work remotely; perhaps you have to construct lower-level references manually. On the other hand, perhaps you don't really need to use the bundle id if the application name is good enough. -- Ned Deily, nad at acm.org From cmiller at securityevaluators.com Sat Aug 22 22:19:33 2009 From: cmiller at securityevaluators.com (Charles Miller) Date: Sat, 22 Aug 2009 15:19:33 -0500 Subject: [Pythonmac-SIG] Using Finder to open app by id Message-ID: <62FDE3E1-AC9D-4177-9325-463BE3C9655B@securityevaluators.com> Awesome, thanks for the advice. As much as I'd love to see the "by id" solution, doing it by the file system name will work just fine. Thanks again for your help! Charlie From nad at acm.org Sat Aug 22 22:40:28 2009 From: nad at acm.org (Ned Deily) Date: Sat, 22 Aug 2009 13:40:28 -0700 Subject: [Pythonmac-SIG] Using Finder to open app by id References: <3AE7CF31-E00C-447A-B6BF-0ED8A99F88D9@securityevaluators.com> <872D9344-774F-4EED-BA94-ED565F7E046D@securityevaluators.com> <7baa94f60908221103v145f7dddpd2a83b79c22c7ed8@mail.gmail.com> Message-ID: In article , Charles Miller wrote: > On Aug 22, 2009, at 1:03 PM, Sean DiZazzo wrote: >> Why not just ssh in and run "open /Applications/Preview.app" ? > That is certainly an option, but I'm trying to script everything from > Python and so having to popen a call to ssh to login and start preview > is pretty heavy compared to sending a simple applescript event. "simple applescript event" seems to be a bit of an oxymoron, especially in the context of remote events! Personally, I would almost always choose an ssh solution over a remote Apple Event solution. It should be more secure and it generally just works. It is also useful for cases where a GUI isn't necessary; you can ssh in even when the user isn't logged in. But you know that, no doubt. -- Ned Deily, nad at acm.org From hengist.podd at virgin.net Sun Aug 23 10:13:46 2009 From: hengist.podd at virgin.net (has) Date: Sun, 23 Aug 2009 09:13:46 +0100 Subject: [Pythonmac-SIG] Using Finder to open app by id In-Reply-To: References: Message-ID: <108B52D9-7C5F-497A-A984-F4EB2D1266BC@virgin.net> Charles Miller wrote: > How can you run the following Applescript in py-appscript? I've > tried everything I can think of. > > tell application "Finder" to open application file id > "com.apple.Preview" ASTranslate is always your friend... app(u'Finder').application_files.ID(u'com.apple.Preview').open() HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From aahz at pythoncraft.com Mon Aug 24 17:33:32 2009 From: aahz at pythoncraft.com (Aahz) Date: Mon, 24 Aug 2009 08:33:32 -0700 Subject: [Pythonmac-SIG] py2app & multiple executable files with a main launcher In-Reply-To: <4A828E38.3070905@arimaz.com> References: <4A828E38.3070905@arimaz.com> Message-ID: <20090824153332.GA23477@panix.com> On Wed, Aug 12, 2009, Gabriel Rossetti wrote: > > I am trying to bundle an application I wrote usinf py2app. The > application has a launcher "launcher.py" and a Python script "main.py" > that calls the launcher several times in sub-processes with diff args. I > successfully did this with py2exe for windows. I had py2exe generate > "launcher.exe" and "main.exe" and when I run "main.exe" it does what > it's supposed to correctly. I can't get this to work with py2app though. > it won't allow me to generate several executable files. Does anyone know > how to do this or have a better idea? I have to run multiple sub > programmes in parallel but I'd like to only have one entry-point (the > user just needs to click on one file) to run it. I'm not sure what you're trying to do, but it almost certainly is possible. Keep in mind that running programs on a Mac is more similar (overall) to running programs on Unix than Windows. However, an "application" on a Mac is an entirely different beast, and if you want multiple applications you probably need a setup.py for each. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "I support family values -- Addams family values" --www.nancybuttons.com From kw at codebykevin.com Tue Aug 25 04:17:54 2009 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 24 Aug 2009 22:17:54 -0400 Subject: [Pythonmac-SIG] aemreceive/py-appscript and 64-bit Message-ID: <4A9349D2.1070809@codebykevin.com> I've moved my Python work to a four-way universal build of 2.6 .1 (64 & 32 bit for PPC and x86). Do py-appscript and aemreceive work under 64-bit? It's not quite clear to me because they have some dependencies on Carbon, and I'm not sure how Carbon works with a 64-bit build of Python. What I'm actually interested in is using aemreceive to implement a "do script" Apple event for Python, in which a Python app could receive a "do script" command via AppleScript that would execute arbitrary Python code. This functionality is based on the 'dosc' Apple Event constant, and is part of Terminal's AppleScript dictionary (for shell commands); Tk-Aqua also implements similar functionality that allows an app to execute Tcl code. Looking at the aemreceive documentation, it appears all the hooks are there to do this, although this particular Apple Event isn't illustrated in the documentation, nor have I found sample code for this. Any advice is appreciated, and if I'm successful in implementing something like this, I'll post the sample code somewhere. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com From leknarf at pacbell.net Tue Aug 25 06:49:22 2009 From: leknarf at pacbell.net (Scott Frankel) Date: Mon, 24 Aug 2009 21:49:22 -0700 Subject: [Pythonmac-SIG] py2app cannot move to target thread error In-Reply-To: <49EE8EAF-12F4-4C96-9392-AF3895D876B1@pacbell.net> References: <8ACF0495-1315-49E3-AA61-97642257A1ED@pacbell.net> <49EE8EAF-12F4-4C96-9392-AF3895D876B1@pacbell.net> Message-ID: <48A2335B-B7DA-4EAE-8659-5EE80F8919CE@pacbell.net> If someone has any wisdom to share regarding building a PyQt app with SQL support, I'd be grateful. I've deleted and rebuilt my macports environment from scratch and googled myself silly. In a classic snake-eating-tail moment, my online searches are returning my own posts more often than not. My test apps that call for either QPSQL or QSQLITE die, while my test app that does not include PyQt4.QtSql continues to build and run happily. Setting the DYLD_PRINT_LIBRARIES env var, yields the following output on app launch: Qt Version: 4.5.2 PyQt Version: 4.5.4 dyld: loaded: /opt/local/libexec/qt4-mac/plugins/sqldrivers/ libqsqlpsql.bundle dyld: loaded: /opt/local/lib/postgresql83/libpq.5.dylib dyld: loaded: /opt/local/libexec/qt4-mac/lib/QtSql.framework/Versions/ 4/QtSql dyld: loaded: /opt/local/libexec/qt4-mac/lib/QtCore.framework/Versions/ 4/QtCore dyld: loaded: /opt/local/lib/libz.1.dylib dyld: loaded: /opt/local/lib/libssl.0.9.8.dylib dyld: loaded: /opt/local/lib/libcrypto.0.9.8.dylib QObject::moveToThread: Current thread (0x1da760) is not the object's thread (0x1b1b10). Cannot move to target thread (0x1b1b10) On Mac OS X, you might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded. My macports environment looks like this: ... postgresql83 @8.3.1_0 (active) ... py26-altgraph @0.6.7_0 (active) py26-bdist_mpkg @0.4.4_0 (active) py26-macholib @1.2_0 (active) py26-modulegraph-devel @0.7.2_0 (active) py26-py2app-devel @0.4.2_1 (active) py26-pyqt4 @4.5.4_0 (active) py26-setuptools @0.6c9_0 (active) py26-sip @4.8.2_0 (active) ... qt4-mac @4.5.2_1+psql (active) ... Any thoughts or suggestions? Thanks! Scott On Aug 19, 2009, at 10:41 AM, Scott Frankel wrote: > > Hello, > > I'm stuck somewhere between macports and py2app. I'm hopeful that > someone here may be able to offer some advice on how to rectify my > build environment. > > Exporting DYLD_PRINT_LIBRARIES=1 and running a test app built with > QtSql support and another one without it, I'm pretty sure that the > following line is the clue: > > dyld: loaded: /opt/local/libexec/qt4-mac/plugins/sqldrivers/ > libqsqlpsql.bundle > > My question is, how do I access/get/compile the PSQL support my app > requires? My environment's qt4-mac, python26, and py2app are from > macports. The qt4-mac has the psql dependency: > > py26-py2app-devel @0.4.2_1 (active) > py26-pyqt4 @4.5.4_0 (active) > qt4-mac @4.5.1_0+psql (active) > > Thanks in advance! > Scott > > > > > > On Aug 10, 2009, at 8:51 AM, Scott Frankel wrote: > >> >> Hello, >> >> I'm troubleshooting a PyQt-PostgreSQL py2app error: "Cannot move >> to target thread". Note that a test app builds and runs happily. >> The error only comes up when I add PyQt4.QtSql' to py2app's option >> includes. eg: >> >> This works: >> OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4._qt']} >> >> This doesn't: >> OPTIONS = {'argv_emulation': True, 'includes': ['sip', >> 'PyQt4._qt', 'PyQt4.QtSql']} >> >> Researching the error, I've set DYLD_PRINT_LIBRARIES=1 in my shell >> and am looking for duplicate instances of Qt libraries. I'm not >> seeing anything obvious. But I also don't know exactly what to >> look for. >> >> For example, should I be concerned with dyld output running the app >> or building it? >> >> I created my build environment using macports. It looks like the >> correct libs are being accessed. The last of the dyld output looks >> like this: >> >> dyld: loaded: /opt/local/libexec/qt4-mac/plugins/sqldrivers/ >> libqsqlpsql.bundle >> dyld: loaded: /opt/local/lib/postgresql83/libpq.5.dylib >> dyld: loaded: /opt/local/libexec/qt4-mac/lib/QtSql.framework/ >> Versions/4/QtSql >> dyld: loaded: /opt/local/libexec/qt4-mac/lib/QtCore.framework/ >> Versions/4/QtCore >> dyld: loaded: /opt/local/lib/libz.1.dylib >> dyld: loaded: /opt/local/lib/libssl.0.9.8.dylib >> dyld: loaded: /opt/local/lib/libcrypto.0.9.8.dylib >> QObject::moveToThread: Current thread (0x1d17d0) is not the >> object's thread (0x1a7820). >> Cannot move to target thread (0x1a7820) >> >> >> Suggestions? >> >> Thanks in advance! >> Scott >> >> >> >> >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From henry.olders at mcgill.ca Tue Aug 25 19:05:19 2009 From: henry.olders at mcgill.ca (Henry Olders) Date: Tue, 25 Aug 2009 13:05:19 -0400 Subject: [Pythonmac-SIG] aemreceive/py-appscript and 64-bit In-Reply-To: <4A9349D2.1070809@codebykevin.com> References: <4A9349D2.1070809@codebykevin.com> Message-ID: <14D850CE-725F-4608-89CC-0C2414E9E22F@mcgill.ca> On 24-Aug-09, at 22:17 , Kevin Walzer wrote: > I've moved my Python work to a four-way universal build of 2.6 .1 > (64 & > 32 bit for PPC and x86). Do py-appscript and aemreceive work under > 64-bit? It's not quite clear to me because they have some dependencies > on Carbon, and I'm not sure how Carbon works with a 64-bit build of > Python. > > What I'm actually interested in is using aemreceive to implement a "do > script" Apple event for Python, in which a Python app could receive a > "do script" command via AppleScript that would execute arbitrary > Python > code. This functionality is based on the 'dosc' Apple Event constant, > and is part of Terminal's AppleScript dictionary (for shell commands); > Tk-Aqua also implements similar functionality that allows an app to > execute Tcl code. > > Looking at the aemreceive documentation, it appears all the hooks are > there to do this, although this particular Apple Event isn't > illustrated > in the documentation, nor have I found sample code for this. Any > advice > is appreciated, and if I'm successful in implementing something like > this, I'll post the sample code somewhere. It's not clear to me what you want to do. Do you want to have a python program call an Applescript which then executes arbitrary python code? Henry From hengist.podd at virgin.net Tue Aug 25 19:28:19 2009 From: hengist.podd at virgin.net (has) Date: Tue, 25 Aug 2009 18:28:19 +0100 Subject: [Pythonmac-SIG] aemreceive/py-appscript and 64-bit In-Reply-To: References: Message-ID: Kevin Walzer wrote: > I've moved my Python work to a four-way universal build of 2.6 .1 > (64 & 32 bit for PPC and x86). Do py-appscript and aemreceive work > under 64-bit? The aem and appscript modules are 64-bit clean. The osax module will only work on 64-bit if you use static glues instead of fetching terminology dynamically. aemreceive's sfba module is 32-bit only; the rest should work on 64-bit, though hasn't been tested. > Looking at the aemreceive documentation, it appears all the hooks > are there to do this, although this particular Apple Event isn't > illustrated in the documentation, nor have I found sample code for > this. Any advice is appreciated, and if I'm successful in > implementing something like this, I'll post the sample code somewhere. aemreceive should do if you don't need to implement an Apple Event Object Model. Work through the tutorials, and if it's still not clear then ask. If you plan on implementing an AEOM, look into Cocoa Scripting - it's a bit of a clunker (and has been since 10.2), but it's better than nothing. HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From Chris.Barker at noaa.gov Sat Aug 29 00:16:19 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 28 Aug 2009 15:16:19 -0700 Subject: [Pythonmac-SIG] Can I set an environment variable with py2app? Message-ID: <4A985733.9020802@noaa.gov> Hi folks, I was using the Peppy editor, and it's spell checker relies on PyEnchant, which uses ctypes to use the enchant lib. I am using a macports enchant, so I had an environment variable set so that PyEnchant could find it: export PYENCHANT_LIBRARY_PATH=/opt/local/lib/libenchant.dylib This worked just great when I started Peppy from the command line, but when I started it from an application bundle, it failed, which I'm pretty sure is because apps started in bundles don't have the shell's environment variables. I think there is a way to set a "global" environment variable in a plist somewhere, but I think it might be better to set it in the App bundle -- is there a way to do that? For the moment, I've hacked the enchant module to look in the macports location, but I don't know if the maintainer will want to make that a permanent change. If he does, what would be the path to a fink enchant lib? we might as well add that too! -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 morrisbrown94 at gmail.com Sun Aug 30 04:46:38 2009 From: morrisbrown94 at gmail.com (Lawrence Anderson) Date: Sat, 29 Aug 2009 22:46:38 -0400 Subject: [Pythonmac-SIG] Hello. Message-ID: Hi, My name is Lawrence and Im an undergraduate at Indiana State University. I always grew up loving technology and computers so I decided to pursue my degree in Information Technology. Im taking my first Programming class ever. My goals are to own various web successful web businesses and to be a proficient web developer. I just purchased a Macbook Pro for the school year and plan on building a PC for next semester. Im getting the hang of this Mac but it is still fairly new to me. My class is to begin programming in Python, but our teacher doesn't speak very good english so she wasn't able to convey her point very well to the rest of the class. I find that this may be a problem later down the road, so I took the liberty of finding out how to open Python on my Mac. I got to the terminal through the utility folder and I also downloaded Aquamacs Emacs as a code editor. Im a diligent worker so I love to get through obstacles, but Im not afraid to ask questions as they come up. In technology the computer is the one who works alone, not the people. Any starting help would be appreciated. Thank you, Lawrence -------------- next part -------------- An HTML attachment was scrubbed... URL: From nathan.stocks at gmail.com Sun Aug 30 08:26:54 2009 From: nathan.stocks at gmail.com (Nathan) Date: Sun, 30 Aug 2009 00:26:54 -0600 Subject: [Pythonmac-SIG] Hello. In-Reply-To: References: Message-ID: <96c9d6a80908292326r16862785kf36ebe84a7d4312b@mail.gmail.com> On Sat, Aug 29, 2009 at 8:46 PM, Lawrence Anderson wrote: > Hi, > ?? ? ?My name is Lawrence and Im an undergraduate at Indiana State > University. I always grew up loving technology and computers so I decided to > pursue my degree in Information Technology. Im taking my first Programming > class ever. My goals are to own various web successful web businesses and to > be a proficient web developer. I just purchased a Macbook Pro for the school > year and plan on building a PC for next semester. Im getting the hang of > this Mac but it is still fairly new to me. My class is to begin programming > in Python, but our teacher doesn't speak very good english so she wasn't > able to convey her point very well to the rest of the class. I find that > this may be a problem later down the road, so I took the liberty of finding > out how to open Python on my Mac. I got to the terminal through the utility > folder and I also downloaded Aquamacs Emacs as a code editor. Im a diligent > worker so I love to get through obstacles, but Im not afraid to ask > questions as they come up. In technology the computer is the one who works > alone, not the people. Any starting help would be appreciated. > > ? ? ? ?Thank you, > > ? ? ? ? ? ? ? Lawrence Welcome! :-) If you just want a mailing list to discuss python on, I highly suggest subscribing to Python's general mailing list[1] if you haven't already. This list tends to be both low-volume and focused on mac-specific issues for Python -- so unless you're interested in pyobjc, py2app, etc., I would guess you won't get much response from this list. Nevertheless, my suggestion for beginners would be: 1) Go through the emacs tutorial if you haven't already (C-h t). Also, give vim a try -- it's good to know both of the editors that are omnipresent on *nix systems. 2) Go through some python tutorials. Good luck! ~ Nathan [1] http://mail.python.org/mailman/listinfo/python-list From dhubleizh at o2.pl Mon Aug 31 16:10:27 2009 From: dhubleizh at o2.pl (=?ISO-8859-2?Q?Cezary_Krzy=BFanowski?=) Date: Mon, 31 Aug 2009 16:10:27 +0200 Subject: [Pythonmac-SIG] py2app 2009-08-31 dSYM fix patch Message-ID: Hi! The newest greatest and finest py2app from SVN has two bugs for which I'm supplying a patch: * it uses shutils, which it does not import * the dSYM removal function really does delete given files, but the list of files to strip isn't updated, which fails on trying to strip an non-existing file BTW --- I'd love a postscript hook. Czarek -------------- next part -------------- A non-text attachment was scrubbed... Name: py2app-dsymfix.patch Type: application/octet-stream Size: 1488 bytes Desc: not available URL: -------------- next part -------------- From ronaldoussoren at mac.com Mon Aug 31 16:16:47 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Mon, 31 Aug 2009 16:16:47 +0200 Subject: [Pythonmac-SIG] py2app 2009-08-31 dSYM fix patch In-Reply-To: References: Message-ID: <29874089397107207009303439752518881902-Webmail@me.com> On Monday, 31 August, 2009, at 04:10PM, "Cezary Krzy?anowski" wrote: >Hi! > >The newest greatest and finest py2app from SVN has two bugs for which >I'm supplying a patch: > * it uses shutils, which it does not import > * the dSYM removal function really does delete given files, but the >list of files to strip isn't updated, which fails on trying to strip >an non-existing file Thanks for the patch. > >BTW --- I'd love a postscript hook. Why would you like one? If you need functionality that is generally useful we could extend py2app. Ronald From dhubleizh at o2.pl Mon Aug 31 16:23:52 2009 From: dhubleizh at o2.pl (=?ISO-8859-2?Q?Cezary_Krzy=BFanowski?=) Date: Mon, 31 Aug 2009 16:23:52 +0200 Subject: [Pythonmac-SIG] py2app 2009-08-31 dSYM fix patch In-Reply-To: <29874089397107207009303439752518881902-Webmail@me.com> References: <29874089397107207009303439752518881902-Webmail@me.com> Message-ID: <7FAAB127-79FF-4791-8DD7-25B1189E2486@o2.pl> Wiadomo?? napisana w dniu 2009-08-31, o godz. 16:16, przez Ronald Oussoren: > > Why would you like one? If you need functionality that is > generally useful we could extend py2app. > Well --- dSYM files were a pain in PyQt handling. Now that's off, but QtSomething_debug gets copied --- which is one of my pains. The second one is, that when I build a 'full' PyQt binding, i.e. without supplying modules to build, all get build (obviously) but also all get included in the bundle, even with excludes in place. That doesn't happen in py2exe. I've tried poking in the sip recipe, but it seems it isn't used o_O. I'd like to remove all _debug libs as a post filter/action maybe? Czarek From dhubleizh at o2.pl Mon Aug 31 16:52:39 2009 From: dhubleizh at o2.pl (=?ISO-8859-2?Q?Cezary_Krzy=BFanowski?=) Date: Mon, 31 Aug 2009 16:52:39 +0200 Subject: [Pythonmac-SIG] py2app 2009-08-31 dSYM fix patch In-Reply-To: <42622905380397927934717323349134747844-Webmail@me.com> References: <29874089397107207009303439752518881902-Webmail@me.com> <7FAAB127-79FF-4791-8DD7-25B1189E2486@o2.pl> <42622905380397927934717323349134747844-Webmail@me.com> Message-ID: <0F2900F8-D85F-460C-8631-AF8C6820086F@o2.pl> Wiadomo?? napisana w dniu 2009-08-31, o godz. 16:49, przez Ronald Oussoren: > > On Monday, 31 August, 2009, at 04:23PM, "Cezary Krzy?anowski" > wrote: >> >> Wiadomo?? napisana w dniu 2009-08-31, o godz. 16:16, przez Ronald >> Oussoren: >> >>> >>> Why would you like one? If you need functionality that is >>> generally useful we could extend py2app. >>> >> >> Well --- dSYM files were a pain in PyQt handling. Now that's off, but >> QtSomething_debug gets copied --- which is one of my pains. >> >> The second one is, that when I build a 'full' PyQt binding, i.e. >> without supplying modules to build, all get build (obviously) but >> also >> all get included in the bundle, even with excludes in place. That >> doesn't happen in py2exe. >> >> I've tried poking in the sip recipe, but it seems it isn't used o_O. >> I'd like to remove all _debug libs as a post filter/action maybe? > > This sounds like something that should be fixed in a recipe, and > the sip one should be the one that causes the full copy. > > I guess it is time to start working on a functional testsuite for > py2app, that would make it a lot easier to ensure that issues like > this stay fixed once we have fixed them. Well there *is* a sip recipe, but it isn't in the __init__.py of the recipes, thus isn't really used at all. Czarek From dhubleizh at o2.pl Mon Aug 31 17:04:00 2009 From: dhubleizh at o2.pl (=?ISO-8859-2?Q?Cezary_Krzy=BFanowski?=) Date: Mon, 31 Aug 2009 17:04:00 +0200 Subject: [Pythonmac-SIG] py2app 2009-08-31 dSYM fix patch In-Reply-To: <42622905380397927934717323349134747844-Webmail@me.com> References: <29874089397107207009303439752518881902-Webmail@me.com> <7FAAB127-79FF-4791-8DD7-25B1189E2486@o2.pl> <42622905380397927934717323349134747844-Webmail@me.com> Message-ID: <5BA17396-2558-4B25-BB84-7B2C4E224DC2@o2.pl> Wiadomo?? napisana w dniu 2009-08-31, o godz. 16:49, przez Ronald Oussoren: > > On Monday, 31 August, 2009, at 04:23PM, "Cezary Krzy?anowski" > wrote: >> >> Wiadomo?? napisana w dniu 2009-08-31, o godz. 16:16, przez Ronald >> Oussoren: >> >>> >>> Why would you like one? If you need functionality that is >>> generally useful we could extend py2app. >>> >> >> Well --- dSYM files were a pain in PyQt handling. Now that's off, but >> QtSomething_debug gets copied --- which is one of my pains. >> >> The second one is, that when I build a 'full' PyQt binding, i.e. >> without supplying modules to build, all get build (obviously) but >> also >> all get included in the bundle, even with excludes in place. That >> doesn't happen in py2exe. >> >> I've tried poking in the sip recipe, but it seems it isn't used o_O. >> I'd like to remove all _debug libs as a post filter/action maybe? > > This sounds like something that should be fixed in a recipe, and > the sip one should be the one that causes the full copy. Oh --- and I've thought about it, but I've got no idea how to implement it as a filter or recipe. The module name is PyQt4 or PyQt4.QtGui (if specific) when scanning the macholib tree, but the QtSomething_debug only gets added when at the end PythonStandolone is called --- then the resulting files list has the QtSomething_debug files and it's already to late for a filter or anything. Czarek