From airdrummer at wheel.org Sat Mar 1 04:09:59 2008 From: airdrummer at wheel.org (tom wible) Date: Fri, 29 Feb 2008 22:09:59 -0500 Subject: [Pythonmac-SIG] py-appscript problem in crontab In-Reply-To: <697445DA-069D-4F91-BDD6-3AF8B208D220@gmail.com> References: <8A304CBB-57F1-4CE5-AB6D-B3863C56017A@virgin.net> <47C5E8FF.2060502@wheel.org> <47C775CE.1010005@wheel.org> <47C78F58.8080409@noaa.gov> <17D3203A-4F48-4A01-BC48-CA1BC26B0ED8@gmail.com> <47C83F04.2080201@noaa.gov> <697445DA-069D-4F91-BDD6-3AF8B208D220@gmail.com> Message-ID: <47C8C907.7040800@wheel.org> thanx to all who replied...version control is a major issue in all s/w dev... i'm solving my problem w/ #!/usr/local/bin/python btw, i figured out why i wasn't getting any mail from crontab: no output...d'oh!-} but i can't figure out how to get useful info out: >>> print app(u'/Applications/EyeTV.app').window[its.name.beginswith('EyeTV')].close() returns [None] no matter whether there is or isn't an EyeTV window... From hraban at fiee.net Sun Mar 2 14:41:03 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Sun, 2 Mar 2008 14:41:03 +0100 Subject: [Pythonmac-SIG] appscript docs (was: Path conversions) In-Reply-To: References: <1DEC1FE2-78D8-4BBF-ABBC-67474807A158@fiee.net> Message-ID: Am 2008-02-27 um 21:57 schrieb Ned Deily: > The macfile module of py-appscript was renamed to mactypes. So, with > the lastest versions of py-appscript, you'll need to change > macfile.Alias() to mactypes.Alias(). See the doc files included with > the py-appscript source download: appscript.sourceforge.net/>. Thank you for your answer and sorry for my delay. mactypes.Alias and mactypes.File do what I need, as far as I tested. Is there any reason why the appscript docs aren't available online? The Homepage doesn't even mention that there's documentation included somewhere! BTW I found some minor flaws: * copyright notice is still 2004 * 03_quicktutorial.html: It would be nice if it would explain how to set TextEdit's document.text to unicode text - I didn't find a way. Later: AARRGH - it works from the shell (simply using unicode objects), but not from within PyCrust. So there's a dependency from Python's environment - can't tell which exactly. * in 06_classesandenums.html: app('Finder').home.get(type=k.file_url) Traceback (most recent call last): File "", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ python2.4/site-packages/appscript-0.18.1-py2.4-macosx-10.3-fat.egg/ appscript/reference.py", line 391, in __call__ raise TypeError, 'Unknown keyword argument %r.' % name TypeError: Unknown keyword argument 'type'. (I get the Unknown keyword error for every keyword I tried. So it looks like an error on my side, but I've no clue what could be wrong.) * in 14_notes.html: """Dealing with problem applications Appscript provides a number of mechanisms for dealing with problematic applications. See the appscript website for more information.""" See the appscript website?? There's not too much information on anything... Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From nad at acm.org Mon Mar 3 08:19:23 2008 From: nad at acm.org (Ned Deily) Date: Sun, 02 Mar 2008 23:19:23 -0800 Subject: [Pythonmac-SIG] py-appscript problem in crontab References: <8A304CBB-57F1-4CE5-AB6D-B3863C56017A@virgin.net> <47C5E8FF.2060502@wheel.org> <47C775CE.1010005@wheel.org> <47C78F58.8080409@noaa.gov> <17D3203A-4F48-4A01-BC48-CA1BC26B0ED8@gmail.com> <47C83F04.2080201@noaa.gov> <697445DA-069D-4F91-BDD6-3AF8B208D220@gmail.com> <47C8C907.7040800@wheel.org> Message-ID: In article <47C8C907.7040800 at wheel.org>, tom wible wrote: > btw, i figured out why i wasn't getting any mail from crontab: no > output...d'oh!-} but i can't figure out how to get useful info out: > >>> print > app(u'/Applications/EyeTV.app').window[its.name.beginswith('EyeTV')].close() > > returns [None] no matter whether there is or isn't an EyeTV window... It's up to the application to decide what it wants to return. In this case, it appears EyeTV returns nothing in response to a close. One of the joys of dealing with scriptable applications, regardless of the scripting language (py-appscript, Applescript, etc.), is figuring out the application's object model and how its objects respond to various commands. You can use introspection tools like appscript's help() method, ASDictionary.app, or Apple's Script Editor.app to get at an application's script dictionary. But you'll have to experiment a bit to see how the application actually responds in practice. For example, the EyeTV application object has a property "playing": etv = app('EyeTV') if etv.playing(): for window in etv.player_windows(): window.close() Hope that helps. -- Ned Deily, nad at acm.org From hengist.podd at virgin.net Tue Mar 4 02:10:50 2008 From: hengist.podd at virgin.net (has) Date: Tue, 4 Mar 2008 01:10:50 +0000 Subject: [Pythonmac-SIG] appscript docs In-Reply-To: References: Message-ID: <3EE97C3A-46DA-479C-ADA5-AE0DFC1A6FE4@virgin.net> Henning Hraban Ramm wrote: > Is there any reason why the appscript docs aren't available online? The Ruby docs have been up awhile, but the Python and ObjC versions are still to do. As with most OSS projects: lack of time/motivation/ manpower and/or plain laziness - take your pick. > The Homepage doesn't even mention that there's documentation > included somewhere! > > BTW I found some minor flaws: > > * copyright notice is still 2004 Fixed in the 0.19.0 docs. > * 03_quicktutorial.html: > > It would be nice if it would explain how to set TextEdit's > document.text to unicode text - I didn't find a way. > Later: AARRGH - it works from the shell (simply using unicode > objects), but not from within PyCrust. > So there's a dependency from Python's environment - can't tell which > exactly. Doesn't sound like an appscript problem, but I'm not familiar with PyCrust so can't help you there. > * in 06_classesandenums.html: > > app('Finder').home.get(type=k.file_url) > Traceback (most recent call last): > File "", line 1, in ? > File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ > python2.4/site-packages/appscript-0.18.1-py2.4-macosx-10.3-fat.egg/ > appscript/reference.py", line 391, in __call__ > raise TypeError, 'Unknown keyword argument %r.' % name > TypeError: Unknown keyword argument 'type'. Should be 'resulttype', not 'type'. Plus the creaky old Finder doesn't seem to recognise the file_url type, so you have to ask it for an alias or file_ref instead. Fixed now for 0.19.0; thanks. > * in 14_notes.html: > """Dealing with problem applications > > Appscript provides a number of mechanisms for dealing with > problematic applications. See the appscript website for more > information.""" > > See the appscript website?? There's not too much information on > anything... This material is currently sitting unfinished on my HD, and has been for about the last year or so. (Curse your much-too-sharp eyes for finally spotting its absence!) I am hoping to get some website updates done this week (in-between a million other things), so will see if I can get at least some of it up Real Soon Now. HTH, and thanks for the input, has -- http://appscript.sourceforge.net From mattb at wageslavery.org Tue Mar 4 10:51:47 2008 From: mattb at wageslavery.org (Matt Barnicle) Date: Tue, 4 Mar 2008 01:51:47 -0800 (PST) Subject: [Pythonmac-SIG] Any appscript / iTunes experts out there? Message-ID: <56717.67.122.208.128.1204624307.squirrel@webmail.wageslavery.org> Hi everyone. Recent first time mac owner here. Tho long time unix developer... I have been successfully using apple's iTunes windows SDK for a while to do neat stuff with my playlists, and would really like to do the same on my new mac. I spent a few days scouring the net for all information i could on the best way to do this. It looks to me that the way to go is appscript, as I don't want to use apple script (I don't get a very good impression of it so far), and ideally, what I want to do is create a cross platform library in python that can be used to manage either a windows or mac installation of iTunes. I figured out the windows SDK in a short time, but I'm really getting stuck on using appscript to do some of the same tasks... Anyone know how to add artwork to a file?? I can't find that info anywhere, and I've looked what seems to me to be just about everywhere now. If there is a better place to ask this question, I would love a pointer in the right direction also.. The closest thing I could find was this post about apple script: http://forums.ilounge.com/archive/index.php/t-96368.html But I just couldn't seem to understand how to translate that idea into the appscript world. ..appreciation.. - m@ From brinick.simmons at gmail.com Tue Mar 4 09:26:53 2008 From: brinick.simmons at gmail.com (brinick.simmons) Date: Tue, 4 Mar 2008 09:26:53 +0100 Subject: [Pythonmac-SIG] py2app: typo in build_app.py? Message-ID: <97E59CC6-3C84-46F1-9B13-363BD6E26F04@gmail.com> Hello, I'm using py2app for my project and have come across what appears to my newbie eyes to be a typo in version 0.3.6, but also in the trunk: http://svn.pythonmac.org/py2app/py2app/trunk/py2app/build_app.py In initialize_plist I found: if not os.path.exists(iconfile): raise DistutilsOptionError("icon file must exist: %r" % (self.icon,)) where it would seem that self.icon is inexistant. When I modified my local installation from self.icon to iconfile then things worked OK (i.e. the script correctly complained about my missing icon file rather than collapsing in a heap). Regards, Brinick. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080304/63d88b18/attachment.htm From ronaldoussoren at mac.com Tue Mar 4 12:26:00 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 4 Mar 2008 12:26:00 +0100 Subject: [Pythonmac-SIG] py2app: typo in build_app.py? In-Reply-To: <97E59CC6-3C84-46F1-9B13-363BD6E26F04@gmail.com> References: <97E59CC6-3C84-46F1-9B13-363BD6E26F04@gmail.com> Message-ID: <65DEB1BD-8CB7-4E9A-9924-70DFA0007237@mac.com> Thanks for the bugreport. I've fixed this on the trunk (in revision 70). Ronald On 4 Mar, 2008, at 9:26, brinick.simmons wrote: > Hello, > > I'm using py2app for my project and have come across what appears to > my newbie eyes > to be a typo in version 0.3.6, but also in the trunk: > > http://svn.pythonmac.org/py2app/py2app/trunk/py2app/build_app.py > > In initialize_plist I found: > > if not os.path.exists(iconfile): > raise DistutilsOptionError("icon file must exist: %r" > % (self.icon,)) > > where it would seem that self.icon is inexistant. When I modified > my local installation from self.icon to iconfile then things worked OK > (i.e. the script correctly complained about my missing icon file > rather than > collapsing in a heap). > > Regards, > Brinick. > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080304/e40db1ca/attachment.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20080304/e40db1ca/attachment.bin From hraban at fiee.net Tue Mar 4 20:04:52 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Tue, 4 Mar 2008 20:04:52 +0100 Subject: [Pythonmac-SIG] appscript docs In-Reply-To: <3EE97C3A-46DA-479C-ADA5-AE0DFC1A6FE4@virgin.net> References: <3EE97C3A-46DA-479C-ADA5-AE0DFC1A6FE4@virgin.net> Message-ID: <33D920A6-243F-4331-A34D-19202F9CE9FD@fiee.net> Am 2008-03-04 um 02:10 schrieb has: >> Is there any reason why the appscript docs aren't available online? > The Ruby docs have been up awhile, but the Python and ObjC versions > are still to do. As with most OSS projects: lack of time/motivation/ > manpower and/or plain laziness - take your pick. I wonder if I should publish them at my site, together with dictionaries of some applications... (But I can't promise to always update to the latest version.) >> It would be nice if it would explain how to set TextEdit's >> document.text to unicode text - I didn't find a way. >> Later: AARRGH - it works from the shell (simply using unicode >> objects), but not from within PyCrust. >> So there's a dependency from Python's environment - can't tell which >> exactly. > Doesn't sound like an appscript problem, but I'm not familiar with > PyCrust so can't help you there. Of course. I guess the problem's with wxPython's keyboard input. >> * in 06_classesandenums.html: >> >> app('Finder').home.get(type=k.file_url) >> Traceback (most recent call last): >> File "", line 1, in ? >> File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ >> python2.4/site-packages/appscript-0.18.1-py2.4-macosx-10.3-fat.egg/ >> appscript/reference.py", line 391, in __call__ >> raise TypeError, 'Unknown keyword argument %r.' % name >> TypeError: Unknown keyword argument 'type'. > > Should be 'resulttype', not 'type'. Plus the creaky old Finder doesn't > seem to recognise the file_url type, so you have to ask it for an > alias or file_ref instead. Fixed now for 0.19.0; thanks. thanks >> See the appscript website?? There's not too much information on >> anything... > > This material is currently sitting unfinished on my HD, and > has been for about the last year or so. (Curse your much-too-sharp > eyes for finally spotting its absence!) I'm a typesetter - sharp eyes are my professional illness ;-) > I am hoping to get some > website updates done this week (in-between a million other things), so > will see if I can get at least some of it up Real Soon Now. No hurry - I get no time for programming for the next few weeks anyway... Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From MattPat at mattpat.net Tue Mar 4 19:32:22 2008 From: MattPat at mattpat.net (Matt Patenaude) Date: Tue, 4 Mar 2008 13:32:22 -0500 Subject: [Pythonmac-SIG] Any appscript / iTunes experts out there? Message-ID: <79C7C521-C532-4B71-AFFD-D908237B8C09@mattpat.net> > Anyone know how to add artwork to a file?? I just did something like this myself a few days ago. :) A quick snippet from my script: iTunes = app('iTunes') artworksForTrack = iTunes.current_track.artworks.get() artwork = artworksForTrack[0].get() dataString = artwork.data.get().data # Assume fname is your file name f = open(fname, 'wb') # When we write, we chop off the first 221 bytes to get rid of the pict header f.write(dataString[222:]) f.close() Hope it helps! Matt Patenaude, Developer for OS X and the Web Blog: mattpat.net Portfolio: mattpatenaude.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080304/b7145006/attachment.htm From MattPat at mattpat.net Tue Mar 4 21:38:21 2008 From: MattPat at mattpat.net (Matt Patenaude) Date: Tue, 4 Mar 2008 15:38:21 -0500 Subject: [Pythonmac-SIG] Any appscript / iTunes experts out there? References: <79C7C521-C532-4B71-AFFD-D908237B8C09@mattpat.net> Message-ID: <01A9F42F-A45C-4A6A-8A66-568196B838E8@mattpat.net> > Anyone know how to add artwork to a file?? I just did something like this myself a few days ago. :) A quick snippet from my script: iTunes = app('iTunes') artworksForTrack = iTunes.current_track.artworks.get() artwork = artworksForTrack[0].get() dataString = artwork.data.get().data # Assume fname is your file name f = open(fname, 'wb') # When we write, we chop off the first 221 bytes to get rid of the pict header f.write(dataString[222:]) f.close() Hope it helps! Matt Patenaude, Developer for OS X and the Web Blog: mattpat.net Portfolio: mattpatenaude.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080304/5d14f1e0/attachment.htm From mattb at wageslavery.org Wed Mar 5 03:08:28 2008 From: mattb at wageslavery.org (Matt Barnicle) Date: Tue, 4 Mar 2008 18:08:28 -0800 (PST) Subject: [Pythonmac-SIG] Any appscript / iTunes experts out there? In-Reply-To: <79C7C521-C532-4B71-AFFD-D908237B8C09@mattpat.net> References: <79C7C521-C532-4B71-AFFD-D908237B8C09@mattpat.net> Message-ID: <3953.75.62.2.37.1204682908.squirrel@webmail.wageslavery.org> >> Anyone know how to add artwork to a file?? > > > I just did something like this myself a few days ago. :) A quick > snippet from my script: > > iTunes = app('iTunes') > artworksForTrack = iTunes.current_track.artworks.get() > artwork = artworksForTrack[0].get() > dataString = artwork.data.get().data > # Assume fname is your file name > f = open(fname, 'wb') > # When we write, we chop off the first 221 bytes to get rid of the > pict header > f.write(dataString[222:]) > f.close() > > Hope it helps! > > > Matt Patenaude, Developer for OS X and the Web > Blog: mattpat.net > Portfolio: mattpatenaude.com Hi Matt. Yes, that certainly helps, thank you. Although, what I'm trying to do is add artwork to a track, not retrieve it and write it to a file as your example is doing. But this will also come in handy one day for sure.. - m@ From lukas.polivka at gmail.com Wed Mar 5 09:00:35 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Wed, 5 Mar 2008 09:00:35 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist Message-ID: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> Hello! I'm trying to build an app bundle of Jabbim client [1] for Mac OS X using py2app & setuptools. I have followed py2app docs [2]. When I build an 'alias' (see Development with alias mode) mode app, I can run it. On the other hand, if I build for deployment (without -A flag), I get the following error/traceback: Traceback (most recent call last): File "/var/folders/Eg/Egf28uy-E94kLa7x5eHVp++++TI/-Tmp-/tmprMzA41.py", line 229, in direct=1) File "/Library/Python/2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/util.py", line 204, in byte_compile if force or newer(mod.filename, cfile): File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dep_util.py", line 22, in newer raise DistutilsFileError, "file '%s' does not exist" % source distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist Traceback (most recent call last): File "/Library/Python/2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/build_app.py", line 548, in _run self.run_normal() File "/Library/Python/2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/build_app.py", line 619, in run_normal self.create_binaries(py_files, pkgdirs, extensions, loader_files) File "/Library/Python/2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/build_app.py", line 683, in create_binaries dry_run=self.dry_run) File "/Library/Python/2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/util.py", line 176, in byte_compile spawn(cmd, verbose=verbose, dry_run=dry_run) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/spawn.py", line 37, in spawn _spawn_posix(cmd, search_path, dry_run=dry_run) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/spawn.py", line 167, in _spawn_posix (cmd[0], exit_status) DistutilsExecError: command '/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python' failed with exit status 1 > /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/spawn.py(167)_spawn_posix() I don't exactly know how Python Eggs work ? I have only checked that setuptools-0.6c8-py2.5.egg exists ? only it is a file, whereas e.g. py2app-0.3.6-py2.5.egg in the same location is a directory/folder. Any idea why setuptools-0.6c8-py2.5.egg/pkg_resources.pyc does not 'exist'? When I open Python interpreter, import pkg_resources works OK. When running the app or building an alias bundle, I have to export PYTHON_PATH and use --use-pythonpath flag, after that, it works. When building a deployment bundle, it does not work. Thanks you very much for any suggestion you can provide, even relevant links to documentation I might have missed. Feel free to ask any questions or request my setup.py if needed. Luk?? 'Spike' Pol?vka [1] http://dev.jabbim.cz/jabbim/wiki/en/index [2] http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.htm -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From pje at telecommunity.com Wed Mar 5 14:28:26 2008 From: pje at telecommunity.com (Phillip J. Eby) Date: Wed, 05 Mar 2008 08:28:26 -0500 Subject: [Pythonmac-SIG] [Distutils] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resou rces.pyc' does not exist In-Reply-To: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.co m> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> Message-ID: <20080305132809.01D123A4097@sparrow.telecommunity.com> At 09:00 AM 3/5/2008 +0100, Luk??? 'Spike' Pol??vka wrote: >Traceback (most recent call last): File >"/Library/Python/2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/build_app.py", >line 548, in _run self.run_normal() File >"/Library/Python/2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/build_app.py", >line 619, in run_normal self.create_binaries(py_files, pkgdirs, >extensions, loader_files) File >"/Library/Python/2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/build_app.py", >line 683, in create_binaries dry_run=self.dry_run) File >"/Library/Python/2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/util.py", >line 176, in byte_compile spawn(cmd, verbose=verbose, >dry_run=dry_run) File >"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/spawn.py", >line 37, in spawn _spawn_posix(cmd, search_path, >dry_run=dry_run) File >"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/spawn.py", >line 167, in _spawn_posix (cmd[0], exit_status) >DistutilsExecError: command >'/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python' >failed with exit status 1 > >/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/spawn.py(167)_spawn_posix() > This error appears to indicate that py2app is having trouble creating a .pyc or .pyo file, due to not being able to run "/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python". From lukas.polivka at gmail.com Wed Mar 5 16:22:01 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Wed, 5 Mar 2008 16:22:01 +0100 Subject: [Pythonmac-SIG] [Distutils] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resou rces.pyc' does not exist In-Reply-To: <20080305132809.01D123A4097@sparrow.telecommunity.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <20080305132809.01D123A4097@sparrow.telecommunity.com> Message-ID: <76a8b5470803050722h123a2a4ex7cc063bc17549e37@mail.gmail.com> On Wed, Mar 5, 2008 at 2:28 PM, Phillip J. Eby wrote: > This error appears to indicate that py2app is having trouble creating > a .pyc or .pyo file, due to not being able to run > "/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python". > > It seems to start the interpreter without problem: $ /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> Any further suggestions? I'm running Mac OS X 10.5.2. I think I had MacPython (or ActivePython?) 2.5 installed on 10.4.10, before I upgraded to Leopard. I then deleted the non-bundled version by hand. Thanks, Luk?? 'Spike' Pol?vka -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From Chris.Barker at noaa.gov Wed Mar 5 18:27:18 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 05 Mar 2008 09:27:18 -0800 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> Message-ID: <47CED7F6.2020103@noaa.gov> Luk?? 'Spike' Pol?vka wrote: > When running the app or building an alias bundle, I have to export > PYTHON_PATH and use --use-pythonpath flag, after that, it works. When > building a deployment bundle, it does not work. This MAY be a hint. When py2app does its thing, it moves all the modules it thinks you need into the app bundle. What that means is that the path to them all is different than when you run it outside the bundle. I've found that any funny business with PYTHON_PATH or sys.path can cause problems with py2app. In Alias mode, it's possible that the bundled app can still find stuff that wasn't included in the bundle, since it's pointing to the original source anyway. What's worked for me in the past is to make sure that sys.path matches what you need when setup.py is being run -- so you need to make sure whatever you do to get it right in your app is also done in setup.py. That may not have anything to do with your issue -- I'm confused as to why a module in setuptools is needed at this stage. However, I don't think py2app supports using eggs completely anyway, so maybe you've got something installed as an egg that you could install the old-fashioned way instead. -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 Thu Mar 6 06:34:35 2008 From: nathan.stocks at gmail.com (Nathan) Date: Wed, 5 Mar 2008 22:34:35 -0700 Subject: [Pythonmac-SIG] Bug: Apps built with py2app on Leopard will default to import system-default libraries Message-ID: <96c9d6a80803052134v544e707es717930160038db49@mail.gmail.com> After much discussion on the pyglet and twisted mailing lists, I've isolated a bug in py2app's handling of sys.path on Leopard. Scenario: A custom installation of a python package is installed in /Library/Python/2.5/site-packages or elsewhere. The environment is set to use that package first, either by default (in the case of the former) or by some other means that both the script to be py2app'd and py2app understand. Behaviour: py2app pulls in the custom library into the .app into site-packages.zip or (in the case of -p some.package) into Resources/lib/python2.5/some/package, but when the resulting .app is executed, those locations occur in sys.path after all the customary system locations, so the system installed versions are used first. Example: I've installed Twisted 2.5 and Zope 3.something into /Library/Python/2.5/site-packages (the default location when you run 'python setup.py install'). py2app correctly identified the need for twisted and included it in site-packages.zip. py2app did not correctly identify the need for the custom Zope install, so I added it via the command line (python setup.py py2app -p zope). Because of the nature of the bug, I was able to work around it by manually inserting the relative path to the custom versions that py2app placed inside the app: import sys sys.path.insert(0,'../Resources/lib/python2.5/site-packages.zip') # Now twisted 2.5 is found instead of the system's twisted 2.4 sys.path.insert(0,'../Resources/lib/python2.5/') # Now the custom zope install is found instead of the system's zope. ~ Nathan From ronaldoussoren at mac.com Thu Mar 6 07:51:55 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 6 Mar 2008 07:51:55 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <47CED7F6.2020103@noaa.gov> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> Message-ID: <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> On 5 Mar, 2008, at 18:27, Christopher Barker wrote: > Luk?? 'Spike' Pol?vka wrote: >> When running the app or building an alias bundle, I have to export >> PYTHON_PATH and use --use-pythonpath flag, after that, it works. When >> building a deployment bundle, it does not work. > > This MAY be a hint. When py2app does its thing, it moves all the > modules > it thinks you need into the app bundle. What that means is that the > path > to them all is different than when you run it outside the bundle. I've > found that any funny business with PYTHON_PATH or sys.path can cause > problems with py2app. Jabbim uses PyQT and PyQT support in py2app isn't well tested at the moment, you might run into a limitation of that support. Your usage of the --use-pythonpath option is a clear indication that py2app doesn't copy everything that the application needs into application bundle. Which version of py2app do you use? IIRC support for pyqt is only the the subversion repository of py2app, not in an actual release. Can you run Jabbin without using py2app, that is by starting it from the command line? Do you have to set any special environment variables to do that? > > That may not have anything to do with your issue -- I'm confused as to > why a module in setuptools is needed at this stage. However, I don't > think py2app supports using eggs completely anyway, so maybe you've > got > something installed as an egg that you could install the old-fashioned > way instead. Py2app does indeed not fully support setuptools at the moment, it doesn't treat eggs as first-class citizens which breaks code that relies on setuptools features. Fixing that should be easy enough, but I don't know when I'll get around doing it. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20080306/b01718be/attachment.bin From lukas.polivka at gmail.com Thu Mar 6 08:59:05 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Thu, 6 Mar 2008 08:59:05 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> Message-ID: <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> On Thu, Mar 6, 2008 at 7:51 AM, Ronald Oussoren wrote: > > On 5 Mar, 2008, at 18:27, Christopher Barker wrote: > > > Luk?? 'Spike' Pol?vka wrote: > >> When running the app or building an alias bundle, I have to export > >> PYTHON_PATH and use --use-pythonpath flag, after that, it works. When > >> building a deployment bundle, it does not work. > > > > This MAY be a hint. When py2app does its thing, it moves all the > > modules > > it thinks you need into the app bundle. What that means is that the > > path > > to them all is different than when you run it outside the bundle. I've > > found that any funny business with PYTHON_PATH or sys.path can cause > > problems with py2app. > > Jabbim uses PyQT and PyQT support in py2app isn't well tested at the > moment, you might run into a limitation of that support. Your usage of > the --use-pythonpath option is a clear indication that py2app doesn't > copy everything that the application needs into application bundle. > > Which version of py2app do you use? IIRC support for pyqt is only the > the subversion repository of py2app, not in an actual release. > > Can you run Jabbin without using py2app, that is by starting it from > the command line? Do you have to set any special environment variables > to do that? > > > > > That may not have anything to do with your issue -- I'm confused as to > > why a module in setuptools is needed at this stage. However, I don't > > think py2app supports using eggs completely anyway, so maybe you've > > got > > something installed as an egg that you could install the old-fashioned > > way instead. > > Py2app does indeed not fully support setuptools at the moment, it > doesn't treat eggs as first-class citizens which breaks code that > relies on setuptools features. Fixing that should be easy enough, but > I don't know when I'll get around doing it. > > Ronald > > I think we are on the right track with PYTHONPATH. I have to export PYTHONPATH=/Library/Python/2.5/site-packages:/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages - even when running Jabbim without py2app (or as aliased bundle). The first path is for Twisted, the second one is for PyQt4 (SIP?). Don't ask me why it's not installed in "better" locations, where PYTHONPATH is not needed? I think I have installed it according to docs. I guess I did not read documentation thoroughly. I assumed that if I use --use-pythonpath option, py2app would somehow take care of "everything". Using py2app-0.3.6-py2.5.egg. I have also documented some of my steps here http://dev.jabbim.cz/jabbim/wiki/en/MacOSXSupport Thank you for your time, Luk?? 'Spike' Pol?vka -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From ronaldoussoren at mac.com Thu Mar 6 10:05:15 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 6 Mar 2008 10:05:15 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> Message-ID: <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> On 6 Mar, 2008, at 8:59, Luk?? 'Spike' Pol?vka wrote: >> > > I think we are on the right track with PYTHONPATH. > > I have to export > PYTHONPATH=/Library/Python/2.5/site-packages:/System/Library/ > Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages > - even when running Jabbim without py2app (or as aliased bundle). > The first path is for Twisted, the second one is for PyQt4 (SIP?). > Don't ask me why it's not installed in "better" locations, where > PYTHONPATH is not needed? I think I have installed it according to > docs. What OS are you running, and which python executable do you use ("which python" in a terminal window)? If you're using /usr/bin/python on OSX 10.5 the interpreter should use these directories automaticly. A Python.org installation won't. > > > I guess I did not read documentation thoroughly. I assumed that if I > use --use-pythonpath option, py2app would somehow take care of > "everything". --use-pythonpath lets the generated application bundle use the value of PYTHONPATH. If you need that your application bundle is not self- contained, which is the whole point of py2app. > > > Using py2app-0.3.6-py2.5.egg. Could you try again using the current development version of py2app ("easy_install py2app==dev" should do the trick)? Py2app 0.3.6 doesn't have explicit support for PyQt, which is needed because the generic dependency scanner cannot detect all dependencies of PyQt applications (because PyQt does some imports in C code, and the dependency scanner cannot "see" those). Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20080306/02cb61fb/attachment.bin From nathan.stocks at gmail.com Thu Mar 6 17:51:34 2008 From: nathan.stocks at gmail.com (Nathan) Date: Thu, 6 Mar 2008 09:51:34 -0700 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> Message-ID: <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> On Thu, Mar 6, 2008 at 2:05 AM, Ronald Oussoren wrote: > > On 6 Mar, 2008, at 8:59, Luk?? 'Spike' Pol?vka wrote: > >> > > > > I think we are on the right track with PYTHONPATH. > > > > I have to export > > PYTHONPATH=/Library/Python/2.5/site-packages:/System/Library/ > > Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages > > - even when running Jabbim without py2app (or as aliased bundle). > > The first path is for Twisted, the second one is for PyQt4 (SIP?). > > Don't ask me why it's not installed in "better" locations, where > > PYTHONPATH is not needed? I think I have installed it according to > > docs. > > What OS are you running, and which python executable do you use > ("which python" in a terminal window)? If you're using /usr/bin/python > on OSX 10.5 the interpreter should use these directories automaticly. > A Python.org installation won't. > > > > > > > > I guess I did not read documentation thoroughly. I assumed that if I > > use --use-pythonpath option, py2app would somehow take care of > > "everything". > > --use-pythonpath lets the generated application bundle use the value > of PYTHONPATH. If you need that your application bundle is not self- > contained, which is the whole point of py2app. > > > > > > > > Using py2app-0.3.6-py2.5.egg. > > Could you try again using the current development version of py2app > ("easy_install py2app==dev" should do the trick)? Py2app 0.3.6 doesn't > have explicit support for PyQt, which is needed because the generic > dependency scanner cannot detect all dependencies of PyQt applications > (because PyQt does some imports in C code, and the dependency scanner > cannot "see" those). (Replying again, this time doing reply-ALL) I think you ran into the same issue that I experienced: http://mail.python.org/pipermail/pythonmac-sig/2008-March/019791.html The same workaround may work for you. ~ Nathan From lukas.polivka at gmail.com Fri Mar 7 09:18:37 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Fri, 7 Mar 2008 09:18:37 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> Message-ID: <76a8b5470803070018i652eaa48qc5777b5e5d341cec@mail.gmail.com> On Thu, Mar 6, 2008 at 10:05 AM, Ronald Oussoren wrote: > > On 6 Mar, 2008, at 8:59, Luk?? 'Spike' Pol?vka wrote: > >> > > > > I think we are on the right track with PYTHONPATH. > > > > I have to export > > PYTHONPATH=/Library/Python/2.5/site-packages:/System/Library/ > > Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages > > - even when running Jabbim without py2app (or as aliased bundle). > > The first path is for Twisted, the second one is for PyQt4 (SIP?). > > Don't ask me why it's not installed in "better" locations, where > > PYTHONPATH is not needed? I think I have installed it according to > > docs. > > What OS are you running, and which python executable do you use > ("which python" in a terminal window)? If you're using /usr/bin/python > on OSX 10.5 the interpreter should use these directories automaticly. > A Python.org installation won't. Yes, I'm running Leopard. sumichan:/ spike411$ which python /usr/bin/python sumichan:/ spike411$ ls -la /usr/bin/python lrwxr-xr-x 1 root wheel 72 Nov 3 20:59 /usr/bin/python -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python > > I guess I did not read documentation thoroughly. I assumed that if I > > use --use-pythonpath option, py2app would somehow take care of > > "everything". > > --use-pythonpath lets the generated application bundle use the value > of PYTHONPATH. If you need that your application bundle is not self- > contained, which is the whole point of py2app. > > > > > > > > Using py2app-0.3.6-py2.5.egg. > > Could you try again using the current development version of py2app > ("easy_install py2app==dev" should do the trick)? Py2app 0.3.6 doesn't > have explicit support for PyQt, which is needed because the generic > dependency scanner cannot detect all dependencies of PyQt applications > (because PyQt does some imports in C code, and the dependency scanner > cannot "see" those). > > Ronald Seems like dev version of py2app got me somewhere. I export my PYTHONPATH (and I don't pass --use-pythonpath to setup.py), the app is built/packaged (it has around 40 megs). But when I run it (from Finder), I get: ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' not found Is it the problem Nathan described? Thank you! Luk?? -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From ronaldoussoren at mac.com Fri Mar 7 09:44:54 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Fri, 07 Mar 2008 00:44:54 -0800 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <76a8b5470803070018i652eaa48qc5777b5e5d341cec@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <76a8b5470803070018i652eaa48qc5777b5e5d341cec@mail.gmail.com> Message-ID: <1A392477-0118-1000-E3F4-8A817BCC47D8-Webmail-10020@mac.com> On Friday, March 07, 2008, at 09:18AM, "Luk?? 'Spike' Pol?vka" wrote: > >Seems like dev version of py2app got me somewhere. I export my >PYTHONPATH (and I don't pass --use-pythonpath to setup.py), the app is >built/packaged (it has around 40 megs). > >But when I run it (from Finder), I get: >ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' >not found > >Is it the problem Nathan described? I don't know, I haven't looked into his problem yet. What I do know is that the version of py2app that ships with Leopard does not support PyQt. PyQt requires explicit support in py2app because some of the module dependencies are hidden in C code, where the depencency scanner of py2app cannot get at them. Ronald From lukas.polivka at gmail.com Fri Mar 7 14:22:06 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Fri, 7 Mar 2008 14:22:06 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> Message-ID: <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> On Thu, Mar 6, 2008 at 5:51 PM, Nathan wrote: > I think you ran into the same issue that I experienced: > > http://mail.python.org/pipermail/pythonmac-sig/2008-March/019791.html > > The same workaround may work for you. > > ~ Nathan > Where exactly did you put those sys.path.insert statements? site.py? Thanks, Luk?? -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From BrunosJunk at Bronosky.com Fri Mar 7 19:26:53 2008 From: BrunosJunk at Bronosky.com (Richard Bronosky) Date: Fri, 7 Mar 2008 13:26:53 -0500 Subject: [Pythonmac-SIG] bluetooth on a mac? Message-ID: I'd like to be able to do this: http://dev.zuckschwerdt.org/openobex/wiki/ObexFtpExampleClientPython But before I go through the process of trying to get OpenOBEX on a Mac, which seems totally undocumented. I'd like to know if anyone has any experience to contribute. -- .!# RichardBronosky #!. From vivacarlie at gmail.com Fri Mar 7 20:31:53 2008 From: vivacarlie at gmail.com (Nehemiah Dacres) Date: Fri, 7 Mar 2008 13:31:53 -0600 Subject: [Pythonmac-SIG] bluetooth on a mac? In-Reply-To: References: Message-ID: <65fadfc30803071131ydcc0ba7hcec51e20fbc318e3@mail.gmail.com> try lightblue , * http://lightblue.sourceforge.net/doc/index.html* On Fri, Mar 7, 2008 at 12:26 PM, Richard Bronosky wrote: > I'd like to be able to do this: > http://dev.zuckschwerdt.org/openobex/wiki/ObexFtpExampleClientPython > > But before I go through the process of trying to get OpenOBEX on a > Mac, which seems totally undocumented. I'd like to know if anyone has > any experience to contribute. > > -- > .!# RichardBronosky #!. > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- "lalalalala! it's not broken because I can use it" http://linux.slashdot.org/comments.pl?sid=194281&threshold=1&commentsort=0&mode=thread&cid=15927703 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080307/05ef8dc7/attachment.htm From lukas.polivka at gmail.com Sat Mar 8 06:03:11 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Sat, 8 Mar 2008 06:03:11 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> Message-ID: <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> On Fri, Mar 7, 2008 at 5:23 PM, Nathan wrote: > On Fri, Mar 7, 2008 at 6:22 AM, Luk?? 'Spike' Pol?vka > > wrote: > > > On Thu, Mar 6, 2008 at 5:51 PM, Nathan wrote: > > > I think you ran into the same issue that I experienced: > > > > > > http://mail.python.org/pipermail/pythonmac-sig/2008-March/019791.html > > > > > > The same workaround may work for you. > > > > > > ~ Nathan > > > > > > > Where exactly did you put those sys.path.insert statements? site.py? > > > > Thanks, > > Luk?? > > Put it at the very top of your main script. The script that you're > turning into an app. It makes it so that when you double-click on the > .app and your script gets called from within the app, the first thing > your script does is alter the paths that it searches to import stuff > so that instead of having the in-app modules as lowest priority (last > in the search path), they're highest priority (first in the search > path). > > If it makes any difference, I was using the latest py2app installed > with the ez_setup script instructions from the installation section of > py2app's online docs. > > ~ Nathan > No luck, for some reason. What path do you suggest I should put there, if QtCore.so is placed in Jabbim.app/Contents/Resources/lib/python2.5/lib-dynload/PyQt4/? This is error log from Console: ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' not found PyQt4 is not installed. Traceback (most recent call last): File "/Users/spike411/jabbim-ng/dist/Jabbim.app/Contents/Resources/__boot__.py", line 137, in _run('jabbim.py') File "/Users/spike411/jabbim-ng/dist/Jabbim.app/Contents/Resources/__boot__.py", line 134, in _run execfile(path, globals(), globals()) File "/Users/spike411/jabbim-ng/dist/Jabbim.app/Contents/Resources/jabbim.py", line 32, in import qt4reactor File "qt4reactor.pyo", line 25, in File "PyQt4/QtCore.pyo", line 18, in File "PyQt4/QtCore.pyo", line 15, in __load ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' not found Luk?? -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From nathan.stocks at gmail.com Sun Mar 9 02:48:19 2008 From: nathan.stocks at gmail.com (Nathan) Date: Sat, 8 Mar 2008 18:48:19 -0700 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> Message-ID: <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> On Fri, Mar 7, 2008 at 10:03 PM, Luk?? 'Spike' Pol?vka wrote: > No luck, for some reason. What path do you suggest I should put there, > if QtCore.so is placed in > Jabbim.app/Contents/Resources/lib/python2.5/lib-dynload/PyQt4/? > > This is error log from Console: > > ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' > not found Hmm. My missing stuff was pure python packages. I don't know if shared libraries are treated the same or not. If that were a python package, I would do sys.path.insert(0,'../Resources/lib/python2.5/lib-dynload/') ~ Nathan From luis.cota at avmltd.com Sun Mar 9 17:48:32 2008 From: luis.cota at avmltd.com (newbie73) Date: Sun, 9 Mar 2008 09:48:32 -0700 (PDT) Subject: [Pythonmac-SIG] problems with sys.path Message-ID: <15943321.post@talk.nabble.com> Just installed Leopard (10.5) and have been configuring my python setup. First I installed python 2.5.2 from python.org and then began building the libraries I need to use (numpy/scipy, etc). After reading through the forums, I ran across the following fixes: placing a .pth file in /Library/Python/2.5/site-packages with code to insert my custom paths (including /library/python/2.5/site-packages) in the PYTHONPATH variable, yet they do not seem to appear. I have also placed environment.plist in ~/.MacOSX with a PYTHONPATH key which looks like this: DISPLAY :0.0 PYTHONPATH /Library/Python/2.5/site-packages: This also does not work. I'm a bit confused on what to do now to get my paths to appear in PYTHONPATH - anybody have any suggestions? -- View this message in context: http://www.nabble.com/problems-with-sys.path-tp15943321p15943321.html Sent from the Python - pythonmac-sig mailing list archive at Nabble.com. From lou_boog2000 at yahoo.com Sun Mar 9 18:43:30 2008 From: lou_boog2000 at yahoo.com (Lou Pecora) Date: Sun, 9 Mar 2008 10:43:30 -0700 (PDT) Subject: [Pythonmac-SIG] problems with sys.path In-Reply-To: <15943321.post@talk.nabble.com> Message-ID: <371843.65498.qm@web34401.mail.mud.yahoo.com> Have you set the path in your profile (e.g. .bash_profile or .login) to the python 2.5.2 installation? Do the correct numpy, scipy, etc. get loaded when you import them? If so, then the system is looking in the right site-packages directory. It should be seeing your .pth file, but I could not say why that fails. On the other hand, if the packages are not importing (you are getting import errors), then you need to set the path to Python 2.5.2, first in your profile file which loads when you start a new Terminal session/login. In your profile there should be a line like this one added to PATH: PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/:/usr/local/bin/:${PATH}" You need to point to the current version (the /Library/... path) and you need to point to /usr/local/bin before /bin which is why they are pre-pended to PATH in the above. I hope that helps. --- newbie73 wrote: > > Just installed Leopard (10.5) and have been > configuring my python setup. > First I installed python 2.5.2 from python.org and > then began building the > libraries I need to use (numpy/scipy, etc). > > After reading through the forums, I ran across the > following fixes: > > placing a .pth file in > /Library/Python/2.5/site-packages with code to > insert > my custom paths (including > /library/python/2.5/site-packages) in the > PYTHONPATH variable, yet they do not seem to appear. > I have also placed > environment.plist in ~/.MacOSX with a PYTHONPATH key > which looks like this: > > > 1.0//EN" > "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> > > > DISPLAY > :0.0 > PYTHONPATH > /Library/Python/2.5/site-packages: > > > > > This also does not work. I'm a bit confused on what > to do now to get my > paths to appear in PYTHONPATH - anybody have any > suggestions? -- Lou Pecora, my views are my own. ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping From Chris.Barker at noaa.gov Mon Mar 10 17:03:14 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Mon, 10 Mar 2008 09:03:14 -0700 Subject: [Pythonmac-SIG] problems with sys.path In-Reply-To: <15943321.post@talk.nabble.com> References: <15943321.post@talk.nabble.com> Message-ID: <47D55BC2.7030800@noaa.gov> newbie73 wrote: > placing a .pth file in /Library/Python/2.5/site-packages with code to insert > my custom paths (including /library/python/2.5/site-packages) in the > PYTHONPATH variable, yet they do not seem to appear. Just to be clear -- this won't add anything to the PYTHONPATH environment variable. Rather, it adds them to sys.path, which is python's internal path for looking for modules: > import sys > print sys.path -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 thephotoman at gmail.com Tue Mar 11 08:39:22 2008 From: thephotoman at gmail.com (Jim McCormick) Date: Tue, 11 Mar 2008 07:39:22 +0000 (UTC) Subject: [Pythonmac-SIG] Learning PyObjC/PyCocoa in XCode 3 Message-ID: I'm a somewhat seasoned Python coder, but my experience has been entirely on the command line. I'd like to start writing some programs with a GUI for the Mac, but all of the utilities I've seen regarding PyObjC and PyCocoa revolve around the XCode 2.x branch. I'm currently using Leopard, with the beta of XCode 3.1 that was recently made available. Can anyone point me to a resource that can help me get a handle on using Apple's development tools with Python that I don't have to spend three hours translating to my version of the toolchain? From hengist.podd at virgin.net Thu Mar 13 01:47:26 2008 From: hengist.podd at virgin.net (has) Date: Thu, 13 Mar 2008 00:47:26 +0000 Subject: [Pythonmac-SIG] suggestions for an appscript FAQ Message-ID: Hi all, As part of the current upgrade of the appscript website, I'm putting together a list of topics for an appscript FAQ, and wondering if anyone has any requests or suggestions for topics it should cover? Both Python/Ruby/ObjC-specific and general topic ideas are welcome. Here's what I've got so far; feel free to suggest changes to this list as well: -------------------------------------------------------------- APPSCRIPT FAQ 1a. What is appscript? 1b. What is AppleScript? 1c. What is a scriptable application? 1d. How does application scripting work? 1e. What are Apple events? 1f. What is an OSA language? 2a. What can appscript do? 2b. What can't appscript do? 2c. Can I use appscript to write Mail rules/folder actions/iCal alarms/ etc.? 3a. Is appscript object-oriented? 3b. But appscript code looks object-oriented, just like regular Python/ Ruby/ObjC code. What's the difference? 3c. Why doesn't the following code - e.g. app('TextEdit').documents[1].text - return the value (e.g. text) that I expected? 3d. What's with all the 'get()'s and 'set()'s? 3e. But AppleScript doesn't require 'get', nor does regular Python/ Ruby/ObjC code. Couldn't appscript just get values automatically? 3f. And why can't I just use '=' to set values, just like regular Python/Ruby code? 4a. Is appscript better than AppleScript? 4b. Is appscript better than Scripting Bridge? 4c. Is appscript available for [your-favourite-language-here]? 4d. What are appscript's future plans? -------------------------------------------------------------- Thanks, has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From broz at engineeringart.net Thu Mar 13 13:56:17 2008 From: broz at engineeringart.net (Richard Brosnahan) Date: Thu, 13 Mar 2008 08:56:17 -0400 Subject: [Pythonmac-SIG] suggestions for an appscript FAQ In-Reply-To: Message-ID: some time around 3.13.2008 7:00 AM, someone named (has) thru pythonmac-sig-request at python.org carefully typed these words: > > 1. suggestions for an appscript FAQ (has) I would love to see notes about using appscript with Xcode. In particular, writing full blow applications using appscript instead of scripting bridge. -- Richard Brosnahan Editor in Chief Broz News http://broznews.org Everything comes to he who hustles while he waits. Thomas Edison, inventor From alan.curtis at gmail.com Fri Mar 14 16:45:28 2008 From: alan.curtis at gmail.com (Alan Curtis) Date: Fri, 14 Mar 2008 11:45:28 -0400 Subject: [Pythonmac-SIG] pynomo Message-ID: I would like to play with the pynomo package. I have installed the prerequisites using macports and the pynomo package using python setup.py install but get an error when I try to run the examples. $ python example_1.py Traceback (most recent call last): File "example_1.py", line 16, in from pynomo import * File "/Library/Python/2.5/site-packages/pynomo/nomograph.py", line 16, in from nomo_axis import * File "/Library/Python/2.5/site-packages/pynomo/nomo_axis.py", line 20, in from pyx import * ImportError: No module named pyx I suspect that this is caused by some path related mismatch between the Leopard and macports pythons but don't know enough about python to fix it. Is there a simple fix? From ronaldoussoren at mac.com Fri Mar 14 17:11:04 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Fri, 14 Mar 2008 09:11:04 -0700 Subject: [Pythonmac-SIG] pynomo In-Reply-To: References: Message-ID: On Friday, March 14, 2008, at 04:46PM, "Alan Curtis" wrote: >I would like to play with the pynomo package. > >I have installed the prerequisites using macports and the pynomo >package using python setup.py install but get an error when I try to >run the examples. > >$ python example_1.py >Traceback (most recent call last): > File "example_1.py", line 16, in > from pynomo import * > File "/Library/Python/2.5/site-packages/pynomo/nomograph.py", line >16, in > from nomo_axis import * > File "/Library/Python/2.5/site-packages/pynomo/nomo_axis.py", line >20, in > from pyx import * >ImportError: No module named pyx > >I suspect that this is caused by some path related mismatch between >the Leopard and macports pythons but don't know enough about python to >fix it. > >Is there a simple fix? You're using the wrong python to install and use nomo. Either use /opt/local/bin/python instead of just python, or add the macports directory to the start of your shell's search path, like so: PATH="/opt/local/bin:${PATH}" Ronald From hraban at fiee.net Fri Mar 14 21:06:57 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Fri, 14 Mar 2008 21:06:57 +0100 Subject: [Pythonmac-SIG] suggestions for an appscript FAQ In-Reply-To: References: Message-ID: <057C4561-302C-4EE7-85E4-EBA53CD5DBD4@fiee.net> Am 2008-03-13 um 01:47 schrieb has: > As part of the current upgrade of the appscript website, I'm putting > together a list of topics for an appscript FAQ, and wondering if > anyone has any requests or suggestions for topics it should cover? > Both Python/Ruby/ObjC-specific and general topic ideas are welcome. Hi Hengist, sorry for the delay, I was busy. My reply to your personal mail was rejected as spam, twice. Feel free to use my snippets as examples or for the FAQ. I struggled a lot with paths containing non-ASCII characters. Here's my solution: --- #!/usr/bin/env python # -*- coding: utf-8 -*- """ How to handle unicode paths """ import sys import unicodedata import appscript import mactypes myfile = sys.argv[1] # e.g. myfile = u'/Users/user/Documents/d?j? vu/r?ckw?rts.txt' # OSX paths are encoded in *decomposed* UTF-8 # we need normalized, composed Unicode: myfile = unicodedata.normalize('NFD', myfile) # then we can make a working Alias myfile = mactypes.Alias(myfile) finder = appscript.app('Finder') finder.items[myfile].get() # any Finder actions --- Perhaps you could do the normalization in mactypes? --- #!/usr/bin/env python # -*- coding: utf-8 -*- """ Getting and setting Finder labels """ import unicodedata import appscript import mactypes # can we generalize that? label_colors = [u'', u'orange', u'red', u'yellow', u'blue', u'rose', u'green', u'gray'] def ComposedAlias(path): return mactypes.Alias(unicodedata.normalize('NFD', path)) def get_label(path): "returns the name of the Finder label of a file/folder" finder = appscript.app('Finder') datei = finder.items[ComposedAlias(path)] idx = datei.label_index() # is sometimes 16393 for some tries, then suddenly right - why? return label_colors[idx] def set_label(path, label): "set the Finder label of a file/folder as name or number" finder = app('Finder') macItem = finder.items[ComposedAlias(path)] if label in label_colors: label = label_colors.index(label) else: label = int(label) return macItem.label_index.set(label) Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From hraban at fiee.net Fri Mar 14 22:20:21 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Fri, 14 Mar 2008 22:20:21 +0100 Subject: [Pythonmac-SIG] suggestions for an appscript FAQ In-Reply-To: <057C4561-302C-4EE7-85E4-EBA53CD5DBD4@fiee.net> References: <057C4561-302C-4EE7-85E4-EBA53CD5DBD4@fiee.net> Message-ID: <29CF4551-C0C6-44E8-97C9-C2A809BB5107@fiee.net> Am 2008-03-14 um 21:06 schrieb Henning Hraban Ramm: > myfile = sys.argv[1] must be: myfile = unicode(sys.argv[1], 'utf-8') Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From hraban at fiee.net Sat Mar 15 00:00:38 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Sat, 15 Mar 2008 00:00:38 +0100 Subject: [Pythonmac-SIG] suggestions for an appscript FAQ In-Reply-To: References: Message-ID: <2B23FF1B-67EB-4E60-B978-F69E0EF1F641@fiee.net> Perhaps more FAQs: << 1 >> Why does this work: document = InDesign.make(new=k.document) document.save(to=ComposedFile(path)) but not this: document = InDesign.make(new=k.document).save(to=ComposedFile(path)) << 2 >> Why is Finder.copy not (yet) implemented? Will it soon? << 3 >> Is there a generic and simple way of checking the "type" of an item (e.g. Finder item, InDesign page_item)? E.g. I need to check if a Finder item is a folder or if a ID page_item is a text or a graphics frame. type(item) is always Answer for InDesign: item.class_() << references >> Finder = appscript.app('Finder') InDesign = appscript.app('Adobe InDesign CS2') def ComposedFile(path): return mactypes.File(unicodedata.normalize('NFD', os.path.abspath (path))) Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From hengist.podd at virgin.net Sat Mar 15 12:41:28 2008 From: hengist.podd at virgin.net (has) Date: Sat, 15 Mar 2008 11:41:28 +0000 Subject: [Pythonmac-SIG] suggestions for an appscript FAQ In-Reply-To: References: Message-ID: <75C64D40-E5A9-415D-9DE8-9D9A257C9AEC@virgin.net> Richard Brosnahan wrote: >> 1. suggestions for an appscript FAQ (has) > > I would love to see notes about using appscript with Xcode. In > particular, > writing full blow applications using appscript instead of scripting > bridge. Could you clarify? Using appscript (or SB) in Xcode is no different to using it in any other editor. Perhaps you're confusing them with the Python-Cocoa bridge, PyObjC? Thanks, has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From hengist.podd at virgin.net Sat Mar 15 21:37:03 2008 From: hengist.podd at virgin.net (has) Date: Sat, 15 Mar 2008 20:37:03 +0000 Subject: [Pythonmac-SIG] Unicode path problems (was: Re: suggestions for an appscript FAQ) In-Reply-To: References: Message-ID: Henning Hraban Ramm wrote: > I struggled a lot with paths containing non-ASCII characters. Hmmm. Is this with the 0.18.1 release? Do you get the same problem with the current appscript trunk? Ta, has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From hengist.podd at virgin.net Sat Mar 15 22:13:07 2008 From: hengist.podd at virgin.net (has) Date: Sat, 15 Mar 2008 21:13:07 +0000 Subject: [Pythonmac-SIG] suggestions for an appscript FAQ In-Reply-To: References: Message-ID: <4DC6D463-5068-4D07-9AB8-38B69FEC2283@virgin.net> Henning Hraban Ramm wrote: > Perhaps more FAQs: > > << 1 >> > Why does this work: > document = InDesign.make(new=k.document) > document.save(to=ComposedFile(path)) > > but not this: > document = InDesign.make(new=k.document).save(to=ComposedFile(path)) Seems to work on CS3. What are you expecting it to do vs. what is it actually doing? > << 2 >> > Why is Finder.copy not (yet) implemented? Will it soon? Application-specific problems are outside the scope of appscript's FAQ, but I'm going to add a "I'm having trouble scripting . What do I do now?" topic (suggested on rb-appscript-discuss) pointing users to appropriate forums (AppleScript-users, etc.) as a general cover-all. > << 3 >> > Is there a generic and simple way of checking the "type" of an item > (e.g. Finder item, InDesign page_item)? > E.g. I need to check if a Finder item is a folder or if a ID > page_item is a text or a graphics frame. > > type(item) is always > Answer for InDesign: item.class_() Definitely needs disambiguation. Added to the list, thanks. has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From luis.cota at avmltd.com Sat Mar 15 22:59:36 2008 From: luis.cota at avmltd.com (newbie73) Date: Sat, 15 Mar 2008 14:59:36 -0700 (PDT) Subject: [Pythonmac-SIG] Custom Installation with Distutils Message-ID: <16072873.post@talk.nabble.com> a week ago I was having some problems setting up my PATH variables, though now I seem to have the environment under control. I'd like to specify the location for all installed libraries - python.org mentions the use of .pydistutils.cfg. I placed this in ~/.pydistutils.cfg: install-base=$HOME/Code/python install-purelib=lib install-platlib=lib.$PLAT install-scripts=scripts install-data=data When I attempted to install setuptools with this configuration, the following error was thrown: error: install-base or install-platbase supplied, but installation scheme is incomplete Looks like the header location could have been missing, though I'm not really sure what else it could have been. Is there some other way to specify installation location that won't get lost when using SUDO? Thanks, - Luis -- View this message in context: http://www.nabble.com/Custom-Installation-with-Distutils-tp16072873p16072873.html Sent from the Python - pythonmac-sig mailing list archive at Nabble.com. From hraban at fiee.net Sat Mar 15 23:33:49 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Sat, 15 Mar 2008 23:33:49 +0100 Subject: [Pythonmac-SIG] Unicode path problems (was: Re: suggestions for an appscript FAQ) In-Reply-To: References: Message-ID: <1E1C1BCD-9C2D-469C-893E-F9596AB87E93@fiee.net> Am 2008-03-15 um 21:37 schrieb has: > Henning Hraban Ramm wrote: >> I struggled a lot with paths containing non-ASCII characters. > Hmmm. Is this with the 0.18.1 release? Do you get the same problem > with the current appscript trunk? Sorry - since yesterday it works (with 0.18.1). Some problems with appscript seem to appear or disappear unreproducable. :-( E.g. I had big problems with Finder labels - often got "16393" as label_index for some tries, until finally the right number showed up. Can't reproduce that any more, without changing my installation. As I posted before, it was a bit hard to find out where to apply which unicode conversion to file paths. (And before you advised me about mactypes I tried to convert Unix to Mac paths myself, which didn't always work.) This way works for me, hopefully it will last: myfile = mactypes.Alias(os.path.abspath(unicodedata.normalize('NFD', unicode(sys.argv[1], 'utf-8')))) Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From hraban at fiee.net Sun Mar 16 00:04:52 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Sun, 16 Mar 2008 00:04:52 +0100 Subject: [Pythonmac-SIG] suggestions for an appscript FAQ In-Reply-To: <4DC6D463-5068-4D07-9AB8-38B69FEC2283@virgin.net> References: <4DC6D463-5068-4D07-9AB8-38B69FEC2283@virgin.net> Message-ID: <90383E22-42B8-42D8-B70E-07689A63402D@fiee.net> Am 2008-03-15 um 22:13 schrieb has: >> << 1 >> >> Why does this work: >> document = InDesign.make(new=k.document) >> document.save(to=ComposedFile(path)) >> >> but not this: >> document = InDesign.make(new=k.document).save(to=ComposedFile(path)) > > Seems to work on CS3. What are you expecting it to do vs. what is it > actually doing? If I chained it, it just wouldn't save. Again: can't reproduce the error. I guess my path wasn't perfectly converted until today or something like that. (Or could it depend on TerminologyServer running? Will check that tomorrow.) Sorry for the noise. >> << 2 >> >> Why is Finder.copy not (yet) implemented? Will it soon? > > Application-specific problems are outside the scope of appscript's > FAQ, but I'm going to add a "I'm having trouble scripting app>. What do I do now?" topic (suggested on rb-appscript-discuss) > pointing users to appropriate forums (AppleScript-users, etc.) as a > general cover-all. Ok, perhaps you could answer generally, why some items are "NOT AVAILABLE (YET)". Or did I overlook that somewhere? I think the worst problem with appscript is the "strange behaviour" id you're used to either linear or object oriented or really asynchronous code - appscript looks like linear & object oriented, but is "a bit" asynchronous (but not like twisted's Deferreds) and instead of "real" objects you get those dynamic references. Additionally every application behaves differently and you've to find out what works how (or not) - or how they call something internally what you know with some (translated) name from GUI and manual... Of course that's not your fault, and it's great that we can use appscript at all! I tend to blame the docs while I'm struggling to wrap my mind around some strange library (needed a while for twisted or wxPython, too). But some more docs seldom hurt. - I guess my path stuff is really a FAQ, but found nowhere a working example. I'll provide some examples as soon as I manage to get them running. (Just trying to write a wrapper class for InDesign documents, although limited to those functions that I need.) Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From hengist.podd at virgin.net Tue Mar 18 20:13:20 2008 From: hengist.podd at virgin.net (has) Date: Tue, 18 Mar 2008 19:13:20 +0000 Subject: [Pythonmac-SIG] Unicode path problems (was: Re: suggestions for an appscript FAQ) In-Reply-To: References: Message-ID: <5B50DC2F-78A2-4C9E-9E64-8601DF35BF2B@virgin.net> Henning Hraban Ramm wrote: >> I struggled a lot with paths containing non-ASCII characters. >> Hmmm. Is this with the 0.18.1 release? Do you get the same problem >> with the current appscript trunk? > > Sorry - since yesterday it works (with 0.18.1). > Some problems with appscript seem to appear or disappear > unreproducable. :-( > > E.g. I had big problems with Finder labels - often got "16393" as > label_index for some tries, until finally the right number showed > up. Can't reproduce that any more, without changing my installation. Sounds very odd. Doubt the problem is coming from appscript itself, unless its installation has gotten screwed up. You might check that any older versions have been completely removed, doing a thorough cleanout and fresh reinstall if needed. Also, where a problem is encountered, try running the equivalent AppleScript to see if the problem occurs there as well. > As I posted before, it was a bit hard to find out where to apply > which unicode conversion to file paths. (And before you advised me > about mactypes I tried to convert Unix to Mac paths myself, which > didn't always work.) > > This way works for me, hopefully it will last: > > myfile = mactypes.Alias(os.path.abspath(unicodedata.normalize('NFD', > unicode(sys.argv[1], 'utf-8')))) I'll need to look into normalisation issues when I've time, although I would've assumed the filesystem APIs would apply any necessary normalisation at their end. >>> << 1 >> >>> Why does this work: >>> document = InDesign.make(new=k.document) >>> document.save(to=ComposedFile(path)) >>> >>> but not this: >>> document = >>> InDesign.make(new=k.document).save(to=ComposedFile(path)) >> >> Seems to work on CS3. What are you expecting it to do vs. what is it >> actually doing? > > If I chained it, it just wouldn't save. > Again: can't reproduce the error. The two above examples create and save the document in exactly the same way. Python+appscript isn't like AppleScript, where the interpreter inserts magic behaviours between lines. Could be something else in your setup is acting up, resulting in hard-to-trace errors cropping up elsewhere. > I guess my path wasn't perfectly converted until today or something > like that. > (Or could it depend on TerminologyServer running? Will check that > tomorrow.) TerminologyServer is long, long gone. If you've still got a copy kicking around then you definitely need to do some cleaning-up. :) >>> << 2 >> >>> Why is Finder.copy not (yet) implemented? Will it soon? >> >> Application-specific problems are outside the scope of appscript's >> FAQ, but I'm going to add a "I'm having trouble scripting > app>. What do I do now?" topic (suggested on rb-appscript-discuss) >> pointing users to appropriate forums (AppleScript-users, etc.) as a >> general cover-all. > > Ok, perhaps you could answer generally, why some items are "NOT > AVAILABLE (YET)". > Or did I overlook that somewhere? Who can explain what goes on in application developers' heads? These commands were supported in Finder on OS 9, but weren't re-implemented when it was ported over to OS X. For whatever reason, the Finder developers left the dictionary definitions in instead of doing the obvious and sensible thing which would be to hide or remove them. One of the few consistencies in scriptable applications, particularly Carbon ones, is that they are inconsistent. > I think the worst problem with appscript is the "strange behaviour" > id you're used to either linear or object oriented or really > asynchronous code - appscript looks like linear & object oriented, > but is "a bit" asynchronous (but not like twisted's Deferreds) and > instead of "real" objects you get those dynamic references. The OO-like syntax can be misleading for newcomers, but dressing up query-driven APIs in OO-ish syntax for conciseness and readability isn't unique to appscript; e.g. SQLObject. The key to 'getting' appscript is realising that Mac application scripting is based on RPC +queries, and what that implies. The problem is a communication one: either folks aren't reading the appscript documentation, or they aren't understanding it. I know that some folk fall into the first trap (they look at existing code samples, and assume that since it looks like OOP, which they already know, it must behave like it as well), and I've no doubt that others fall into the second (since my writing is less than stellar). Any suggestions on how to address either of these problems will be very welcome. > Additionally every application behaves differently and you've to > find out what works how (or not) - or how they call something > internally what you know with some (translated) name from GUI and > manual... Lousy API documentation is a chronic problem amongst scriptable applications. File feature requests with application developers asking for improved documentation. The more users raise this issue, the likelier it is that developers will address it. Cheers, has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From hraban at fiee.net Wed Mar 19 22:46:43 2008 From: hraban at fiee.net (Henning Hraban Ramm) Date: Wed, 19 Mar 2008 22:46:43 +0100 Subject: [Pythonmac-SIG] Unicode path problems (was: Re: suggestions for an appscript FAQ) In-Reply-To: <5B50DC2F-78A2-4C9E-9E64-8601DF35BF2B@virgin.net> References: <5B50DC2F-78A2-4C9E-9E64-8601DF35BF2B@virgin.net> Message-ID: Am 2008-03-18 um 20:13 schrieb has: >> E.g. I had big problems with Finder labels - often got "16393" as >> label_index for some tries, until finally the right number showed >> up. Can't reproduce that any more, without changing my installation. > > Sounds very odd. Doubt the problem is coming from appscript itself, > unless its installation has gotten screwed up. You might check that > any older versions have been completely removed, doing a thorough > cleanout and fresh reinstall if needed. Also, where a problem is > encountered, try running the equivalent AppleScript to see if the > problem occurs there as well. I guess it has to do with my own buggy path conversion - or perhaps it's a problem with a SMB mounted volume. If the file/folder is visible in Finder, it works better. Can't trace it at the moment - working long shifts every day to get my most urgent magazine projects to the printer. >> As I posted before, it was a bit hard to find out where to apply >> which unicode conversion to file paths. (And before you advised me >> about mactypes I tried to convert Unix to Mac paths myself, which >> didn't always work.) >> >> This way works for me, hopefully it will last: >> >> myfile = mactypes.Alias(os.path.abspath(unicodedata.normalize('NFD', >> unicode(sys.argv[1], 'utf-8')))) > > I'll need to look into normalisation issues when I've time, although I > would've assumed the filesystem APIs would apply any necessary > normalisation at their end. Unfortunately it doesn't. Or at least not reliable. And it's hopeless to try to teach your colleagues and customers to use only ASCII file names - some still use slashes in file names and leave out extensions because it worked in OS9 (one customer still works on OS7, I guess...) >> (Or could it depend on TerminologyServer running? Will check that >> tomorrow.) > TerminologyServer is long, long gone. If you've still got a copy > kicking around then you definitely need to do some cleaning-up. :) Ok, thanks, deleted it. The other old stuff was cleaned out before, but there was no replacement for TS, so I left it... As I mentioned: since I got the path stuff right, everything works (as soon as I figure out how some strange applescript reference property works). Now I must catch up on my Python OOP skills - I started with 2.2 and didn't embrace a lot of new syntax since 2.3. Also I must check whether there are appscript shortcuts to some code I tinkered. Otherwise I'd be ashamed to provide my code as an appscript example. >> Ok, perhaps you could answer generally, why some items are "NOT >> AVAILABLE (YET)". >> Or did I overlook that somewhere? > Who can explain what goes on in application developers' heads? These > commands were supported in Finder on OS 9, but weren't re-implemented > when it was ported over to OS X. For whatever reason, the Finder > developers left the dictionary definitions in instead of doing the > obvious and sensible thing which would be to hide or remove them. One > of the few consistencies in scriptable applications, particularly > Carbon ones, is that they are inconsistent. Ah, sorry, didn't realize that it comes from the AS dictionary itself, I thought those were some items you couldn't wrap for Python. >> I think the worst problem with appscript is the "strange behaviour" >> id you're used to either linear or object oriented or really >> asynchronous code - appscript looks like linear & object oriented, >> but is "a bit" asynchronous (but not like twisted's Deferreds) and >> instead of "real" objects you get those dynamic references. > > The OO-like syntax can be misleading for newcomers, but dressing up > query-driven APIs in OO-ish syntax for conciseness and readability > isn't unique to appscript; e.g. SQLObject. The key to 'getting' > appscript is realising that Mac application scripting is based on RPC > +queries, and what that implies. > > The problem is a communication one: either folks aren't reading the > appscript documentation, or they aren't understanding it. I know that > some folk fall into the first trap (they look at existing code > samples, and assume that since it looks like OOP, which they already > know, it must behave like it as well), and I've no doubt that others > fall into the second (since my writing is less than stellar). > > Any suggestions on how to address either of these problems will be > very welcome. Don't know. You do explain that behaviour. But I did understand only after some experimenting what you mean. (Being no native speaker doesn't help ;-) On one hand it would be nice to get examples how to write really asynchronous code with appscript (e.g. with PyDispatcher or Twisted), on the other hand you normally need the seemingly linear behaviour of appscript - I doubt if it would work to send several events to an application in an asychronous way - perhaps to different apps, but then you would better use subprocessing... Oh, another FAQ: Does appscript cache queries? (i.e. is it "expensive" to call something.someproperty() several times, so that I should remember that value in a variable?) (Maybe you explain that somewhere already, but I can't find it.) >> Additionally every application behaves differently and you've to >> find out what works how (or not) - or how they call something >> internally what you know with some (translated) name from GUI and >> manual... > Lousy API documentation is a chronic problem amongst scriptable > applications. File feature requests with application developers asking > for improved documentation. The more users raise this issue, the > likelier it is that developers will address it. Of course. I learned that Adobe's developer docs are full of errors (e.g. the documentation of InDesign tags is missing important information and lists a lot of tags that just don't exist "in real life"). Unicode (or other encoding) handling of InDesign and Acrobat is horrible. etc. I tried to hunt down experts at Adobe shows to get some questions answered (e.g. about Acrobat JavaScript or hybrid colors in InDesign) - I got a lot of plainly wrong answers. But for I don't use the latest versions I see no chance to make any impact with bug reports or feature requests. If I see how known experts (like Swiss PDF guru Stephan Jaeggi), who regularly work with Adobe staff, can't manage to get simplest bugs fixed (e.g. translation errors), or if something gets fixed in version n.2, it appears again and worse in (n+1).0, so I don't bother trying. And Adobe is not the worst by far... (Open Source rules - I guess I should switch to Scribus; but there's no replacement for Acrobat Pro, and when I tried Scribus last time, it and its file format weren't print production quality...) Whined enough for today. ;-) Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) From ptmkenny at gmail.com Fri Mar 21 00:29:30 2008 From: ptmkenny at gmail.com (Patrick Kenny) Date: Fri, 21 Mar 2008 08:29:30 +0900 Subject: [Pythonmac-SIG] =?utf-8?q?QT=EF=BC=93_and_py2app_problem?= Message-ID: <270df8470803201629j45c87d4dwa1fd8d799ca33b06@mail.gmail.com> Greetings, I am trying to build the application Mnemosyne (www.mnemosyne-proj.org) using py2app on 10.5.2. With the command python setup.py py2app, the application compiles, but when I try to run it I receive the following error: 08/03/16 23:49:08 mnemosyne[1574] mnemosyne Error An unexpected error has occurred during execution of the main script ImportError: Failure linking new module: /Users/patrick/Desktop/mnemosyn e-1.0.1/dist/mnemosyne.app/Contents/Resources/lib/python2.4/lib-dynload/qt.so: Library not loaded: libqt.3.dylib Referenced from: /Users/patrick/Desktop/mnemosyne-1.0.1 /dist/mnemosyne.app/Contents/Resources/lib/python2.4/lib-dynload/qt.so Reason: image not found I tried to include the QT library myself, using the -f /Developer/qt/lib/libqt.3.dylib flag, and I got this error: copying build/bdist.macosx-10.3-fat/python2.4-standalone/app/site- packages.zip -> /Users/patrick/Desktop/mnemosyne-1.0.1 /dist/mnemosyne.app/Contents/Resources/lib/python2.4 copying /Library/Frameworks/Python.framework/Versions/2.4/Python -> /Users/patrick/Desktop/mnemosyne-1.0.1 /dist/mnemosyne.app/Contents/Frameworks/Python.framework/Versions/2.4 copying /Library/Frameworks/Python.framework/Versions/2.4/Resources/Info.plist -> /Users/patrick/Desktop/mnemosyne-1.0.1 /dist/mnemosyne.app/Contents/Frameworks/Python.framework/Versions/2.4/Resources copying /Library/Frameworks/Python.framework/Versions/2.4/Resources/version.plist -> /Users/patrick/Desktop/mnemosyne-1.0.1 /dist/mnemosyne.app/Contents/Frameworks/Python.framework/Versions/2.4/Resources copying /Developer/qt/lib/libqt.3.dylib -> /Users/patrick/Desktop/mnemosyne- 1.0.1/dist/mnemosyne.app/Contents/Frameworks Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app- 0.3.6-py2.4.egg/py2app/build_app.py", line 548, in _run self.run_normal() File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app- 0.3.6-py2.4.egg/py2app/build_app.py", line 619, in run_normal self.create_binaries(py_files, pkgdirs, extensions, loader_files) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app- 0.3.6-py2.4.egg/py2app/build_app.py", line 731, in create_binaries mm.mm.run_file(fmwk) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachOGraph.py", line 66, in run_file File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachOStandalone.py", line 23, in createNode File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/altgraph- 0.6.7-py2.4.egg/altgraph/ObjectGraph.py", line 148, in createNode File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py", line 61, in __init__ File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py", line 76, in load File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py", line 106, in load_header File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py", line 146, in __init__ File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py", line 178, in load ValueError: Unknown load command: 30 > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py(178)load() How can I include the qt3 library so that the app can read it? Thanks in advance. Regards, --Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080321/88127d10/attachment.htm From ptmkenny at gmail.com Mon Mar 17 01:38:25 2008 From: ptmkenny at gmail.com (Patrick Kenny) Date: Mon, 17 Mar 2008 09:38:25 +0900 Subject: [Pythonmac-SIG] problem with QT3 and py2app Message-ID: <270df8470803161738v2eb39fdcm378ad4ef48bb3cbe@mail.gmail.com> Greetings, I am trying to build the application Mnemosyne (www.mnemosyne-proj.org) using py2app on 10.5.2. With the command python setup.py py2app, the application compiles, but when I try to run it I receive the following error: 08/03/16 23:49:08 mnemosyne[1574] mnemosyne Error An unexpected error has occurred during execution of the main script ImportError: Failure linking new module: /Users/patrick/Desktop/mnemosyn e-1.0.1/dist/mnemosyne.app/Contents/Resources/lib/python2.4/lib-dynload/qt.so: Library not loaded: libqt.3.dylib Referenced from: /Users/patrick/Desktop/mnemosyne-1.0.1 /dist/mnemosyne.app/Contents/Resources/lib/python2.4/lib-dynload/qt.so Reason: image not found I tried to include the QT library myself, using the -f /Developer/qt/lib/libqt.3.dylib flag, and I got this error: copying build/bdist.macosx-10.3-fat/python2.4-standalone/app/site- packages.zip -> /Users/patrick/Desktop/mnemosyne-1.0.1 /dist/mnemosyne.app/Contents/Resources/lib/python2.4 copying /Library/Frameworks/Python.framework/Versions/2.4/Python -> /Users/patrick/Desktop/mnemosyne-1.0.1 /dist/mnemosyne.app/Contents/Frameworks/Python.framework/Versions/2.4 copying /Library/Frameworks/Python.framework/Versions/2.4/Resources/Info.plist -> /Users/patrick/Desktop/mnemosyne-1.0.1 /dist/mnemosyne.app/Contents/Frameworks/Python.framework/Versions/2.4/Resources copying /Library/Frameworks/Python.framework/Versions/2.4/Resources/version.plist -> /Users/patrick/Desktop/mnemosyne-1.0.1 /dist/mnemosyne.app/Contents/Frameworks/Python.framework/Versions/2.4/Resources copying /Developer/qt/lib/libqt.3.dylib -> /Users/patrick/Desktop/mnemosyne- 1.0.1/dist/mnemosyne.app/Contents/Frameworks Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app- 0.3.6-py2.4.egg/py2app/build_app.py", line 548, in _run self.run_normal() File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app- 0.3.6-py2.4.egg/py2app/build_app.py", line 619, in run_normal self.create_binaries(py_files, pkgdirs, extensions, loader_files) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app- 0.3.6-py2.4.egg/py2app/build_app.py", line 731, in create_binaries mm.mm.run_file(fmwk) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachOGraph.py", line 66, in run_file File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachOStandalone.py", line 23, in createNode File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/altgraph- 0.6.7-py2.4.egg/altgraph/ObjectGraph.py", line 148, in createNode File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py", line 61, in __init__ File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py", line 76, in load File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py", line 106, in load_header File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py", line 146, in __init__ File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py", line 178, in load ValueError: Unknown load command: 30 > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- 1.1-py2.4.egg/macholib/MachO.py(178)load() How can I include the qt3 library so that the app can read it? Thanks in advance. Regards, --Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080317/92cdbb60/attachment.htm From kw at codebykevin.com Sat Mar 22 00:33:16 2008 From: kw at codebykevin.com (Kevin Walzer) Date: Fri, 21 Mar 2008 19:33:16 -0400 Subject: [Pythonmac-SIG] =?utf-8?q?QT=EF=BC=93_and_py2app_problem?= In-Reply-To: <270df8470803201629j45c87d4dwa1fd8d799ca33b06@mail.gmail.com> References: <270df8470803201629j45c87d4dwa1fd8d799ca33b06@mail.gmail.com> Message-ID: <47E445BC.70400@codebykevin.com> Patrick Kenny wrote: > Greetings, > > I am trying to build the application Mnemosyne (www.mnemosyne-proj.org) > using py2app on 10.5.2. With the command python setup.py py2app, the > application compiles, but when I try to run it I receive the following > error: > > 08/03/16 23:49:08 mnemosyne[1574] mnemosyne Error > An unexpected error has occurred during execution of the main script > ImportError: Failure linking new module: /Users/patrick/Desktop/mnemosyn > e-1.0.1/dist/mnemosyne.app/Contents/Resources/lib/python2.4/lib-dynload/qt.so: > Library not loaded: libqt.3.dylib > Referenced from: /Users/patrick/Desktop/mnemosyne-1.0.1 > /dist/mnemosyne.app/Contents/Resources/lib/python2.4/lib-dynload/qt.so > Reason: image not found > > I tried to include the QT library myself, using the -f > /Developer/qt/lib/libqt.3.dylib flag, and I got this error: > copying build/bdist.macosx-10.3-fat/python2.4-standalone/app/site- > packages.zip -> /Users/patrick/Desktop/mnemosyne-1.0.1 > /dist/mnemosyne.app/Contents/Resources/lib/python2.4 > copying /Library/Frameworks/Python.framework/Versions/2.4/Python -> > /Users/patrick/Desktop/mnemosyne-1.0.1 > /dist/mnemosyne.app/Contents/Frameworks/Python.framework/Versions/2.4 > copying > /Library/Frameworks/Python.framework/Versions/2.4/Resources/Info.plist -> > /Users/patrick/Desktop/mnemosyne-1.0.1 > /dist/mnemosyne.app/Contents/Frameworks/Python.framework/Versions/2.4/Resources > copying > /Library/Frameworks/Python.framework/Versions/2.4/Resources/version.plist -> > /Users/patrick/Desktop/mnemosyne-1.0.1 > /dist/mnemosyne.app/Contents/Frameworks/Python.framework/Versions/2.4/Resources > copying /Developer/qt/lib/libqt.3.dylib -> /Users/patrick/Desktop/mnemosyne- > 1.0.1/dist/mnemosyne.app/Contents/Frameworks > Traceback (most recent call last): > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app- > 0.3.6-py2.4.egg/py2app/build_app.py", line 548, in _run > self.run_normal() > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app- > 0.3.6-py2.4.egg/py2app/build_app.py", line 619, in run_normal > self.create_binaries(py_files, pkgdirs, extensions, loader_files) > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app- > 0.3.6-py2.4.egg/py2app/build_app.py", line 731, in create_binaries > mm.mm.run_file(fmwk) > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- > 1.1-py2.4.egg/macholib/MachOGraph.py", line 66, in run_file > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- > 1.1-py2.4.egg/macholib/MachOStandalone.py", line 23, in createNode > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/altgraph- > 0.6.7-py2.4.egg/altgraph/ObjectGraph.py", line 148, in createNode > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- > 1.1-py2.4.egg/macholib/MachO.py", line 61, in __init__ > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- > 1.1-py2.4.egg/macholib/MachO.py", line 76, in load > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- > 1.1-py2.4.egg/macholib/MachO.py", line 106, in load_header > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- > 1.1-py2.4.egg/macholib/MachO.py", line 146, in __init__ > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- > 1.1-py2.4.egg/macholib/MachO.py", line 178, in load > ValueError: Unknown load command: 30 > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/macholib- > 1.1-py2.4.egg/macholib/MachO.py(178)load() > > How can I include the qt3 library so that the app can read it? > > Thanks in advance. > > > Regards, > --Patrick > Try installing an old version of py2app--it supports Qt3. The latest py2app supports Qt4, which is quite different in its structure. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From lopoz at xs4all.nl Mon Mar 24 17:34:54 2008 From: lopoz at xs4all.nl (L. Fanchi) Date: Mon, 24 Mar 2008 17:34:54 +0100 Subject: [Pythonmac-SIG] py2app create folder in resources Message-ID: Hello, I'm creating an app which needs additional resources. I'd like to put these resources in a folder in the /Resources in the .app, but I'm having trouble doing so.. My setup.py looks like this: if sys.platform == 'darwin': setup( app=["avgui.py"], name="AutoViewerGUI", setup_requires=["py2app"], options=dict(py2app=dict( plist='Info.plist', resources='essentials/', iconfile='avgui.icns', )), ) As you can see, I'm trying to include the 'essentials' folder to the app, but instead of adding the folder itself, py2app adds the files inside the folder. Is there a way of making py2app recreate the 'essentials' folder inside the Resources folder in the app, instead of just copying the files to it? Thanks in advance! From jaharmi at jaharmi.com Wed Mar 26 14:11:50 2008 From: jaharmi at jaharmi.com (Jeremy Reichman) Date: Wed, 26 Mar 2008 09:11:50 -0400 Subject: [Pythonmac-SIG] suggestions for an appscript FAQ In-Reply-To: Message-ID: I just found out about appscript, and one of my early questions is "can I install it as a universal binary?" If I can't do that, my next question is "can I install it for both architectures simultaneously, on either PowerPC or Intel?" (I happen to do sys admin and would like to install it once for both architectures if possible.) -- Jeremy From Chris.Barker at noaa.gov Thu Mar 27 01:18:54 2008 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Wed, 26 Mar 2008 17:18:54 -0700 Subject: [Pythonmac-SIG] py2app and matplotlib Message-ID: <47EAE7EE.6030103@noaa.gov> Hi all, I'm having trouble getting py2app to work with matplotlib. There is a matplotlib recipe, but it's out of date, and some things have changed. The first error I got was not being able to find pytz.zoneinfo. As that's in a different place now, I commented it out of the matplotlib.py recipe. However, now I'm getting an error that I don't even know how to begin to solve: ... File "build/bdist.macosx-10.3-fat/egg/macholib/MachO.py", line 106, in load_header hdr = MachOHeader(self, fh, offset, size, magic, hdr, endian) File "build/bdist.macosx-10.3-fat/egg/macholib/MachO.py", line 146, in __init__ self.load(fh) File "build/bdist.macosx-10.3-fat/egg/macholib/MachO.py", line 178, in load raise ValueError("Unknown load command: %d" % (cmd_load.cmd,)) ValueError: Unknown load command: 27 > /Users/cbarker/HAZMAT/SmallToolsSVN/phCalculator/trunk/build/bdist.macosx-10.3-fat/egg/macholib/MachO.py(178)load() Enclosed is about the simplest matplotlib script, and a test_setup script to py2app it -- anyone have any ideas? -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 -------------- next part -------------- A non-text attachment was scrubbed... Name: test.py Type: text/x-python Size: 155 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20080326/56635228/attachment.py -------------- next part -------------- A non-text attachment was scrubbed... Name: test_setup.py Type: text/x-python Size: 608 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20080326/56635228/attachment-0001.py From lukas.polivka at gmail.com Thu Mar 27 09:01:54 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Thu, 27 Mar 2008 09:01:54 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> Message-ID: <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> On Sun, Mar 9, 2008 at 2:48 AM, Nathan wrote: > On Fri, Mar 7, 2008 at 10:03 PM, Luk?? 'Spike' Pol?vka > > wrote: > > > No luck, for some reason. What path do you suggest I should put there, > > if QtCore.so is placed in > > Jabbim.app/Contents/Resources/lib/python2.5/lib-dynload/PyQt4/? > > > > This is error log from Console: > > > > ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' > > not found > > Hmm. My missing stuff was pure python packages. I don't know if > shared libraries are treated the same or not. If that were a python > package, I would do > sys.path.insert(0,'../Resources/lib/python2.5/lib-dynload/') > > ~ Nathan > So, in the end, Nathan was right. The following helped me: sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') # for Twisted sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') # for PyQt4 The first path is for my Twisted. The corresponding bundle-relative path already was in sys.path, but after system-wide path. The second path is for my PyQt4. No bundle-relative path was in sys.path before, only system-wide (and wrong). Putting this to the main py (jabbim.py) seems like a mess to me, though. Now? my next problem is that apparently Qt4 is bundled without libjpeg. I have installed Trolls' official qt dmg (no compiling on my part). Outside of the bundle, Jabbim works OK, but when run from the bundle, JPEGs don't work. Any remedy on that? As a side note, setuptools==dev breaks py2app==dev, if anybody cares to know. Thank you guys, you have been 'quite'* helpful so far! :) Luk?? * read 'very much' -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From ronaldoussoren at mac.com Thu Mar 27 09:24:05 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 27 Mar 2008 09:24:05 +0100 Subject: [Pythonmac-SIG] py2app and matplotlib In-Reply-To: <47EAE7EE.6030103@noaa.gov> References: <47EAE7EE.6030103@noaa.gov> Message-ID: On 27 Mar, 2008, at 1:18, Christopher Barker wrote: ... > self.load(fh) > File "build/bdist.macosx-10.3-fat/egg/macholib/MachO.py", line 178, > in load > raise ValueError("Unknown load command: %d" % (cmd_load.cmd,)) > ValueError: Unknown load command: 27 > > /Users/cbarker/HAZMAT/SmallToolsSVN/phCalculator/trunk/build/ > bdist.macosx-10.3-fat/egg/macholib/MachO.py(178)load() That load command is for LC_UUID. The version of macholib in subversion should have some support that is (basicly ignoring the entire load command because macholib won't have to change it), could you test that (easy_install macholib==dev)? Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20080327/c4f06f4b/attachment.bin From ronaldoussoren at mac.com Thu Mar 27 09:29:29 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 27 Mar 2008 09:29:29 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> Message-ID: <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> On 27 Mar, 2008, at 9:01, Luk?? 'Spike' Pol?vka wrote: > On Sun, Mar 9, 2008 at 2:48 AM, Nathan > wrote: >> On Fri, Mar 7, 2008 at 10:03 PM, Luk?? 'Spike' Pol?vka >> >> wrote: >> >>> No luck, for some reason. What path do you suggest I should put >>> there, >>> if QtCore.so is placed in >>> Jabbim.app/Contents/Resources/lib/python2.5/lib-dynload/PyQt4/? >>> >>> This is error log from Console: >>> >>> ImportError: '/System/Library/Frameworks/Python.framework/Versions/ >>> 2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' >>> not found >> >> Hmm. My missing stuff was pure python packages. I don't know if >> shared libraries are treated the same or not. If that were a python >> package, I would do >> sys.path.insert(0,'../Resources/lib/python2.5/lib-dynload/') >> >> ~ Nathan >> > So, in the end, Nathan was right. The following helped me: > > sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') # > for Twisted > sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') # for > PyQt4 That might help you, but leaves the bug in py2app. Phrased differently: this is a nice short-term hack, but it would be better py2app were changed to not require this hack. I'd really appreciate is some else could have a look at this, otherwise the issue will stay around until I get around fixing it which might take a while (especially because the bug for some reason doesn't affect me). > > > The first path is for my Twisted. The corresponding bundle-relative > path already was in sys.path, but after system-wide path. > The second path is for my PyQt4. No bundle-relative path was in > sys.path before, only system-wide (and wrong). The system-wide path should be there in the first place, maybe unless you run an alias bundle. > > > Putting this to the main py (jabbim.py) seems like a mess to me, > though. > > Now? my next problem is that apparently Qt4 is bundled without > libjpeg. I have installed Trolls' official qt dmg (no compiling on my > part). Outside of the bundle, Jabbim works OK, but when run from the > bundle, JPEGs don't work. Any remedy on that? > > > As a side note, setuptools==dev breaks py2app==dev, if anybody cares > to know. I care. Could you elaborate, or even better provide a patch ;-) > > > Thank you guys, you have been 'quite'* helpful so far! :) > > > Luk?? > > * read 'very much' > -- > IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz > ICQ, AIM, MSN: Never ever! > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20080327/9178b2a3/attachment.bin From lukas.polivka at gmail.com Thu Mar 27 09:43:04 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Thu, 27 Mar 2008 09:43:04 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> Message-ID: <76a8b5470803270143l4028bb9eh8b56829258113b4f@mail.gmail.com> On Thu, Mar 27, 2008 at 9:29 AM, Ronald Oussoren wrote: > > On 27 Mar, 2008, at 9:01, Luk?? 'Spike' Pol?vka wrote: > > On Sun, Mar 9, 2008 at 2:48 AM, Nathan > > wrote: > >> On Fri, Mar 7, 2008 at 10:03 PM, Luk?? 'Spike' Pol?vka > >> > >> wrote: > >> > >>> No luck, for some reason. What path do you suggest I should put > >>> there, > >>> if QtCore.so is placed in > >>> Jabbim.app/Contents/Resources/lib/python2.5/lib-dynload/PyQt4/? > >>> > >>> This is error log from Console: > >>> > >>> ImportError: '/System/Library/Frameworks/Python.framework/Versions/ > >>> 2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' > >>> not found > >> > >> Hmm. My missing stuff was pure python packages. I don't know if > >> shared libraries are treated the same or not. If that were a python > >> package, I would do > >> sys.path.insert(0,'../Resources/lib/python2.5/lib-dynload/') > >> > >> ~ Nathan > >> > > So, in the end, Nathan was right. The following helped me: > > > > sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') # > > for Twisted > > sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') # for > > PyQt4 > > That might help you, but leaves the bug in py2app. Phrased > differently: this is a nice short-term hack, but it would be better > py2app were changed to not require this hack. I'd really appreciate is > some else could have a look at this, otherwise the issue will stay > around until I get around fixing it which might take a while > (especially because the bug for some reason doesn't affect me). I agree it is only a hack. I'm afraid I am not able to fix py2app, though. > > The first path is for my Twisted. The corresponding bundle-relative > > path already was in sys.path, but after system-wide path. > > The second path is for my PyQt4. No bundle-relative path was in > > sys.path before, only system-wide (and wrong). > > The system-wide path should be there in the first place, maybe unless > you run an alias bundle. Well, then you run into problems if you need to bundle e.g. newer library than the one provided with the system by default (which is the case with Twisted, if I am not mistaken). Also, the second path for PyQt4 didn't work as well, if it was only appended to sys.path. I had to place it before the non-existent system path. > > Putting this to the main py (jabbim.py) seems like a mess to me, > > though. > > > > Now? my next problem is that apparently Qt4 is bundled without > > libjpeg. I have installed Trolls' official qt dmg (no compiling on my > > part). Outside of the bundle, Jabbim works OK, but when run from the > > bundle, JPEGs don't work. Any remedy on that? > > > > > > As a side note, setuptools==dev breaks py2app==dev, if anybody cares > > to know. > > I care. Could you elaborate, or even better provide a patch ;-) $ sudo easy_install -U setuptools==dev Installed /Library/Python/2.5/site-packages/setuptools-0.7a1dev_r61341-py2.5.egg $ sudo easy_install -U py2app==dev Installed /Library/Python/2.5/site-packages/py2app-0.4.2-py2.5.egg $ export PYTHONPATH=/Library/Python/2.5/site-packages $ python setup.py py2app running py2app Traceback (most recent call last): File "/Library/Python/2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 579, in _run self.run_normal() File "/Library/Python/2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 631, in run_normal mf = self.get_modulefinder() File "/Library/Python/2.5/site-packages/py2app-0.4.2-py2.5.egg/py2app/build_app.py", line 539, in get_modulefinder debug=debug, File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/find_modules.py", line 255, in find_modules find_needed_modules(mf, scripts, includes, packages) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/find_modules.py", line 176, in find_needed_modules mf.run_script(path) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/modulegraph.py", line 369, in run_script self.scan_code(co, m) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/modulegraph.py", line 638, in scan_code self.scan_code(c, m) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/modulegraph.py", line 610, in scan_code self._safe_import_hook(name, m, fromlist) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/modulegraph.py", line 540, in _safe_import_hook mods = self.import_hook(name, caller) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/modulegraph.py", line 380, in import_hook q, tail = self.find_head_package(parent, name) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/modulegraph.py", line 419, in find_head_package q = self.import_module(head, qname, parent) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/modulegraph.py", line 493, in import_module parent and parent.packagepath, parent) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/modulegraph.py", line 680, in find_module fp, buf, stuff = find_module(name, path) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/modulegraph.py", line 114, in find_module if isinstance(importer, pkg_resources.ImpWrapper): AttributeError: 'module' object has no attribute 'ImpWrapper' > /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/modulegraph/modulegraph.py(114)find_module() -> if isinstance(importer, pkg_resources.ImpWrapper): (Pdb) No patch, sorry. :) Luk?? -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From ronaldoussoren at mac.com Thu Mar 27 09:43:15 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 27 Mar 2008 09:43:15 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> Message-ID: <78899595-D6D7-448B-933D-5E591F16AB8A@mac.com> On 27 Mar, 2008, at 9:29, Ronald Oussoren wrote: >>> >> So, in the end, Nathan was right. The following helped me: >> >> sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') >> # for Twisted >> sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') # for >> PyQt4 > > That might help you, but leaves the bug in py2app. Phrased > differently: this is a nice short-term hack, but it would be better > py2app were changed to not require this hack. I'd really appreciate > is some else could have a look at this, otherwise the issue will > stay around until I get around fixing it which might take a while > (especially because the bug for some reason doesn't affect me). Are you by any change using the '--site-packages' option of py2app? If so, you run into a (mis-)feature of setuptools: the easy_install.pth file in site-packages contains an nasty hack that ensures that easy- installed software is placed as early as possible on sys.path. You could try running without it, --site-packages shouldn't be necessary for a self-contained application bundle. In the longer run it would be nice to change the code that --site-packages injects into the .app bundle work around this "feature" of setuptools. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20080327/c335a52b/attachment.bin From lukas.polivka at gmail.com Thu Mar 27 09:45:48 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Thu, 27 Mar 2008 09:45:48 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <78899595-D6D7-448B-933D-5E591F16AB8A@mac.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> <78899595-D6D7-448B-933D-5E591F16AB8A@mac.com> Message-ID: <76a8b5470803270145v39d1138en1bde6d9e90fec943@mail.gmail.com> On Thu, Mar 27, 2008 at 9:43 AM, Ronald Oussoren wrote: > > > > On 27 Mar, 2008, at 9:29, Ronald Oussoren wrote: > >>> > >> So, in the end, Nathan was right. The following helped me: > >> > >> sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') > >> # for Twisted > >> sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') # for > >> PyQt4 > > > > That might help you, but leaves the bug in py2app. Phrased > > differently: this is a nice short-term hack, but it would be better > > py2app were changed to not require this hack. I'd really appreciate > > is some else could have a look at this, otherwise the issue will > > stay around until I get around fixing it which might take a while > > (especially because the bug for some reason doesn't affect me). > > Are you by any change using the '--site-packages' option of py2app? If > so, you run into a (mis-)feature of setuptools: the easy_install.pth > file in site-packages contains an nasty hack that ensures that easy- > installed software is placed as early as possible on sys.path. > > You could try running without it, --site-packages shouldn't be > necessary for a self-contained application bundle. In the longer run > it would be nice to change the code that --site-packages injects into > the .app bundle work around this "feature" of setuptools. > > Ronald Yes, you are right. Well, if I don't use --site-packages, my app complains SIP is missing? I guess I will have to include it in the app by some other means. Luk?? -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From lukas.polivka at gmail.com Thu Mar 27 09:55:38 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Thu, 27 Mar 2008 09:55:38 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <76a8b5470803270145v39d1138en1bde6d9e90fec943@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> <78899595-D6D7-448B-933D-5E591F16AB8A@mac.com> <76a8b5470803270145v39d1138en1bde6d9e90fec943@mail.gmail.com> Message-ID: <76a8b5470803270155m3dd4cfd0n79eb6f9a9fa4b407@mail.gmail.com> On Thu, Mar 27, 2008 at 9:45 AM, Luk?? 'Spike' Pol?vka wrote: > > On Thu, Mar 27, 2008 at 9:43 AM, Ronald Oussoren wrote: > > > > > > > > On 27 Mar, 2008, at 9:29, Ronald Oussoren wrote: > > >>> > > >> So, in the end, Nathan was right. The following helped me: > > >> > > >> sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') > > >> # for Twisted > > >> sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') # for > > >> PyQt4 > > > > > > That might help you, but leaves the bug in py2app. Phrased > > > differently: this is a nice short-term hack, but it would be better > > > py2app were changed to not require this hack. I'd really appreciate > > > is some else could have a look at this, otherwise the issue will > > > stay around until I get around fixing it which might take a while > > > (especially because the bug for some reason doesn't affect me). > > > > Are you by any change using the '--site-packages' option of py2app? If > > so, you run into a (mis-)feature of setuptools: the easy_install.pth > > file in site-packages contains an nasty hack that ensures that easy- > > installed software is placed as early as possible on sys.path. > > > > You could try running without it, --site-packages shouldn't be > > necessary for a self-contained application bundle. In the longer run > > it would be nice to change the code that --site-packages injects into > > the .app bundle work around this "feature" of setuptools. > > > > Ronald > Yes, you are right. Well, if I don't use --site-packages, my app > complains SIP is missing? I guess I will have to include it in the app > by some other means. Aha, seems like 'includes': ['sip'], did the trick when I placed it in my setup.py. I think I got my setup.py wrong because things like --site-packages or --use-pythonpath work "nicely" in alias mode? Luk?? -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From lukas.polivka at gmail.com Thu Mar 27 10:09:06 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Thu, 27 Mar 2008 10:09:06 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <76a8b5470803270155m3dd4cfd0n79eb6f9a9fa4b407@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> <78899595-D6D7-448B-933D-5E591F16AB8A@mac.com> <76a8b5470803270145v39d1138en1bde6d9e90fec943@mail.gmail.com> <76a8b5470803270155m3dd4cfd0n79eb6f9a9fa4b407@mail.gmail.com> Message-ID: <76a8b5470803270209r656cbdd1l7a012ba16b905702@mail.gmail.com> On Thu, Mar 27, 2008 at 9:55 AM, Luk?? 'Spike' Pol?vka wrote: > On Thu, Mar 27, 2008 at 9:45 AM, Luk?? 'Spike' Pol?vka > > wrote: > > > > > > On Thu, Mar 27, 2008 at 9:43 AM, Ronald Oussoren wrote: > > > > > > > > > > > > On 27 Mar, 2008, at 9:29, Ronald Oussoren wrote: > > > >>> > > > >> So, in the end, Nathan was right. The following helped me: > > > >> > > > >> sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') > > > >> # for Twisted > > > >> sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') # for > > > >> PyQt4 > > > > > > > > That might help you, but leaves the bug in py2app. Phrased > > > > differently: this is a nice short-term hack, but it would be better > > > > py2app were changed to not require this hack. I'd really appreciate > > > > is some else could have a look at this, otherwise the issue will > > > > stay around until I get around fixing it which might take a while > > > > (especially because the bug for some reason doesn't affect me). > > > > > > Are you by any change using the '--site-packages' option of py2app? If > > > so, you run into a (mis-)feature of setuptools: the easy_install.pth > > > file in site-packages contains an nasty hack that ensures that easy- > > > installed software is placed as early as possible on sys.path. > > > > > > You could try running without it, --site-packages shouldn't be > > > necessary for a self-contained application bundle. In the longer run > > > it would be nice to change the code that --site-packages injects into > > > the .app bundle work around this "feature" of setuptools. > > > > > > Ronald > > Yes, you are right. Well, if I don't use --site-packages, my app > > complains SIP is missing? I guess I will have to include it in the app > > by some other means. > Aha, seems like 'includes': ['sip'], did the trick when I placed it in > my setup.py. > > I think I got my setup.py wrong because things like --site-packages or > --use-pythonpath work "nicely" in alias mode? Seems like I still have to use sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') anyway. If I include sip, I can drop --site-packages. But if I drop that sys.path.insert, wrong Twisted library is used anyway. By the way, I have installed Twisted from their dmg (not through easy_install). Sorry I'm spamming this list with my thoughts like this. If you are on IRC or Jabber, we could discuss it there and then post (re)solution here. I'm kind of lost in all of these path issues? :/ No idea about libjpeg issue? Thanks, Luk?? -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From ronaldoussoren at mac.com Thu Mar 27 10:23:27 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 27 Mar 2008 10:23:27 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <76a8b5470803270209r656cbdd1l7a012ba16b905702@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> <78899595-D6D7-448B-933D-5E591F16AB8A@mac.com> <76a8b5470803270145v39d1138en1bde6d9e90fec943@mail.gmail.com> <76a8b5470803270155m3dd4cfd0n79eb6f9a9fa4b407@mail.gmail.com> <76a8b5470803270209r656cbdd1l7a012ba16b905702@mail.gmail.com> Message-ID: On 27 Mar, 2008, at 10:09, Luk?? 'Spike' Pol?vka wrote: > On Thu, Mar 27, 2008 at 9:55 AM, Luk?? 'Spike' Pol?vka > wrote: >> On Thu, Mar 27, 2008 at 9:45 AM, Luk?? 'Spike' Pol?vka >> >> wrote: >>> >> >> >>> On Thu, Mar 27, 2008 at 9:43 AM, Ronald Oussoren >> > wrote: >>>> >>>> >>>> >>>> On 27 Mar, 2008, at 9:29, Ronald Oussoren wrote: >>>>>>> >>>>>> So, in the end, Nathan was right. The following helped me: >>>>>> >>>>>> sys.path.insert(0, '../Resources/lib/python2.5/site- >>>>>> packages.zip') >>>>>> # for Twisted >>>>>> sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') # >>>>>> for >>>>>> PyQt4 >>>>> >>>>> That might help you, but leaves the bug in py2app. Phrased >>>>> differently: this is a nice short-term hack, but it would be >>>>> better >>>>> py2app were changed to not require this hack. I'd really >>>>> appreciate >>>>> is some else could have a look at this, otherwise the issue will >>>>> stay around until I get around fixing it which might take a while >>>>> (especially because the bug for some reason doesn't affect me). >>>> >>>> Are you by any change using the '--site-packages' option of >>>> py2app? If >>>> so, you run into a (mis-)feature of setuptools: the >>>> easy_install.pth >>>> file in site-packages contains an nasty hack that ensures that >>>> easy- >>>> installed software is placed as early as possible on sys.path. >>>> >>>> You could try running without it, --site-packages shouldn't be >>>> necessary for a self-contained application bundle. In the longer >>>> run >>>> it would be nice to change the code that --site-packages injects >>>> into >>>> the .app bundle work around this "feature" of setuptools. >>>> >>>> Ronald >>> Yes, you are right. Well, if I don't use --site-packages, my app >>> complains SIP is missing? I guess I will have to include it in the >>> app >>> by some other means. >> Aha, seems like 'includes': ['sip'], did the trick when I placed it >> in >> my setup.py. >> >> I think I got my setup.py wrong because things like --site-packages >> or >> --use-pythonpath work "nicely" in alias mode? > Seems like I still have to use sys.path.insert(0, > '../Resources/lib/python2.5/site-packages.zip') anyway. If I include > sip, I can drop --site-packages. But if I drop that sys.path.insert, > wrong Twisted library is used anyway. > > By the way, I have installed Twisted from their dmg (not through > easy_install). > > Sorry I'm spamming this list with my thoughts like this. If you are on > IRC or Jabber, we could discuss it there and then post (re)solution > here. Could you post the exact setup you're using again: - Which version of OSX? - Which copy of python (/usr/bin/python, Python.org installer, ...) - How did you install PyQt (and which version)? - How did you install Twisted (and which version)? - The setup.py you're using - Link to the software - Anything else that might be relevant to reproduce the problem I don't have time to look into this right now, but hopefully will have some time this weekend. I'm slowly gearing up for a new release of PyObjC and would like to fix as much issue in py2app &friends as well. BTW. the (setuptools==dev, py2app==dev) issue seems to trivial, macholib uses a class that turns out to be private to pkg_resources and that class was moved elsewhere. > > > I'm kind of lost in all of these path issues? :/ > > No idea about libjpeg issue? I guess macholib doesn't pick up that dependency for some reason. You could copy the jpeg bit by hand to get going again. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20080327/2c33b006/attachment-0001.bin From lists at mostrom.pp.se Thu Mar 27 11:52:14 2008 From: lists at mostrom.pp.se (=?UTF-8?Q?Jan_Erik_Mostr=C3=B6?= =?UTF-8?Q?m?=) Date: Thu, 27 Mar 2008 11:52:14 +0100 Subject: [Pythonmac-SIG] Using scripting bridge Message-ID: I'm doing my first attempts in trying to use the scripting bridge and I'm not very successful. I probably doesn't understand how to do things at all and unfortunately I can't find any docs on how to do things. What I want to do is basically to do some data processing using python and then control various applications and insert data into them. My first attempt is to be able to script Mailsmith. My problem is that I don't understand how I should translate the applescript commands to the equivalent python code. If someone could give me some hints or point me to some documentation of how to how to do this translation I would be grateful. Here is a small snippet that I can't translate on createMessageInMailsmith(subjectText, bodyText, recipientList, accountName) tell application "Mailsmith" set nm to make new message window tell nm set subject to subjectText set contents to bodyText end tell end tell end createMessageInMailsmith unfortunately I don't get much further than #! /usr/bin/env python from Foundation import * from ScriptingBridge import * mailsmith = SBApplication.applicationWithBundleIdentifier_('com.barebones.mailsmith') def createemail( account, recipients, subject, body, queue = False ): mailsmith.makeNewMessageWindow() createemail( 'jobbet', 'Some subject', 'body text') jem -- Jan Erik Mostr?m, www.mostrom.pp.se From hengist.podd at virgin.net Thu Mar 27 15:35:09 2008 From: hengist.podd at virgin.net (has) Date: Thu, 27 Mar 2008 14:35:09 +0000 Subject: [Pythonmac-SIG] Universal binary extensions questions [was: Re: suggestions for an appscript FAQ] In-Reply-To: References: Message-ID: Jeremy Reichman wrote: > I just found out about appscript, and one of my early questions is > "can I > install it as a universal binary?" If I can't do that, my next > question is > "can I install it for both architectures simultaneously, on either > PowerPC > or Intel?" (I happen to do sys admin and would like to install it > once for > both architectures if possible.) This is more of a general distutils/setuptools/Mac Python question, and would be better covered by their FAQs if they aren't already. If anyone has links to those FAQs, let me know and I'll add them to the 'Getting more help' section of the appscript FAQ. To try to answer your question: it depends on what Python build you're installing it on and if it's a UB itself or not. OS X's default Python frameworks are a bit quirky in their build settings, e.g. Tiger's Python 2.3.5 is, IIRC, platform-specific; Leopard's Python 2.5 is a four-way UB, but its out-of-the-box configuration is a bit duff which causes some hassles for building UB extensions (I think they're two- way UB, but labelled by architecture). Third-party Python distributions may have different default build rules; if you're using one of those, you need to check yourself. FWIW, I currently provide 32-bit UBs of appscript 0.18.1 for Python 2.5.x as pre-built eggs, which you can install via setuptools' easy_install. The 'i386' and 'ppc' eggs are UBs built on Leopard Python, hence the wonky naming. The 'fat' egg is built with the official Mac Python distribution off python.org, but Leopard Python ignores it, which is why I have to distribute three eggs to do the same job instead of one . There's also a source .tar.gz distribution which you can d/l and build yourself, or setuptools will use it automatically if it can't find a suitable egg for your Python distribution. Anyway, other folks here know more about this stuff than I do, so hopefully they can chip in with more information if you want to provide more details about your setup. HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From hengist.podd at virgin.net Thu Mar 27 15:57:04 2008 From: hengist.podd at virgin.net (has) Date: Thu, 27 Mar 2008 14:57:04 +0000 Subject: [Pythonmac-SIG] Using scripting bridge In-Reply-To: References: Message-ID: <3A4CE23B-9DD7-493A-A3A8-53214A377F01@virgin.net> Jan Erik Mostr?m wrote: > I'm doing my first attempts in trying to use the scripting bridge > and I'm not very successful. I probably doesn't understand how to do > things at all and unfortunately I can't find any docs on how to do > things. Any particular reason for wanting to use Scripting Bridge? Appscript provides a native API, better application compatibility and decent support tools, so I'd suggest taking a look at that first. > My problem is that I don't understand how I should translate the > applescript commands to the equivalent python code. ASTranslate is very handy when trying to figure out how to convert an AppleScript command to its appscript equivalent. Type in an AppleScript command, run it, and ASTranslate will display the resulting Apple event as Python/Ruby code, which should give you a good clue as to what to write in your script. > Here is a small snippet that I can't translate > > on createMessageInMailsmith(subjectText, bodyText, recipientList, > accountName) > tell application "Mailsmith" > set nm to make new message window > tell nm > set subject to subjectText > set contents to bodyText > end tell > end tell > end createMessageInMailsmith In appscript, I imagine this would read something like: from appscript import * mailsmith = app('Mailsmith') nm = mailsmith.make(new=k.message_window) nm.subject.set(subjecttext) nm.contents.set(bodytext) HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From emanuelesantos at gmail.com Thu Mar 27 17:14:23 2008 From: emanuelesantos at gmail.com (Emanuele Santos) Date: Thu, 27 Mar 2008 10:14:23 -0600 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> Message-ID: <2D7FE213-74A2-4592-BFEB-E2109297B2AD@gmail.com> The problem with jpeg in Qt is that it's included as a plugin. I don't know about the .dmg installation, as I built mine from source. I remember that I didn't know how to fix py2app to handle this, so I used this hack: After running, py2app, I copied the contents of the Qt plugins directory to the MacOS folder inside the bundle, used install_name_tool to point the dylibs to the bundle's Qt framework, png and jpeg dylibs; and put an empty qt.conf file in the Resources folder. The other problem I had is if a user has a Qt installation in the same directory you had when you built the bundle, there will be conflicts when loading the libraries. The empty qt.conf should solve that, but qt still searches for the plugins in the installed directory first. On Mar 27, 2008, at 2:01 AM, Luk?? 'Spike' Pol?vka wrote: > On Sun, Mar 9, 2008 at 2:48 AM, Nathan > wrote: >> On Fri, Mar 7, 2008 at 10:03 PM, Luk?? 'Spike' Pol?vka >> >> wrote: >> >>> No luck, for some reason. What path do you suggest I should put >>> there, >>> if QtCore.so is placed in >>> Jabbim.app/Contents/Resources/lib/python2.5/lib-dynload/PyQt4/? >>> >>> This is error log from Console: >>> >>> ImportError: '/System/Library/Frameworks/Python.framework/Versions/ >>> 2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' >>> not found >> >> Hmm. My missing stuff was pure python packages. I don't know if >> shared libraries are treated the same or not. If that were a python >> package, I would do >> sys.path.insert(0,'../Resources/lib/python2.5/lib-dynload/') >> >> ~ Nathan >> > So, in the end, Nathan was right. The following helped me: > > sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') # > for Twisted > sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') # for > PyQt4 > > The first path is for my Twisted. The corresponding bundle-relative > path already was in sys.path, but after system-wide path. > The second path is for my PyQt4. No bundle-relative path was in > sys.path before, only system-wide (and wrong). > > Putting this to the main py (jabbim.py) seems like a mess to me, > though. > > Now? my next problem is that apparently Qt4 is bundled without > libjpeg. I have installed Trolls' official qt dmg (no compiling on my > part). Outside of the bundle, Jabbim works OK, but when run from the > bundle, JPEGs don't work. Any remedy on that? > > As a side note, setuptools==dev breaks py2app==dev, if anybody cares > to know. > > Thank you guys, you have been 'quite'* helpful so far! :) > > Luk?? > > * read 'very much' > -- > IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz > ICQ, AIM, MSN: Never ever! > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From ronaldoussoren at mac.com Thu Mar 27 17:42:06 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 27 Mar 2008 17:42:06 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: <2D7FE213-74A2-4592-BFEB-E2109297B2AD@gmail.com> References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <47CED7F6.2020103@noaa.gov> <7419D775-CC9E-4321-B352-0ED8CA9B2539@mac.com> <76a8b5470803052359y1b90d38fh82bf47d4be5659de@mail.gmail.com> <8DA068EA-A637-46F2-BF0B-8B1F2F3FE2F5@mac.com> <96c9d6a80803060851nd3ce80drd6eaef725a88c2dd@mail.gmail.com> <76a8b5470803070522p300b3e36pb3b6f72e55b1fa@mail.gmail.com> <96c9d6a80803070823g873b8f2o393bdcd56c1bc221@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> <2D7FE213-74A2-4592-BFEB-E2109297B2AD@gmail.com> Message-ID: <6153F1D3-1E89-4F63-9AC9-950747B7FB90@mac.com> On 27 Mar, 2008, at 17:14, Emanuele Santos wrote: > The problem with jpeg in Qt is that it's included as a plugin. I don't > know about the .dmg installation, as I built mine from source. > > I remember that I didn't know how to fix py2app to handle this, so I > used this hack: > After running, py2app, I copied the contents of the Qt plugins > directory to the MacOS folder inside the bundle, used > install_name_tool to point the dylibs to the bundle's Qt framework, > png and jpeg dylibs; and put an empty qt.conf file in the Resources > folder. It should be possible to teach py2app to do this automaticly for you, there is already a recipe that triggers when pyQt is used by a program and adding this logic should be doable. > > > The other problem I had is if a user has a Qt installation in the same > directory you had when you built the bundle, there will be conflicts > when loading the libraries. The empty qt.conf should solve that, but > qt still searches for the plugins in the installed directory first. That one is harder to fix and seems to require the cooperation of the Qt maintainers. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20080327/5d0356fc/attachment.bin From lists at mostrom.pp.se Thu Mar 27 19:43:54 2008 From: lists at mostrom.pp.se (=?UTF-8?Q?Jan_Erik_Mostr=C3=B6?= =?UTF-8?Q?m?=) Date: Thu, 27 Mar 2008 19:43:54 +0100 Subject: [Pythonmac-SIG] Using scripting bridge In-Reply-To: <3A4CE23B-9DD7-493A-A3A8-53214A377F01@virgin.net> Message-ID: has 08-03-27 14.57 >Any particular reason for wanting to use Scripting Bridge? >Appscript provides a native API, better application >compatibility and decent support tools, so I'd suggest taking >a look at that first. Because of my lack of knowledge regarding these things ;-) I'll try appscript jem -- Jan Erik Mostr?m, www.mostrom.pp.se From lukas.polivka at gmail.com Thu Mar 27 21:10:51 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Thu, 27 Mar 2008 21:10:51 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> <78899595-D6D7-448B-933D-5E591F16AB8A@mac.com> <76a8b5470803270145v39d1138en1bde6d9e90fec943@mail.gmail.com> <76a8b5470803270155m3dd4cfd0n79eb6f9a9fa4b407@mail.gmail.com> <76a8b5470803270209r656cbdd1l7a012ba16b905702@mail.gmail.com> Message-ID: <76a8b5470803271310i21caac87od8654f4ab1148218@mail.gmail.com> On Thu, Mar 27, 2008 at 10:23 AM, Ronald Oussoren wrote: > Could you post the exact setup you're using again: > - Which version of OSX? > - Which copy of python (/usr/bin/python, Python.org installer, ...) > - How did you install PyQt (and which version)? > - How did you install Twisted (and which version)? > - The setup.py you're using > - Link to the software > - Anything else that might be relevant to reproduce the problem I'm using 10.5.2. Today, I have also reinstalled it (archive & install) to make sure I don't have borken system. I use Leopard-bundled Python. Here are the steps I have undertaken after reinstall to get Jabbim working: Installed Xcode Tools 3 from DVD Installed Qt 4.3.4 from Trolltech's DMG sudo easy_install -U setuptools # installed: /Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg export PYTHONPATH=/Library/Python/2.5/site-packages # because of newer setuptools module sudo /usr/local/bin/easy_install -U py2app==dev # /usr/local because of newer easy_install script SIP: sip-4.7.5-snapshot-20080229 python configure.py make sudo make install PyQt4: PyQt-mac-gpl-4.3.4-snapshot-20080319 python configure.py make sudo make install Twisted: Twisted-8.0.1_py2.5_osx10.5.pkg # installed to /Library/Python/2.5/site-packages/, as opposed to Leopard-bundled version 2.4, which is in /System/Library/Frameworks/? PyCrypto: PyCrypto-2.0.1_py2.5_osx10.5.pkg Now, if I want my python interpreter to use my new Twisted, I have to export PYTHONPATH=/Library/Python/2.5/site-packages, otherwise Leopard-bundled version is used. To get Jabbim from Subversion repository (I use jabbim-ng for historical reasons): svn co svn://dev.jabbim.cz/jabbim/trunk jabbim-ng cd jabbim-ng/ # Make sure you have our PYTHONPATH=/Library/Python/2.5/site-packages exported sh ./jabbim.sh Now Jabbim should run. Now edit jabbim.py and insert after line 22: sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') Use my setup.py and jabbim.icns* python setup.py py2app Run Jabbim.app. (At this point, libqjpeg.dynload & friends are not installed? maybe I should use my own, static-compiled Qt in the future.) *I have uploaded them here: http://disk.jabbim.cz/spike411 at jabber.cz/jabbim.icns http://disk.jabbim.cz/spike411 at jabber.cz/setup.py I hope my info helps a little. Luk?? -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From lukas.polivka at gmail.com Thu Mar 27 21:10:51 2008 From: lukas.polivka at gmail.com (=?UTF-8?Q?Luk=C3=A1=C5=A1_'Spike'_Pol=C3=ADvka?=) Date: Thu, 27 Mar 2008 21:10:51 +0100 Subject: [Pythonmac-SIG] distutils.errors.DistutilsFileError: file '/Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.pyc' does not exist In-Reply-To: References: <76a8b5470803050000i5a314a91k1fc136c06fc81211@mail.gmail.com> <76a8b5470803072103oa35e039x873233f3d4e2146d@mail.gmail.com> <96c9d6a80803081748v41329958oe9b026421c8e8c94@mail.gmail.com> <76a8b5470803270101x363f36eau14838443fefc8bdc@mail.gmail.com> <7E494692-2038-4C1A-AA7E-6BFF16B5875A@mac.com> <78899595-D6D7-448B-933D-5E591F16AB8A@mac.com> <76a8b5470803270145v39d1138en1bde6d9e90fec943@mail.gmail.com> <76a8b5470803270155m3dd4cfd0n79eb6f9a9fa4b407@mail.gmail.com> <76a8b5470803270209r656cbdd1l7a012ba16b905702@mail.gmail.com> Message-ID: <76a8b5470803271310i21caac87od8654f4ab1148218@mail.gmail.com> On Thu, Mar 27, 2008 at 10:23 AM, Ronald Oussoren wrote: > Could you post the exact setup you're using again: > - Which version of OSX? > - Which copy of python (/usr/bin/python, Python.org installer, ...) > - How did you install PyQt (and which version)? > - How did you install Twisted (and which version)? > - The setup.py you're using > - Link to the software > - Anything else that might be relevant to reproduce the problem I'm using 10.5.2. Today, I have also reinstalled it (archive & install) to make sure I don't have borken system. I use Leopard-bundled Python. Here are the steps I have undertaken after reinstall to get Jabbim working: Installed Xcode Tools 3 from DVD Installed Qt 4.3.4 from Trolltech's DMG sudo easy_install -U setuptools # installed: /Library/Python/2.5/site-packages/setuptools-0.6c8-py2.5.egg export PYTHONPATH=/Library/Python/2.5/site-packages # because of newer setuptools module sudo /usr/local/bin/easy_install -U py2app==dev # /usr/local because of newer easy_install script SIP: sip-4.7.5-snapshot-20080229 python configure.py make sudo make install PyQt4: PyQt-mac-gpl-4.3.4-snapshot-20080319 python configure.py make sudo make install Twisted: Twisted-8.0.1_py2.5_osx10.5.pkg # installed to /Library/Python/2.5/site-packages/, as opposed to Leopard-bundled version 2.4, which is in /System/Library/Frameworks/? PyCrypto: PyCrypto-2.0.1_py2.5_osx10.5.pkg Now, if I want my python interpreter to use my new Twisted, I have to export PYTHONPATH=/Library/Python/2.5/site-packages, otherwise Leopard-bundled version is used. To get Jabbim from Subversion repository (I use jabbim-ng for historical reasons): svn co svn://dev.jabbim.cz/jabbim/trunk jabbim-ng cd jabbim-ng/ # Make sure you have our PYTHONPATH=/Library/Python/2.5/site-packages exported sh ./jabbim.sh Now Jabbim should run. Now edit jabbim.py and insert after line 22: sys.path.insert(0, '../Resources/lib/python2.5/site-packages.zip') sys.path.insert(0, '../Resources/lib/python2.5/lib-dynload') Use my setup.py and jabbim.icns* python setup.py py2app Run Jabbim.app. (At this point, libqjpeg.dynload & friends are not installed? maybe I should use my own, static-compiled Qt in the future.) *I have uploaded them here: http://disk.jabbim.cz/spike411 at jabber.cz/jabbim.icns http://disk.jabbim.cz/spike411 at jabber.cz/setup.py I hope my info helps a little. Luk?? -- IM (XMPP/Jabber/Google Talk): spike411 at jabber.cz ICQ, AIM, MSN: Never ever! From maccman at gmail.com Fri Mar 28 11:24:44 2008 From: maccman at gmail.com (Alex MacCaw) Date: Fri, 28 Mar 2008 10:24:44 +0000 Subject: [Pythonmac-SIG] Sending files to the trash Message-ID: <75872ED4-2E2F-43F0-AD9B-05E8D3DB0CA8@gmail.com> I'm making a cross platform script that sends files to the trash (or recycle bin), but am having trouble with the applescript version: Here's the applescript which I'm trying to generate: tell application "Finder" move path to the trash end tell And the py-appscript version (which doesn't work): app('Finder').move(os.path.abspath(path), to=k.trash) Can anyone give me any pointers on how to get the appscript version working? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080328/fb33fd67/attachment.htm From dhong at gist.ac.kr Fri Mar 28 11:40:04 2008 From: dhong at gist.ac.kr (Dongpyo Hong) Date: Fri, 28 Mar 2008 23:40:04 +1300 Subject: [Pythonmac-SIG] Import AppKit (pyobjc) and Cocoa-Python Debug Error Message-ID: <4E80B551-524D-487F-A311-6C46E557AD99@gist.ac.kr> Hi all, I am not sure whether this issue was already dealt in here. XCode 3.0 already included python 2.5.1 (I think), and I updated it with 2.5.2 and replaced the installed one with this. Anyway, I couldn't import AppKit and relevant ones from the terminal. In XCode 3.0, when I debug project file (just I used template), it says Xcode could not locate source file: pythonrun.c (line: 851) ... What did I do wrong? Thanks in advance, -Dongpyo ===== Dongpyo Hong Research Assistant GIST U-VR Lab http://uvr.gist.ac.kr http://uvr.gist.ac.kr/~dhong Tel. +82-62-970-3157 (2279) Fax. +82-62-970-2204 Email. dhong at gist.ac.kr or dongpyo.hong at gmail.com ===== -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080328/2685ee20/attachment.htm From ronaldoussoren at mac.com Fri Mar 28 11:44:11 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Fri, 28 Mar 2008 03:44:11 -0700 Subject: [Pythonmac-SIG] Import AppKit (pyobjc) and Cocoa-Python Debug Error In-Reply-To: <4E80B551-524D-487F-A311-6C46E557AD99@gist.ac.kr> References: <4E80B551-524D-487F-A311-6C46E557AD99@gist.ac.kr> Message-ID: <68A152F2-0118-1000-89CC-A4A3BF37D407-Webmail-10023@mac.com> On Friday, March 28, 2008, at 11:40AM, "Dongpyo Hong" wrote: >Hi all, > >I am not sure whether this issue was already dealt in here. > >XCode 3.0 already included python 2.5.1 (I think), and I updated it >with 2.5.2 >and replaced the installed one with this. What exactly did you do? Have you replaced /System/Library/Frameworks/Python.framework by another version or did you install the python-2.5.2 DMG from python.org (which installs the framework in /Library/Frameworks)? The former is not supported at all, and if you have removed /System/Library/Frameworks/Python.framework you have hosed your system and likely need to reinstall. Ronald From dhong at gist.ac.kr Fri Mar 28 12:01:56 2008 From: dhong at gist.ac.kr (Dongpyo Hong) Date: Sat, 29 Mar 2008 00:01:56 +1300 Subject: [Pythonmac-SIG] Import AppKit (pyobjc) and Cocoa-Python Debug Error In-Reply-To: <68A152F2-0118-1000-89CC-A4A3BF37D407-Webmail-10023@mac.com> References: <4E80B551-524D-487F-A311-6C46E557AD99@gist.ac.kr> <68A152F2-0118-1000-89CC-A4A3BF37D407-Webmail-10023@mac.com> Message-ID: I installed the python-2.5.2 dmg from pythong.org and yes it installed /Library/Frameworks/... And I copied it to /System/Library/Frameworks/.. (I removed / System/... at first, and copied /Library/...) Hmm... reinstall? which one? XCode or Leopard ? By the way, why I cannot import AppKit and other stuffs? It is because of the deletion? --Dongpyo On Mar 28, 2008, at 11:44 PM, Ronald Oussoren wrote: > > > On Friday, March 28, 2008, at 11:40AM, "Dongpyo Hong" > wrote: >> Hi all, >> >> I am not sure whether this issue was already dealt in here. >> >> XCode 3.0 already included python 2.5.1 (I think), and I updated it >> with 2.5.2 >> and replaced the installed one with this. > > What exactly did you do? Have you replaced /System/Library/ > Frameworks/Python.framework by another version or did you install > the python-2.5.2 DMG from python.org (which installs the framework > in /Library/Frameworks)? > > The former is not supported at all, and if you have removed /System/ > Library/Frameworks/Python.framework you have hosed your system and > likely need to reinstall. > > Ronald > > ===== Dongpyo Hong Research Assistant GIST U-VR Lab http://uvr.gist.ac.kr http://uvr.gist.ac.kr/~dhong Tel. +82-62-970-3157 (2279) Fax. +82-62-970-2204 Email. dhong at gist.ac.kr or dongpyo.hong at gmail.com ===== -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080329/8ab67c03/attachment.htm From ronaldoussoren at mac.com Fri Mar 28 12:29:50 2008 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Fri, 28 Mar 2008 04:29:50 -0700 Subject: [Pythonmac-SIG] Import AppKit (pyobjc) and Cocoa-Python Debug Error In-Reply-To: References: <4E80B551-524D-487F-A311-6C46E557AD99@gist.ac.kr> <68A152F2-0118-1000-89CC-A4A3BF37D407-Webmail-10023@mac.com> Message-ID: <68A152F2-0118-1000-8A17-A4A3BF37D407-Webmail-10023@mac.com> On Friday, March 28, 2008, at 12:02PM, "Dongpyo Hong" wrote: >I installed the python-2.5.2 dmg from pythong.org and yes it >installed /Library/Frameworks/... >And I copied it to /System/Library/Frameworks/.. (I removed / >System/... at first, and copied /Library/...) > >Hmm... reinstall? which one? XCode or Leopard ? You'll have to reinstall at least part of Leopard, Python is used by the system (earlier versions used Python in the PDF workflow, on OSX 10.5 server some components are written in Python, ...). As a general rule you should never replace components of the OS in the /System tree (and likewise for the unixy bits in /usr), that part of the system is "owned" by Apple and does not contain user-serviceable parts. > >By the way, why I cannot import AppKit and other stuffs? It is because >of the deletion? Yes, the AppKit and other bits are not part of the normal Python distribution, but are addons. Ronald > >--Dongpyo >On Mar 28, 2008, at 11:44 PM, Ronald Oussoren wrote: > >> >> >> On Friday, March 28, 2008, at 11:40AM, "Dongpyo Hong" > > wrote: >>> Hi all, >>> >>> I am not sure whether this issue was already dealt in here. >>> >>> XCode 3.0 already included python 2.5.1 (I think), and I updated it >>> with 2.5.2 >>> and replaced the installed one with this. >> >> What exactly did you do? Have you replaced /System/Library/ >> Frameworks/Python.framework by another version or did you install >> the python-2.5.2 DMG from python.org (which installs the framework >> in /Library/Frameworks)? >> >> The former is not supported at all, and if you have removed /System/ >> Library/Frameworks/Python.framework you have hosed your system and >> likely need to reinstall. >> >> Ronald >> >> > >===== >Dongpyo Hong >Research Assistant >GIST U-VR Lab http://uvr.gist.ac.kr >http://uvr.gist.ac.kr/~dhong >Tel. +82-62-970-3157 (2279) >Fax. +82-62-970-2204 >Email. dhong at gist.ac.kr or dongpyo.hong at gmail.com >===== > > > > > > > From rpyle at post.harvard.edu Fri Mar 28 21:35:22 2008 From: rpyle at post.harvard.edu (Robert Pyle) Date: Fri, 28 Mar 2008 16:35:22 -0400 Subject: [Pythonmac-SIG] ASTranslate and appscript question Message-ID: <87E0DE88-4181-47A9-A7EA-D473B5BBCB90@post.harvard.edu> Hi, From a python program, I'm trying to set the input and output gains of a USB audio interface (M-Audio Transit). Using ASTranslate, I've been able to write appscript code to manipulate the "Sound" preference panel of "System Preferences" to find and make note of the current sound input and output devices, select the Transit as the default device, and then restore the prior default device (which may or may not be the Transit). What I can't do so far is figure out how to set the gain while the Transit is selected. When the Transit is the selected default device, this AppleScript sets the gains as I want: --------- tell application "Finder" set volume output volume 100 set volume input volume 35 end tell --------- which ASTranslate renders as: --------- Untranslated event 'aevtstvl' Untranslated event 'ascrgdut' Untranslated event 'aevtstvl' Untranslated event 'aevtstvl' --------- Running the AppleScript twice in a row gives only two 'aevtstvl' events (I'm guessing the last two), without the 'ascrgdut'. Can anyone help me to produce appropriate appscript code? Examples? Documentation? (I've looked at everything I can find.) Thanks. Bob Pyle From hengist.podd at virgin.net Fri Mar 28 22:36:55 2008 From: hengist.podd at virgin.net (has) Date: Fri, 28 Mar 2008 21:36:55 +0000 Subject: [Pythonmac-SIG] Sending files to the trash Message-ID: <1A9CD4D6-430E-4525-924A-F614C53C3C3E@virgin.net> Alex MacCaw wrote: > I'm making a cross platform script that sends files to the trash (or > recycle bin), but am having trouble with the applescript version: > > Here's the applescript which I'm trying to generate: > > tell application "Finder" > move path to the trash > end tell > > And the py-appscript version (which doesn't work): > > app('Finder').move(os.path.abspath(path), to=k.trash) > > Can anyone give me any pointers on how to get the appscript version > working? Couple of things: - The 'to' argument should be a reference, not a constant. - Finder expects an HFS path string, alias object, or Finder reference. Python uses POSIX path strings. Example solution: from appscript import * import mactypes f = mactypes.Alias(os.path.abspath(path)) app('Finder').move(f, to=app.trash) If you're new to appscript but familiar with AppleScript, ASTranslate can provide helpful hints when translating AppleScript commands to their appscript equivalents: http://appscript.sourceforge.net/tools.html HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From nad at acm.org Fri Mar 28 22:38:54 2008 From: nad at acm.org (Ned Deily) Date: Fri, 28 Mar 2008 14:38:54 -0700 Subject: [Pythonmac-SIG] Sending files to the trash References: <75872ED4-2E2F-43F0-AD9B-05E8D3DB0CA8@gmail.com> Message-ID: In article <75872ED4-2E2F-43F0-AD9B-05E8D3DB0CA8 at gmail.com>, Alex MacCaw wrote: > Here's the applescript which I'm trying to generate: > > tell application "Finder" > move path to the trash > end tell > > And the py-appscript version (which doesn't work): > > app('Finder').move(os.path.abspath(path), to=k.trash) > > Can anyone give me any pointers on how to get the appscript version > working? With a current appscript, try this: app('Finder').move(mactypes.Alias(os.path.abspath(path)), to=its.trash) -- Ned Deily, nad at acm.org From hengist.podd at virgin.net Fri Mar 28 22:51:15 2008 From: hengist.podd at virgin.net (has) Date: Fri, 28 Mar 2008 21:51:15 +0000 Subject: [Pythonmac-SIG] ASTranslate and appscript question Message-ID: <92795925-AEB0-4DD9-ACED-B8D434A90002@virgin.net> Robert Pyle wrote: > What I can't do so far is figure out how to set the gain while the > Transit is selected. When the Transit is the selected default device, > this AppleScript sets the gains as I want: > > --------- > tell application "Finder" > set volume output volume 100 > set volume input volume 35 > end tell > --------- 'set volume' is a Standard Additions command, not a Finder command. ASTranslate only translates application commands; scripting addition commands aren't currently supported. You'll need to export the Standard Additions dictionary using ASDictionary and translate the original AppleScript commands yourself. Anyway, the following code should work (you don't need to target the Finder for this, btw; the current process will do fine): import osax sa = osax.ScriptingAddition() sa.set_volume(output_volume=100) sa.set_volume(input_volume=35) HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From nad at acm.org Fri Mar 28 23:24:18 2008 From: nad at acm.org (Ned Deily) Date: Fri, 28 Mar 2008 15:24:18 -0700 Subject: [Pythonmac-SIG] ASTranslate and appscript question References: <87E0DE88-4181-47A9-A7EA-D473B5BBCB90@post.harvard.edu> Message-ID: In article <87E0DE88-4181-47A9-A7EA-D473B5BBCB90 at post.harvard.edu>, Robert Pyle wrote: > From a python program, I'm trying to set the input and output gains > of a USB audio interface (M-Audio Transit). Using ASTranslate, I've > been able to write appscript code to manipulate the "Sound" preference > panel of "System Preferences" to find and make note of the current > sound input and output devices, select the Transit as the default > device, and then restore the prior default device (which may or may > not be the Transit). > > What I can't do so far is figure out how to set the gain while the > Transit is selected. When the Transit is the selected default device, > this AppleScript sets the gains as I want: > > --------- > tell application "Finder" > set volume output volume 100 > set volume input volume 35 > end tell > --------- "set volume" is not a Finder command, rather it is provided by the StandardAdditions scripting addition (an "osax"). You can see this in Script Editor.app by looking at their dictionaries (and the above applescript commands would work outside of a tell block, too). The osax module of py-appscript provides a way to call scripting additions. So, something like this should work: import osax sa = osax.ScriptingAddition() # default is StandardAdditions sa.set_volume(output_volume=100, input_volume=35) If you have ASDictionary.app installed, you can look at the appscript/osax syntax of StandardAdditions easily by its menu item: Dictionary -> Choose Installed Scripting Additions... -- Ned Deily, nad at acm.org From dhong at gist.ac.kr Sat Mar 29 05:11:46 2008 From: dhong at gist.ac.kr (Dongpyo Hong) Date: Sat, 29 Mar 2008 17:11:46 +1300 Subject: [Pythonmac-SIG] [Help] Where is objc (PyObjc) in Leopard? Message-ID: <79e954dd0803282111q5c04bb9t7d9f6c0524979cec@mail.gmail.com> Dear all, I need some explanation why it is that. A few days ago, I downloaded python 2.5.2 for Mac OS X, and installed it. It goes to /Library/Frameworks/.... And I found that Leopard already had one 2.5.1 in /System/Library/Frameworks/... I didn't want to have both, thus I replaced python.framework folder in /System with python.framework fold in /Library/ It did work well until I imported objc or kinds of things. It cannot import them at all. Anyway, now I reinstalled Leopard again :-( Yes, it works fine. It can import objc and so on. Where are they in Leopard? and it is not possible to use objc with new version of python. Still I found not found objc in Leopard. Anyone can explain this? Thanks -- Dongpyo -- === Dongpyo Hong, Research Assistant 500-712 Oryong-dong Buk-gu Gwangju, Korea GIST U-VR Lab http://uvr.gist.ac.kr http://uvr.gist.ac.kr/~dhong e-mail: dhong at gist.ac.kr Tel: +82-62-970-3157 (2279) Fax: +82-62-970-2204 === -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080329/d2eed8af/attachment.htm From stewart at midwinter.ca Sun Mar 30 17:53:11 2008 From: stewart at midwinter.ca (Stewart Midwinter) Date: Sun, 30 Mar 2008 09:53:11 -0600 Subject: [Pythonmac-SIG] expat.py broken in Python 2.5 Message-ID: In the lastest python 2.5 build for Macintosh, the pyexpat module binary is not available to Mac users with Intel processors. If you try to import it, you get an error saying that the binary is for PPC architecture only. This is a bug introduced in Python 2.5, since it does not exist in Python 2.4. How can we go about fixing this? File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/_xmlplus/parsers/expat.py", line 4, in from pyexpat import * ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/_xmlplus/parsers/pyexpat.so, 2): no suitable image found. Did find: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/_xmlplus/parsers/pyexpat.so: mach-o, but wrong architecture thanks S -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080330/d1d4bdd3/attachment.htm From nad at acm.org Mon Mar 31 00:10:43 2008 From: nad at acm.org (Ned Deily) Date: Sun, 30 Mar 2008 15:10:43 -0700 Subject: [Pythonmac-SIG] expat.py broken in Python 2.5 References: Message-ID: In article , "Stewart Midwinter" wrote: > In the lastest python 2.5 build for Macintosh, the pyexpat module binary is > not available to Mac users with Intel processors. If you try to import it, > you get an error saying that the binary is for PPC architecture only. This > is a bug introduced in Python 2.5, since it does not exist in Python 2.4. > > How can we go about fixing this? > > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages > /_xmlplus/parsers/expat.py", > line 4, in > from pyexpat import * > ImportError: > dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-pa > ckages/_xmlplus/parsers/pyexpat.so, > 2): no suitable image found. Did find: > > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ > _xmlplus/parsers/pyexpat.so: > mach-o, but wrong architecture Note the path. The module being imported is from site-packages, not the standard library. Looks like you have an old third-party xml package installed that's being loaded instead of the standard one. -- Ned Deily, nad at acm.org From hendricks52 at gmail.com Mon Mar 31 23:04:23 2008 From: hendricks52 at gmail.com (Derrick Hendricks) Date: Mon, 31 Mar 2008 17:04:23 -0400 Subject: [Pythonmac-SIG] Trouble with py2app not building standalone on 10.5 Leopard Message-ID: I am using py2app 0.3.6 installed using easy install on my 10.5 Leopard distribution. I am trying to package a piece of software into a completely stand alone app so I can distribute it to other mac users. Currently, I'm using 10.5Leopard and am not having much luck. When creating this app, the python that gets added to the Contents/MacOS is a link to: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python While this will work for just about all stock 10.5 computers, this will not work for anything that doesn't have python 2.5 installed, and I need to package this for 10.3 and 10.4 for both PPC and i386 also, and these machines do not have python 2.5 unless they were added later. I did not use the -s switch that is supposed to create a semi-standalone app and I did not tell it to skip macholib. Also, I have run the macho_standalone separately and that has not yielded any better results. Simply copying the python interpreter into the directory doesn't work either as it fails with a module traceback not found error. What I need is a way to completely include the interpreter and everything that it needs into the app bundle. Any help on this matter is appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20080331/04ab76e6/attachment.htm From kw at codebykevin.com Mon Mar 31 23:36:07 2008 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 31 Mar 2008 17:36:07 -0400 Subject: [Pythonmac-SIG] Trouble with py2app not building standalone on 10.5 Leopard In-Reply-To: References: Message-ID: <47F15947.6070508@codebykevin.com> Derrick Hendricks wrote: > I am trying to package a piece of software into a completely stand alone app > so I can distribute it to other mac users. Currently, I'm using > 10.5Leopard and am not having much luck. When creating this app, the > python > that gets added to the Contents/MacOS is a link to: > /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python > > > While this will work for just about all stock 10.5 computers, this will not > work for anything that doesn't have python 2.5 installed, and I need to > package this for 10.3 and 10.4 for both PPC and i386 also, and these > machines do not have python 2.5 unless they were added later. > > py2app doesn't bundle the Python installed with OS X in /System--that's by design. Technically, you really can't redistribute Apple bits. Besides, there's no way that the Apple-installed Python on 10.5 will run on an earlier version of the OS. To get a truly standalone app bundle with py2app, you'll have to use a separate build of Python, and wrap that. You can get this from python.org. I think that build supports 10.3 and up (someone correct me if I'm wrong). -- Kevin Walzer Code by Kevin http://www.codebykevin.com