From Chris.Barker at noaa.gov Mon Jun 1 07:17:42 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Sun, 31 May 2009 22:17:42 -0700 Subject: [Pythonmac-SIG] where do I store my Python programs In-Reply-To: References: <7122b8730905311124h7a75753fi5dcde8f130c47ee3@mail.gmail.com> Message-ID: <4A236476.2070308@noaa.gov> Piet van Oostrum wrote: > Another possibility, after Python-> start interpreter, is > Python->Execute Buffer. For small snippets of code this may be easier, > but for complete programs the shell method may be better. do check out ipython -- it' s a nice way to do this. I wonder if ipython can be the python shell for Aquamacs? That would be slick. beegee beegee wrote: > please suggest what could have gone wrong here why am i getting a syntax > error I think you've got your answer, but I can't help myself. You really want to spell this more like: some_list = [3,6,2,5] for item in some_list: print item, ";" print some_list[3] or even better: ";".join([str(i) for i in some_list]) Welcome to the joy of Python! -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception From martin.laloux at gmail.com Mon Jun 1 08:35:02 2009 From: martin.laloux at gmail.com (genemartin) Date: Sun, 31 May 2009 23:35:02 -0700 (PDT) Subject: [Pythonmac-SIG] Gtk issues In-Reply-To: <786164.38114.qm@web57207.mail.re3.yahoo.com> References: <786164.38114.qm@web57207.mail.re3.yahoo.com> Message-ID: <23810538.post@talk.nabble.com> see my post on installing gtk and pygtk without Macports or Fink. http://www.nabble.com/PyGTK-on-OSX--to21186327.html#a22451916 http://www.nabble.com/PyGTK-on-OSX--to21186327.html#a22451916">PyGTK on OSX? I don't use Fink or MacPorts because I want to compile myself to learn and they interfere : if you try to use libraries from either, you may have problems with version mismatches and library duplication between them and /usr/local or python framework stuff In site-package, i have : - a folder named gtk-2.0 with folders named gtk, gio,glib, gobject and some files pango etc... - a folder named cairo - a file named pygtk.py - a file named pygtk.pth referring to "gtk-2.0" _gtk.so is in site-packages/gtk-2.0/gtk/_gtk.so in /Library/Frameworks/Python.framework/Versions/2.5/lib/ I have a folder named pkgconfig with the files pycairo.pc,pygtk-2.0.pc, pygobject-2.0.pc The file named pygtk-2.0.pc is "prefix=/Library/Frameworks/Python.framework/Versions/2.5 exec_prefix=${prefix} includedir=${prefix}/include datarootdir=@datarootdir@ datadir=${prefix}/share pyexecdir=${exec_prefix}/lib/python2.5/site-packages # you can use the --variable=pygtkincludedir argument to # pkg-config to get this value. You might want to use this to # install additional headers. pygtkincludedir=${includedir}/pygtk-2.0 # same here. Useful when calling the code generator in addon packages. defsdir=${datadir}/pygtk/2.0/defs codegendir=${datadir}/pygtk/2.0/codegen Name: PyGTK Description: Python bindings for GTK+ and related libraries Requires: pygobject-2.0 Version: 2.10.4 Cflags: -I${pygtkincludedir} " I hope this will help -- View this message in context: http://www.nabble.com/Gtk-issues-tp23803508p23810538.html Sent from the Python - pythonmac-sig mailing list archive at Nabble.com. From ronaldoussoren at mac.com Mon Jun 1 08:56:02 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Mon, 01 Jun 2009 08:56:02 +0200 Subject: [Pythonmac-SIG] question about garbage collection with NSApplication.run() In-Reply-To: <85617.1243794860@parc.com> References: <85617.1243794860@parc.com> Message-ID: <0CC9A4E9-43FA-4260-ABD2-326BE49597A1@mac.com> On 31 May, 2009, at 20:34, Bill Janssen wrote: > I'm writing a Python program that has a main that looks like this: > > application = NSApplication.sharedApplication() > > # set up handler for network change notification > SCDynamicStoreSetNotificationKeys(DYNSTORE, None, > [NETWORK_KEY,]) > # Get a CFRunLoopSource for our store session and add it to > the application's runloop: > CFRunLoopAddSource( > NSRunLoop.currentRunLoop().getCFRunLoop(), > SCDynamicStoreCreateRunLoopSource(None, DYNSTORE, 0), > kCFRunLoopCommonModes > ) > > # add a timer for application scan events > timer = > NSTimer > .scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_( > periodicity, scanner, objc.selector(scanner.scan, > signature="v@:"), None, True) > > # using an NSRunLoop avoids Activity Monitor complaining > about "not responding" > application.run() > > Do I need to do anything about NSAutoreleasePools? My understanding > is > that this is single-threaded, and that NSApplication.run will handle > periodic drainage of the default main thread release pool. That's right. NSApplication.run manages the the pool for you. You only have to worry about autorelease pools when you create new threads running Cocoa code, and when you a long time without looping through the eventloop. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2224 bytes Desc: not available URL: From piet at cs.uu.nl Mon Jun 1 15:33:37 2009 From: piet at cs.uu.nl (Piet van Oostrum) Date: Mon, 01 Jun 2009 15:33:37 +0200 Subject: [Pythonmac-SIG] where do I store my Python programs In-Reply-To: <4A236476.2070308@noaa.gov> (Christopher Barker's message of "Sun\, 31 May 2009 22\:17\:42 -0700") References: <7122b8730905311124h7a75753fi5dcde8f130c47ee3@mail.gmail.com> <4A236476.2070308@noaa.gov> Message-ID: >>>>> Christopher Barker (CB) wrote: >CB> Piet van Oostrum wrote: >>> Another possibility, after Python-> start interpreter, is Python->Execute >>> Buffer. For small snippets of code this may be easier, >>> but for complete programs the shell method may be better. >CB> do check out ipython -- it' s a nice way to do this. I wonder if ipython >CB> can be the python shell for Aquamacs? That would be slick. Yes, it can be, but it doesn't come pre-installed. I was also thinking of this option (I use ipython myself on Carbon Emacs) but I thought installing it may be too difficult for somebody who doesn't even know how to spell Aquamacs :=) -- Piet van Oostrum URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: piet at vanoostrum.org From janssen at parc.com Mon Jun 1 17:16:05 2009 From: janssen at parc.com (Bill Janssen) Date: Mon, 1 Jun 2009 08:16:05 PDT Subject: [Pythonmac-SIG] question about garbage collection with NSApplication.run() In-Reply-To: <0CC9A4E9-43FA-4260-ABD2-326BE49597A1@mac.com> References: <85617.1243794860@parc.com> <0CC9A4E9-43FA-4260-ABD2-326BE49597A1@mac.com> Message-ID: <98843.1243869365@parc.com> Thanks, Ronald. Bill Ronald Oussoren wrote: > > On 31 May, 2009, at 20:34, Bill Janssen wrote: > > > I'm writing a Python program that has a main that looks like this: > > > > application = NSApplication.sharedApplication() > > > > # set up handler for network change notification > > SCDynamicStoreSetNotificationKeys(DYNSTORE, None, > > [NETWORK_KEY,]) > > # Get a CFRunLoopSource for our store session and add it to > > the application's runloop: > > CFRunLoopAddSource( > > NSRunLoop.currentRunLoop().getCFRunLoop(), > > SCDynamicStoreCreateRunLoopSource(None, DYNSTORE, 0), > > kCFRunLoopCommonModes > > ) > > > > # add a timer for application scan events > > timer = NSTimer > > .scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_( > > periodicity, scanner, objc.selector(scanner.scan, > > signature="v@:"), None, True) > > > > # using an NSRunLoop avoids Activity Monitor complaining > > about "not responding" > > application.run() > > > > Do I need to do anything about NSAutoreleasePools? My understanding > > is > > that this is single-threaded, and that NSApplication.run will handle > > periodic drainage of the default main thread release pool. > > That's right. NSApplication.run manages the the pool for you. You only > have to worry about autorelease pools when you create new threads > running Cocoa code, and when you a long time without looping through > the eventloop. > > Ronald > From hengist.podd at virgin.net Mon Jun 1 22:19:01 2009 From: hengist.podd at virgin.net (has) Date: Mon, 1 Jun 2009 21:19:01 +0100 Subject: [Pythonmac-SIG] Can't get ASDictionary to work (py2app problems?) In-Reply-To: References: Message-ID: Nicholas Riley wrote: > I'm trying to use appscript on my MacBook Pro running OS X 10.5.7 and > the stock Apple Python. It's never had appscript installed before. > However, I can't get the binary ASDictionary I downloaded to run: > > Traceback (most recent call last): > File "/Developer/Applications/appscript/ASDictionary.app/Contents/ > Resources/__boot__.py", line 31, in > _run('ASDictionary.py') > File "/Developer/Applications/appscript/ASDictionary.app/Contents/ > Resources/__boot__.py", line 28, in _run > execfile(path, globals(), globals()) > File "/Developer/Applications/appscript/ASDictionary.app/Contents/ > Resources/ASDictionary.py", line 17, in > import osax, appscript, mactypes > File "build/bdist.macosx-10.3-i386/egg/osax.py", line 38, in > > File "build/bdist.macosx-10.3-i386/egg/aem/aemsend.py", line 82, > in send > aem.aemsend.EventError: Command failed: Application could not > handle this command. (-1708) > 2009-05-31 15:42:43.946 ASDictionary[4551:10b] ASDictionary Error > 2009-05-31 15:42:43.948 ASDictionary[4551:10b] ASDictionary Error > An unexpected error has occurred during execution of the main script Odd. The osax module appears to be puking on a System Events command (it uses SE to get a list of installed osaxen). What versions of appscript and ASDictionary? What happens if you try to import the osax module into a regular script? Anything unusual about your setup (permissions, haxies, etc.)? PyObjC/py2app questions I'll leave to those that know more about these things. (FWIW, I build ASDictionary using user-installed Python 2.5.2 framework + PyObjC 1.x for portability.) has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From janssen at parc.com Tue Jun 2 02:14:33 2009 From: janssen at parc.com (Bill Janssen) Date: Mon, 1 Jun 2009 17:14:33 PDT Subject: [Pythonmac-SIG] Building a debug framework build of Python Message-ID: <17466.1243901673@parc.com> I'd like to be able to connect to my Python programs, mainly long-running servers, and see what's going on in specific threads. To do that, I need a version of Python that's compiled with debug symbols in it. What's the correct invocation to build a debug version of Python (2.5) which matches what ships with OS X 10.5.7? I don't intend to replace the system Python; I just want to match it as closely as possible for debugging. Bill From njriley at uiuc.edu Tue Jun 2 07:11:45 2009 From: njriley at uiuc.edu (Nicholas Riley) Date: Tue, 2 Jun 2009 00:11:45 -0500 Subject: [Pythonmac-SIG] Can't get ASDictionary to work (py2app problems?) In-Reply-To: References: Message-ID: <20090602051145.GA25151@uiuc.edu> On Mon, Jun 01, 2009 at 09:19:01PM +0100, has wrote: > Odd. The osax module appears to be puking on a System Events command > (it uses SE to get a list of installed osaxen). What versions of > appscript and ASDictionary? What happens if you try to import the osax > module into a regular script? Anything unusual about your setup > (permissions, haxies, etc.)? Gah, I should have thought of this. I've got Default Folder X installed, which loads itself by pretending to be an osax. When I disabled it, ASDictionary opened successfully. I'll report it as a bug in Default Folder X. > PyObjC/py2app questions I'll leave to those that know more about these > things. (FWIW, I build ASDictionary using user-installed Python 2.5.2 > framework + PyObjC 1.x for portability.) Anyone (Ronald?) have any idea about these problems? They're less important given that I have a fix for my ASDictionary issue, but still seem pretty serious. Thanks, -- Nicholas Riley x From ronaldoussoren at mac.com Tue Jun 2 08:55:53 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 02 Jun 2009 08:55:53 +0200 Subject: [Pythonmac-SIG] Building a debug framework build of Python In-Reply-To: <17466.1243901673@parc.com> References: <17466.1243901673@parc.com> Message-ID: <2073C79F-1040-467C-9BC4-3B93DCC05781@mac.com> Apple has the sources of the open-source components of OSX on their website, the python bits for 10.5.7 are here: http://www.opensource.apple.com/source/python/python-30.1.3/ . I haven't checked if this includes the configure invocation, although you could always use distutils to query the value of 'CONFIG_ARGS' . Ronald On 2 Jun, 2009, at 2:14, Bill Janssen wrote: > I'd like to be able to connect to my Python programs, mainly > long-running servers, and see what's going on in specific threads. To > do that, I need a version of Python that's compiled with debug symbols > in it. What's the correct invocation to build a debug version of > Python > (2.5) which matches what ships with OS X 10.5.7? > > I don't intend to replace the system Python; I just want to match > it as closely as possible for debugging. > > Bill > _______________________________________________ > 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: From ronaldoussoren at mac.com Tue Jun 2 08:58:35 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 02 Jun 2009 08:58:35 +0200 Subject: [Pythonmac-SIG] Can't get ASDictionary to work (py2app problems?) In-Reply-To: <20090602051145.GA25151@uiuc.edu> References: <20090602051145.GA25151@uiuc.edu> Message-ID: <7C46C7BA-5FA7-4C09-9B31-C723D11AD34B@mac.com> On 2 Jun, 2009, at 7:11, Nicholas Riley wrote: > On Mon, Jun 01, 2009 at 09:19:01PM +0100, has wrote: >> Odd. The osax module appears to be puking on a System Events command >> (it uses SE to get a list of installed osaxen). What versions of >> appscript and ASDictionary? What happens if you try to import the >> osax >> module into a regular script? Anything unusual about your setup >> (permissions, haxies, etc.)? > > Gah, I should have thought of this. I've got Default Folder X > installed, which loads itself by pretending to be an osax. When I > disabled it, ASDictionary opened successfully. I'll report it as a > bug in Default Folder X. > >> PyObjC/py2app questions I'll leave to those that know more about >> these >> things. (FWIW, I build ASDictionary using user-installed Python 2.5.2 >> framework + PyObjC 1.x for portability.) > > Anyone (Ronald?) have any idea about these problems? They're less > important given that I have a fix for my ASDictionary issue, but still > seem pretty serious. I don't have time to look into the py2app issues right now. That said, I wouldn't install a new version of pyobjc in the system install of python because this might break other bits of the system. Ronald > > Thanks, > > -- > Nicholas Riley > x > _______________________________________________ > 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: From njriley at uiuc.edu Tue Jun 2 09:33:30 2009 From: njriley at uiuc.edu (Nicholas Riley) Date: Tue, 2 Jun 2009 02:33:30 -0500 Subject: [Pythonmac-SIG] Can't get ASDictionary to work (py2app problems?) In-Reply-To: References: Message-ID: <20090602073330.GA9573@uiuc.edu> To bring a (temporary) conclusion to all of this, the reason I upgraded the system version of py2app (or rather its dependency, modulegraph) was that it was incompatible with the current version of setuptools (0.7a1). I think this is actually a setuptools bug, which I've reported: After removing my compiled versions of PyObjC, py2app, modulegraph *and* setuptools, then installing aemreceive, osaterminology and HTMLTemplate, ASDictionary built and runs fine against the stock 10.5 Python/PyObjC/py2app. That was painful, but hopefully this thread means nobody else will have to go through it :-) -- Nicholas Riley From njriley at uiuc.edu Tue Jun 2 09:18:46 2009 From: njriley at uiuc.edu (Nicholas Riley) Date: Tue, 2 Jun 2009 02:18:46 -0500 Subject: [Pythonmac-SIG] Can't get ASDictionary to work (py2app problems?) In-Reply-To: <7C46C7BA-5FA7-4C09-9B31-C723D11AD34B@mac.com> References: <20090602051145.GA25151@uiuc.edu> <7C46C7BA-5FA7-4C09-9B31-C723D11AD34B@mac.com> Message-ID: <2737CDC8-56E0-48FC-A26D-6650C4D3E3C7@uiuc.edu> On Jun 2, 2009, at 1:58 AM, Ronald Oussoren wrote: > I don't have time to look into the py2app issues right now. That > said, I wouldn't install a new version of pyobjc in the system > install of python because this might break other bits of the system. Thanks for the warning - you may want to make this clear in big letters on the PyObjC Web site. --Nicholas From janssen at parc.com Tue Jun 2 17:26:50 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 2 Jun 2009 08:26:50 PDT Subject: [Pythonmac-SIG] Building a debug framework build of Python In-Reply-To: <2073C79F-1040-467C-9BC4-3B93DCC05781@mac.com> References: <17466.1243901673@parc.com> <2073C79F-1040-467C-9BC4-3B93DCC05781@mac.com> Message-ID: <27995.1243956410@parc.com> Thanks, Ronald. It looks to me as if MacPython already includes the -g flags appropriately (at least build-script.py does); could I just download 2.5.4 from python.org and use that for debugging? Bill Ronald Oussoren wrote: > Apple has the sources of the open-source components of OSX on their > website, the python bits for 10.5.7 are here: > http://www.opensource.apple.com/source/python/python-30.1.3/ . > > I haven't checked if this includes the configure invocation, although > you could always use distutils to query the value of 'CONFIG_ARGS' . > > Ronald > > On 2 Jun, 2009, at 2:14, Bill Janssen wrote: > > > I'd like to be able to connect to my Python programs, mainly > > long-running servers, and see what's going on in specific threads. To > > do that, I need a version of Python that's compiled with debug symbols > > in it. What's the correct invocation to build a debug version of > > Python > > (2.5) which matches what ships with OS X 10.5.7? > > > > I don't intend to replace the system Python; I just want to match > > it as closely as possible for debugging. > > > > Bill > > _______________________________________________ > > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > > http://mail.python.org/mailman/listinfo/pythonmac-sig > From ronaldoussoren at mac.com Tue Jun 2 17:51:23 2009 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 2 Jun 2009 17:51:23 +0200 Subject: [Pythonmac-SIG] Building a debug framework build of Python In-Reply-To: <27995.1243956410@parc.com> References: <17466.1243901673@parc.com> <2073C79F-1040-467C-9BC4-3B93DCC05781@mac.com> <27995.1243956410@parc.com> Message-ID: <351FFA94-1BD7-4919-8DE0-15772E9916F6@mac.com> On 2 Jun, 2009, at 17:26, Bill Janssen wrote: > Thanks, Ronald. > > It looks to me as if MacPython already includes the -g flags > appropriately (at least build-script.py does); could I just download > 2.5.4 from python.org and use that for debugging? Not necessarily. Apple's version of python includes a number of patches, some of which will affect the debug symbols (such as some support for dtrace). What I tend to do when I need to debug C code is to develop using the python.org installer which, as you mentioned, contains debugging symbols. The resulting C code should then work fine with the Apple installation of python. For really annoying bugs I have yet another seperate installation that was compiled using --with-pydebug, this tends to be the most helpful when dealing with refcounting bugs in C extensions. Ronald > > Bill > > > Ronald Oussoren wrote: > >> Apple has the sources of the open-source components of OSX on their >> website, the python bits for 10.5.7 are here: >> http://www.opensource.apple.com/source/python/python-30.1.3/ . >> >> I haven't checked if this includes the configure invocation, although >> you could always use distutils to query the value of 'CONFIG_ARGS' . >> >> Ronald >> >> On 2 Jun, 2009, at 2:14, Bill Janssen wrote: >> >>> I'd like to be able to connect to my Python programs, mainly >>> long-running servers, and see what's going on in specific >>> threads. To >>> do that, I need a version of Python that's compiled with debug >>> symbols >>> in it. What's the correct invocation to build a debug version of >>> Python >>> (2.5) which matches what ships with OS X 10.5.7? >>> >>> I don't intend to replace the system Python; I just want to match >>> it as closely as possible for debugging. >>> >>> Bill >>> _______________________________________________ >>> 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: From janssen at parc.com Tue Jun 2 18:18:41 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 2 Jun 2009 09:18:41 PDT Subject: [Pythonmac-SIG] Building a debug framework build of Python In-Reply-To: <351FFA94-1BD7-4919-8DE0-15772E9916F6@mac.com> References: <17466.1243901673@parc.com> <2073C79F-1040-467C-9BC4-3B93DCC05781@mac.com> <27995.1243956410@parc.com> <351FFA94-1BD7-4919-8DE0-15772E9916F6@mac.com> Message-ID: <29421.1243959521@parc.com> Actually, I'm debugging Python code, but it's running in a multi-threaded Python server. So I need to attach with gdb to see what's going on. It would be nice if "Thread Viewer" had the ability to decode Python stack traces. Thanks for the info. I'll try building using the Apple sources. Bill Ronald Oussoren wrote: > > On 2 Jun, 2009, at 17:26, Bill Janssen wrote: > > > Thanks, Ronald. > > > > It looks to me as if MacPython already includes the -g flags > > appropriately (at least build-script.py does); could I just download > > 2.5.4 from python.org and use that for debugging? > > Not necessarily. Apple's version of python includes a number of > patches, some of which will affect the debug symbols (such as some > support for dtrace). > > What I tend to do when I need to debug C code is to develop using the > python.org installer which, as you mentioned, contains debugging > symbols. The resulting C code should then work fine with the Apple > installation of python. For really annoying bugs I have yet another > seperate installation that was compiled using --with-pydebug, this > tends to be the most helpful when dealing with refcounting bugs in C > extensions. > > Ronald > > > > > Bill > > > > > > Ronald Oussoren wrote: > > > >> Apple has the sources of the open-source components of OSX on their > >> website, the python bits for 10.5.7 are here: > >> http://www.opensource.apple.com/source/python/python-30.1.3/ . > >> > >> I haven't checked if this includes the configure invocation, although > >> you could always use distutils to query the value of 'CONFIG_ARGS' . > >> > >> Ronald > >> > >> On 2 Jun, 2009, at 2:14, Bill Janssen wrote: > >> > >>> I'd like to be able to connect to my Python programs, mainly > >>> long-running servers, and see what's going on in specific threads. > >>> To > >>> do that, I need a version of Python that's compiled with debug > >>> symbols > >>> in it. What's the correct invocation to build a debug version of > >>> Python > >>> (2.5) which matches what ships with OS X 10.5.7? > >>> > >>> I don't intend to replace the system Python; I just want to match > >>> it as closely as possible for debugging. > >>> > >>> Bill > >>> _______________________________________________ > >>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org > >>> http://mail.python.org/mailman/listinfo/pythonmac-sig > >> > From santagada at gmail.com Tue Jun 2 20:13:43 2009 From: santagada at gmail.com (Leonardo Santagada) Date: Tue, 2 Jun 2009 15:13:43 -0300 Subject: [Pythonmac-SIG] Building a debug framework build of Python In-Reply-To: <29421.1243959521@parc.com> References: <17466.1243901673@parc.com> <2073C79F-1040-467C-9BC4-3B93DCC05781@mac.com> <27995.1243956410@parc.com> <351FFA94-1BD7-4919-8DE0-15772E9916F6@mac.com> <29421.1243959521@parc.com> Message-ID: <35B8A964-71CA-48E0-A6EA-45632A0B36AA@gmail.com> On Jun 2, 2009, at 1:18 PM, Bill Janssen wrote: > Actually, I'm debugging Python code, but it's running in a > multi-threaded Python server. So I need to attach with gdb to see > what's going on. It would be nice if "Thread Viewer" had the ability > to decode Python stack traces. > > Thanks for the info. I'll try building using the Apple sources. Is the "server" a multi-threaded python program, using thread or Threading? Then I think you could use rpdb2 or winpdb to debug it. -- Leonardo Santagada santagada at gmail.com From geert at nznl.com Tue Jun 2 21:13:50 2009 From: geert at nznl.com (Geert Dekkers) Date: Tue, 2 Jun 2009 21:13:50 +0200 Subject: [Pythonmac-SIG] Python Core Graphics Question (resent) Message-ID: Hi all (I just resent this message as I couldn't it find it on the digest even after days - again, I apologise for any cross-posting) Below is a piece of code that I found over in the quartz-dev list. I've been using this function unchanged in a batch processor, and it appears to leak memory quite substantially. So much so that my test machine (1Gb memory) , a mac mini, and my production xserve (2 Gb memory) both crashed using it. My dev machine, an imac (4Gb memory) slowed, but stayed up. I think I have the problem down to "croppedimg = srcimg.createWithImageInRect(cliprect)". If used with an image of suffient size, it quickly sucks up all available memory. Has anyone experienced similar problems using this method? Its Obj-C name is "CGContextCreateWithImageInRect". And I should think that one would only see something bad happening in some sort of batch processing. Incidentally, my workaround was to lower the size of the source image. But the process is still quite unstable. It brought down my xserve after processing 7000 of the 7600 odd items. I've pasted the original post below. And sorry for any cross - posting. Cheers, Geert ---------------------------------------------------------------------------------------------- Geert Dekkers Web Studio | 2e Keucheniusstraat 8HS 1051VR Amsterdam | +31(0)627224301 | http://nznl.net ---------------------------------------------------------------------------------------------- >> Thanks for you detailed reply Glen - much appreciated. >> You helped me to solve what i was trying to do by using >> CGImageCreateWithImageinRect as suggested. >> >> For anyone else interested here is some simple python code for >> making cropped thumbnails of any proportion and not loosing the >> aspect ratio of the original image. >> ...and its damn fast! >> >> ----------- #!/usr/bin/python >> >> from __future__ import division import CoreGraphics >> >> def resizeimage(srcimage,targetimage, tw, th): >> >> srcimg = >> CoreGraphics >> .CGImageImport >> (CoreGraphics.CGDataProviderCreateWithFilename(srcimage)) >> >> sw = srcimg.getWidth() >> sh = srcimg.getHeight() >> >> aspect = tw/th >> >> widthfactor = tw/sw >> heightfactor = th/sh >> >> if widthfactor < heightfactor: >> #src height stays the same >> #src width gets cropped >> cropwidth = sh * aspect >> x1 = ((sw-cropwidth)/2) >> y1 = 0 >> x2 = sw-((sw-cropwidth)) >> y2 = sh >> else: >> #src height gets cropped >> #src width stays the same >> cropheight = sw / aspect >> x1 = 0 >> y1 = ((sh-cropheight)/2) >> x2 = sw >> y2 = sh-((sh-cropheight)) >> >> cliprect = CoreGraphics.CGRectMake(x1, y1, x2, y2) >> croppedimg = srcimg.createWithImageInRect(cliprect) >> >> cs = CoreGraphics.CGColorSpaceCreateDeviceRGB() >> c = CoreGraphics.CGBitmapContextCreateWithColor(tw, th, cs, >> (0,0,0,0)) >> >> c.setInterpolationQuality(CoreGraphics.kCGInterpolationLow) >> newRect = CoreGraphics.CGRectMake(0, 0, tw, th) >> c.drawImage(newRect, croppedimg) >> c.writeToFile(targetimage, CoreGraphics.kCGImageFormatJPEG) >> >> resizeimage("/users/adam/Desktop/bootlogo4pa8.jpg", "/users/adam/ >> Desktop/aaaaa.jpg" , 80,80) >> >> >> >> >> >> >> >>> On Aug 12, 2008, at 3:41 AM, Glenn Cole wrote: >>> >>> Hi, Adam -- >>> >>> I'm no expert, but until others more knowledgeable respond, here's >>> my understanding. >>> >>> First, I suspect the fact that you're using Python won't matter at >>> all here. (It does in other circumstances, but I don't think so >>> here.) >>> >>> It sounds like you're looking for more support from Quartz for >>> your task than what's really there. In the end, I think it's going >>> to be more a choice of algorithm on your part. >>> >>> For example, given different aspect ratios, the new image could >>> either: >>> >>> 1. ignore the difference (i.e., the current behaviour) >>> 2. show the entire original image within the new target, >>> respecting the aspect ratio >>> 3. clip the original image to match the new aspect ratio >>> >>> For #2, you could shrink the target rect to match the aspect ratio >>> of the original image. >>> >>> For #3 (your goal), you could clip the original image to match the >>> target aspect ratio. However, page 250 of the outstanding >>> Programming With Quartz notes a few downsides to this, and >>> suggests using CGImageCreateWithImageInRect instead (first >>> available in Tiger) to define a "subimage" of the original image. >>> Again, though, you would need to determine yourself that the >>> subimage should ignore 100 pixels from the left and right sides of >>> the original image. >>> >>> At least, that's my take on things. We'll see what others say >>> (though they've tended to ignore Python questions in the past). >>> >>> Incidentally, the subject line says "Core Image resize question." >>> The code below has no reference to Core Image, and I'm pretty sure >>> that Core Image need not be involved in this task at all. (Perhaps >>> you mentioned Core Image because of the existence of its CICrop >>> filter, but I think that's not the best direction for the task at >>> hand.) >>> >>> --Glenn >>> >>> >>> On Aug 11, 2008, at 5:33 AM, Adam Jones wrote: >>> >>> Hi there i am wondering if someone can help me with this. Below is >>> the code i am using to resize and save a jpeg image. >>> >>> It works mint as but it obviously scales the image with no respect >>> for the aspect ratio. >>> >>> i want to be able to take an image and scale it proportionaly to a >>> square thumbnail. so for example a 800x600 image scaled to 80x80 >>> would need to loose 100pixels off the left and 100 pixels on the >>> right before scaling. >>> >>> Does any one know how to crop using python quartz or can i draw >>> the rec with the image off the canvas to achieve the same? >>> >>> Thanks Adam >>> >>> >>> ----------- #!/usr/bin/python >>> >>> import CoreGraphics >>> >>> def resizeimage(srcimage,targetimage, w, h): >>> >>> origImage = CoreGraphics .CGImageImport >>> (CoreGraphics.CGDataProviderCreateWithFilename(srcimage)) >>> >>> origwidth = origImage.getWidth() # not used yet but will be once i >>> work out how to crop >>> origheight = origImage.getHeight() # not used yet but will be once >>> i work out how to crop >>> >>> cs = CoreGraphics.CGColorSpaceCreateDeviceRGB() >>> c = CoreGraphics.CGBitmapContextCreateWithColor(w, h, cs, (0,0,0,0)) >>> >>> c.setInterpolationQuality(CoreGraphics.kCGInterpolationLow) >>> newRect = CoreGraphics.CGRectMake(0, 0, w, h) >>> c.drawImage(newRect, origImage) >>> c.writeToFile(targetimage, CoreGraphics.kCGImageFormatJPEG) >>> >>> >>> resizeimage(uploadedfile, "/svr/data/images/listings/%s/ >>> %s_160x90.jpg" % (str(listing_id), newimagename), 160,90) >>> >>> ------------- >>> >>> >>> _______________________________________________ Do not post admin >>> requests to the list. They will be ignored. Quartz-dev mailing >>> list (email at hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartz-dev/email at hidden >>> >>> This email sent to email at hidden >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From janssen at parc.com Tue Jun 2 21:23:03 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 2 Jun 2009 12:23:03 PDT Subject: [Pythonmac-SIG] Building a debug framework build of Python In-Reply-To: <35B8A964-71CA-48E0-A6EA-45632A0B36AA@gmail.com> References: <17466.1243901673@parc.com> <2073C79F-1040-467C-9BC4-3B93DCC05781@mac.com> <27995.1243956410@parc.com> <351FFA94-1BD7-4919-8DE0-15772E9916F6@mac.com> <29421.1243959521@parc.com> <35B8A964-71CA-48E0-A6EA-45632A0B36AA@gmail.com> Message-ID: <33767.1243970583@parc.com> Yes, I do use the threading module, but it's not quite that simple. Some of my threads are actually running Java code, for PyLucene. This is part of UpLib, at http://uplib.parc.com/. Thanks for the pointers. Is there a home site for rpdb2? Or is it just part of winpdb? The nice thing about gdb is that it doesn't need to be "on top"; you can attach to a server you started without any magic invocation. UpLib has a complicated startup dance, and it's hard to start it with the kind of invocation needed for debuggers like rpdb2. Bill ---------------------------------------------------------------- THREADING = None HAVE_PYLUCENE = None if "@USE_PYLUCENE@" == "jcc": # make sure the JVM DLL is on our path, a side-effect of finding the JAVAHOME find_JAVAHOME() HAVE_PYLUCENE = "jcc" THREADING = "python" class JavaCapableThread(threading.Thread): def run(self): if uthread.JAVA_ENV: uthread.JAVA_ENV.attachCurrentThread(self.getName(), self.isDaemon()) super(JavaCapableThread, self).run() if uthread.JAVA_ENV: uthread.JAVA_ENV.detachCurrentThread() class uthread: conf = configurator.default_configurator() maxheap = conf.get("java-max-heap", "512m") maxstack = conf.get("java-max-stack", "100m") vmargs = conf.get("java-vm-args", "-Djava.awt.headless=true") def initialize(cls): import lucene cls.JAVA_ENV = lucene.getVMEnv() or lucene.initVM(classpath=lucene.CLASSPATH, vmargs=cls.vmargs, initialheap="64m", maxheap=cls.maxheap, maxstack=cls.maxstack) # make sure we can call in on the main thread cls.JAVA_ENV.attachCurrentThread(threading.currentThread().getName(), threading.currentThread().isDaemon()) initialize=classmethod(initialize) def get_ident(): return repr(threading.currentThread()) get_ident = staticmethod(get_ident) def create_new_thread(name, fn, args): t = JavaCapableThread(None, fn, name, args) note(0, "creating new thread %s", t) t.setDaemon(true) return t create_new_thread=staticmethod(create_new_thread) def start_new_thread(fn, args, name=None): t = JavaCapableThread(None, fn, name, args) note(0, "starting new thread %s", t) t.setDaemon(true) t.start() return t start_new_thread = staticmethod(start_new_thread) def allocate_lock(): return threading.RLock() allocate_lock = staticmethod(allocate_lock) if (not HAVE_PYLUCENE): THREADING = "python" class uthread: def initialize(cls): pass initialize=classmethod(initialize) def get_ident(): return repr(threading.currentThread()) get_ident = staticmethod(get_ident) def create_new_thread(name, fn, args): t = threading.Thread(None, fn, name, args) t.setDaemon(true) note(0, "creating new thread %s", t) return t create_new_thread=staticmethod(create_new_thread) def start_new_thread(fn, args, name=None): t = threading.Thread(None, fn, name, args) t.setDaemon(true) note(0, "starting new thread %s", t) t.start() return t start_new_thread = staticmethod(start_new_thread) def allocate_lock(): return threading.RLock() allocate_lock = staticmethod(allocate_lock) Leonardo Santagada wrote: > On Jun 2, 2009, at 1:18 PM, Bill Janssen wrote: > > > Actually, I'm debugging Python code, but it's running in a > > multi-threaded Python server. So I need to attach with gdb to see > > what's going on. It would be nice if "Thread Viewer" had the ability > > to decode Python stack traces. > > > > Thanks for the info. I'll try building using the Apple sources. > > > Is the "server" a multi-threaded python program, using thread or > Threading? Then I think you could use rpdb2 or winpdb to debug it. > > > -- > Leonardo Santagada > santagada at gmail.com > > > From leknarf at pacbell.net Fri Jun 5 08:04:42 2009 From: leknarf at pacbell.net (Scott Frankel) Date: Thu, 4 Jun 2009 23:04:42 -0700 Subject: [Pythonmac-SIG] Interpreter not initialized Message-ID: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> I'm using py2app for the first time to build a PyQt app. I get the following error msg when I launch the app: Fatal Python error: Interpreter not initialized (version mismatch?) I've downloaded macports and installed its python25, pyqt, &c. I've issued the command, sudo python_select python25, and checked that python25 is selected with python_select -s. From searching the net and the archives, it's likely that the system python is seeping into the build process somewhere. The info I've read says that python_select should take care of the problem. Any other suggestions? Thanks in advance! Scott OSX 10.5.5 py25-py2app-devel @0.4.2_1 MacPorts-1.7.1-10.5-Leopard From blake at hailmail.net Fri Jun 5 08:37:16 2009 From: blake at hailmail.net (Dane Springmeyer) Date: Thu, 4 Jun 2009 23:37:16 -0700 Subject: [Pythonmac-SIG] Interpreter not initialized In-Reply-To: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> References: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> Message-ID: Hey Scott, Essentially the problem results (like you note) from the system python (or some other python version) linking to a macports library. That python version then differs from the python version your are running from the interpreter. In general I've noticed this has been a big problem for macports and python25. Upgrading to python26 from macports often can help. Beyond that trying to figure out exactly what is linking to what is the next step, and the 'otool' command comes in very handy for this. For example, try pointing 'otool' at your pyqt lib like: $ otool -L /opt/local/lib/ The resulting list will likely should linking to the /system python. If you can't upgrade to py26-pyqt then consider filing a bug with macports. The last trick is to use the 'install_name_tool' to actually manually (brute force) fix the linking from the /system python to the macports python. Dane On Jun 4, 2009, at 11:04 PM, Scott Frankel wrote: > > I'm using py2app for the first time to build a PyQt app. I get the > following error msg when I launch the app: > > Fatal Python error: Interpreter not initialized (version mismatch?) > > I've downloaded macports and installed its python25, pyqt, &c. I've > issued the command, sudo python_select python25, and checked that > python25 is selected with python_select -s. > > From searching the net and the archives, it's likely that the system > python is seeping into the build process somewhere. The info I've > read says that python_select should take care of the problem. > > Any other suggestions? > Thanks in advance! > Scott > > > OSX 10.5.5 > py25-py2app-devel @0.4.2_1 > MacPorts-1.7.1-10.5-Leopard > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From leknarf at pacbell.net Fri Jun 5 09:04:36 2009 From: leknarf at pacbell.net (Scott Frankel) Date: Fri, 5 Jun 2009 00:04:36 -0700 Subject: [Pythonmac-SIG] Interpreter not initialized In-Reply-To: References: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> Message-ID: <807F3B72-8CF1-430D-ABE7-81CF4A983DE9@pacbell.net> I'm not sure I can upgrade to python26. Meanwhile, if I understand your otool suggestion correctly, I've gotten seemingly ambiguous results. (See below.) Macports has installed the pyqt libs deep in its directory structure. Pointing otool to QtCore.so, for example, returned a Python that's neither /System nor the Macports deep installation. Am I using otool incorrectly? Or interpreting the results incorrectly? Thanks again! Scott % otool -L /opt/local/var/macports/software/py25-pyqt4/4.4.4_0/opt/ local/lib/python2.5/site-packages/PyQt4/QtCore.so /opt/local/var/macports/software/py25-pyqt4/4.4.4_0/opt/local/lib/ python2.5/site-packages/PyQt4/QtCore.so: /opt/local/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.1) On Jun 4, 2009, at 11:37 PM, Dane Springmeyer wrote: > Hey Scott, > > Essentially the problem results (like you note) from the system > python (or some other python version) linking to a macports library. > That python version then differs from the python version your are > running from the interpreter. > > In general I've noticed this has been a big problem for macports and > python25. Upgrading to python26 from macports often can help. > > Beyond that trying to figure out exactly what is linking to what is > the next step, and the 'otool' command comes in very handy for this. > > For example, try pointing 'otool' at your pyqt lib like: > > $ otool -L /opt/local/lib/ > > The resulting list will likely should linking to the /system python. > If you can't upgrade to py26-pyqt then consider filing a bug with > macports. > > The last trick is to use the 'install_name_tool' to actually > manually (brute force) fix the linking from the /system python to > the macports python. > > Dane > > > On Jun 4, 2009, at 11:04 PM, Scott Frankel wrote: > >> >> I'm using py2app for the first time to build a PyQt app. I get the >> following error msg when I launch the app: >> >> Fatal Python error: Interpreter not initialized (version mismatch?) >> >> I've downloaded macports and installed its python25, pyqt, &c. >> I've issued the command, sudo python_select python25, and checked >> that python25 is selected with python_select -s. >> >> From searching the net and the archives, it's likely that the >> system python is seeping into the build process somewhere. The >> info I've read says that python_select should take care of the >> problem. >> >> Any other suggestions? >> Thanks in advance! >> Scott >> >> >> OSX 10.5.5 >> py25-py2app-devel @0.4.2_1 >> MacPorts-1.7.1-10.5-Leopard >> >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > From leknarf at pacbell.net Sat Jun 6 00:39:05 2009 From: leknarf at pacbell.net (Scott Frankel) Date: Fri, 5 Jun 2009 15:39:05 -0700 Subject: [Pythonmac-SIG] Interpreter not initialized In-Reply-To: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> References: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> Message-ID: <6D328485-F77D-4749-9FB4-4401B507133C@pacbell.net> Is there a way to force the use of a specific version of python for py2app? python_select appears to be getting overridden somewhere/how. I've upgraded to python26 and noticed that my system Python (2.5) is still being used in the py2app build process. I'm also getting python 2.5.1 when I open an interpreter in the same shell that I've just issued the python_select command in. I've confirmed that python26 is active (via `port installed`). I've selected python26. And I've confirmed that python26 is selected. py2app continues to use /System/Library/Frameworks/Python.framework/ Versions/2.5 ... Does python_select require a specific shell? I'm using tcsh on OSX 10.5.5. Here are the steps I've taken: % sudo python_select python26 % sudo python_select -a python26 % rm -rf build dist % python setup.py py2app > /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/ python/modulegraph/modulegraph.py(444)load_tail() -> raise ImportError, "No module named " + mname My setup.py script is pretty simple: from setuptools import setup APP = ['Y-Film.py'] OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4._qt']} setup( app=APP, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) The mname error seems to be from the PyQt4._qt include. My environment can't seem to find the macports installed libs. I've added the macports paths to bin and sbin to my $PATH. Grepping and calling port without a path demonstrates that $PATH is set correctly. Suggestions? Thanks in advance! Scott On Jun 4, 2009, at 11:04 PM, Scott Frankel wrote: > > I'm using py2app for the first time to build a PyQt app. I get the > following error msg when I launch the app: > > Fatal Python error: Interpreter not initialized (version mismatch?) > > I've downloaded macports and installed its python25, pyqt, &c. I've > issued the command, sudo python_select python25, and checked that > python25 is selected with python_select -s. > > From searching the net and the archives, it's likely that the system > python is seeping into the build process somewhere. The info I've > read says that python_select should take care of the problem. > > Any other suggestions? > Thanks in advance! > Scott > > > OSX 10.5.5 > py25-py2app-devel @0.4.2_1 > MacPorts-1.7.1-10.5-Leopard > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From Chris.Barker at noaa.gov Sat Jun 6 01:58:53 2009 From: Chris.Barker at noaa.gov (Christopher Barker) Date: Fri, 05 Jun 2009 16:58:53 -0700 Subject: [Pythonmac-SIG] Interpreter not initialized In-Reply-To: <6D328485-F77D-4749-9FB4-4401B507133C@pacbell.net> References: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> <6D328485-F77D-4749-9FB4-4401B507133C@pacbell.net> Message-ID: <4A29B13D.3040504@noaa.gov> Scott Frankel wrote: > Is there a way to force the use of a specific version of python for > py2app? python_select appears to be getting overridden somewhere/how. it should use the one you call it with... > % python setup.py py2app what do you get when you run: which python and: python this should assure you whether python_select is working. you can also do: python >>> import os >>> os.__file__ '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/os.pyc' that will tell you what python is actually being used. -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 leknarf at pacbell.net Sat Jun 6 02:09:58 2009 From: leknarf at pacbell.net (Scott Frankel) Date: Fri, 5 Jun 2009 17:09:58 -0700 Subject: [Pythonmac-SIG] Interpreter not initialized In-Reply-To: <4A29B13D.3040504@noaa.gov> References: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> <6D328485-F77D-4749-9FB4-4401B507133C@pacbell.net> <4A29B13D.3040504@noaa.gov> Message-ID: Hi Christopher, On Jun 5, 2009, at 4:58 PM, Christopher Barker wrote: > Scott Frankel wrote: >> Is there a way to force the use of a specific version of python for >> py2app? python_select appears to be getting overridden somewhere/ >> how. > > it should use the one you call it with... > >> % python setup.py py2app > > what do you get when you run: > > which python /usr/bin/python Unless Macports touched this, this is my system-installed Python. > and: > > python Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26) > this should assure you whether python_select is working. I don't think python_select is working. In the same shell: tiento[lib]% sudo python_select -s python26 > you can also do: > > python > > >>> import os > >>> os.__file__ > '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > os.pyc' > '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/os.py' > that will tell you what python is actually being used. Yep. Is there a way to coerce python_select? Does python_select require bash? Thanks! Scott > > > -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 nad at acm.org Sat Jun 6 03:54:39 2009 From: nad at acm.org (Ned Deily) Date: Fri, 05 Jun 2009 18:54:39 -0700 Subject: [Pythonmac-SIG] Interpreter not initialized References: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> <6D328485-F77D-4749-9FB4-4401B507133C@pacbell.net> <4A29B13D.3040504@noaa.gov> Message-ID: In article , Scott Frankel wrote: > Is there a way to coerce python_select? Does python_select > require bash? python_select essentially only affects the command /opt/local/bin/python. If the path /opt/local/bin doesn't come before /usr/bin on your $PATH, then when you type "python", you'll still get the system python. Try explicitly invoking the desired python, like this: $ cd /path/to/app/direcotry $ /opt/local/bin/python2.6 setup.py py2app That should work regardless of $PATH and of the python_select setting. -- Ned Deily, nad at acm.org From santagada at gmail.com Sat Jun 6 07:17:44 2009 From: santagada at gmail.com (Leonardo Santagada) Date: Sat, 6 Jun 2009 02:17:44 -0300 Subject: [Pythonmac-SIG] Interpreter not initialized In-Reply-To: References: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> <6D328485-F77D-4749-9FB4-4401B507133C@pacbell.net> <4A29B13D.3040504@noaa.gov> Message-ID: <117C716E-E70A-476C-94E6-1EB0BDD72C76@gmail.com> On Jun 5, 2009, at 10:54 PM, Ned Deily wrote: > In article , > Scott Frankel wrote: >> Is there a way to coerce python_select? Does python_select >> require bash? > > python_select essentially only affects the command > /opt/local/bin/python. If the path /opt/local/bin doesn't come before > /usr/bin on your $PATH, then when you type "python", you'll still get > the system python. > > Try explicitly invoking the desired python, like this: > > $ cd /path/to/app/direcotry > $ /opt/local/bin/python2.6 setup.py py2app > > That should work regardless of $PATH and of the python_select setting. another problem that I had is that /opt/local/bin is not part of the finder paths so .app software that tries to launch python can't find it. the fix is putting this on a .plist in a hidden directory, search for "mac os x finder search path" or something. -- Leonardo Santagada santagada at gmail.com From leknarf at pacbell.net Sun Jun 7 17:45:01 2009 From: leknarf at pacbell.net (Scott Frankel) Date: Sun, 7 Jun 2009 08:45:01 -0700 Subject: [Pythonmac-SIG] Interpreter not initialized In-Reply-To: References: <1B2A9A39-8038-49B6-882D-5321C6C968C2@pacbell.net> <6D328485-F77D-4749-9FB4-4401B507133C@pacbell.net> <4A29B13D.3040504@noaa.gov> Message-ID: <0F4C7B31-E68B-44BF-AD28-B070DDC8E8DC@pacbell.net> Yes, it turned out to be a $PATH problem. Thanks! Scott On Jun 5, 2009, at 6:54 PM, Ned Deily wrote: > In article , > Scott Frankel wrote: >> Is there a way to coerce python_select? Does python_select >> require bash? > > python_select essentially only affects the command > /opt/local/bin/python. If the path /opt/local/bin doesn't come before > /usr/bin on your $PATH, then when you type "python", you'll still get > the system python. > > Try explicitly invoking the desired python, like this: > > $ cd /path/to/app/direcotry > $ /opt/local/bin/python2.6 setup.py py2app > > That should work regardless of $PATH and of the python_select setting. > > -- > Ned Deily, > nad at acm.org > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From leknarf at pacbell.net Sun Jun 7 19:02:00 2009 From: leknarf at pacbell.net (Scott Frankel) Date: Sun, 7 Jun 2009 10:02:00 -0700 Subject: [Pythonmac-SIG] py2app PyQt sqldrivers Message-ID: How does one add PyQt sqldrivers to an app created with py2app? My app relies on the QPSQL driver. Unless I'm mistaken, the QPSQL driver does not appear to have been included in the macports install. Nonetheless, I have the driver on my development machine. Does libqsqlpsql.dylib have to be copied to the app bundle manually? If so, to where? Thanks in advance, Scott From chris.van.bael at gmail.com Sun Jun 7 21:04:48 2009 From: chris.van.bael at gmail.com (Chris Van Bael) Date: Sun, 7 Jun 2009 21:04:48 +0200 Subject: [Pythonmac-SIG] Gtk issues In-Reply-To: <23810538.post@talk.nabble.com> References: <786164.38114.qm@web57207.mail.re3.yahoo.com> <23810538.post@talk.nabble.com> Message-ID: <5465ee790906071204y6cdb12a9s77d13fb243c9d384@mail.gmail.com> Hi, In the post you mentioned below, there is step 3: 3 install pygtk 2.10.14 (working well with the framework) PKG_CONFIG_PATH=/Library/Frameworks/GLib.framework/Resources/dev/lib/pkgconfig:/Library/Frameworks/Gtk.framework/Resources/dev/lib/pkgconfig:/Library/Frameworks/Cairo.framework/Resources/dev/lib/pkgconfig: path_to_your_folder/pkgconfig ./configure --prefix=/Library/Frameworks/Python.framework/Versions/2.5 Up til now I followed the instructions from http://live.gnome.org/GTK%2B/OSX/BuildInstructions and they work fine if I add as last command jhbuild build pygtk ... for the System Python, but I need it in the Python.org Python (see my mails on the PyGTK mailinglist) So all GTK things are installed correct, only PyGTK is not linked to the correct Python. In your instruction however, I see prefix=/Library/Frameworks/Python.framework/Versions/2.5 I think that may be what I need to link it to the correct Python. But can you explain exactly what you type in Terminal? I'm quite a noob on this, so if you could explain in very simple terms? Thanks, Chris On Mon, Jun 1, 2009 at 8:35 AM, genemartin wrote: > > see my post on installing gtk and pygtk without Macports or Fink. > http://www.nabble.com/PyGTK-on-OSX--to21186327.html#a22451916 > http://www.nabble.com/PyGTK-on-OSX--to21186327.html#a22451916">PyGTK on OSX? > > I don't use Fink or MacPorts because I want to compile myself to learn ?and > they interfere : ?if you try to use libraries from either, you may have > problems with version mismatches and library duplication between them and > /usr/local or python framework stuff > > In site-package, i have : > - a folder named gtk-2.0 with folders named gtk, gio,glib, gobject and some > files pango etc... > - a folder named cairo > - a file named pygtk.py > - a file named pygtk.pth referring to "gtk-2.0" > > _gtk.so is in site-packages/gtk-2.0/gtk/_gtk.so > > in /Library/Frameworks/Python.framework/Versions/2.5/lib/ > I have a folder named pkgconfig with the files pycairo.pc,pygtk-2.0.pc, > pygobject-2.0.pc > The file named pygtk-2.0.pc is > "prefix=/Library/Frameworks/Python.framework/Versions/2.5 > exec_prefix=${prefix} > includedir=${prefix}/include > datarootdir=@datarootdir@ > datadir=${prefix}/share > pyexecdir=${exec_prefix}/lib/python2.5/site-packages > > # you can use the --variable=pygtkincludedir argument to > # pkg-config to get this value. ?You might want to use this to > # install additional headers. > pygtkincludedir=${includedir}/pygtk-2.0 > > # same here. ?Useful when calling the code generator in addon packages. > defsdir=${datadir}/pygtk/2.0/defs > codegendir=${datadir}/pygtk/2.0/codegen > > Name: PyGTK > Description: Python bindings for GTK+ and related libraries > Requires: pygobject-2.0 > Version: 2.10.4 > Cflags: -I${pygtkincludedir} " > > I hope this will help > -- > View this message in context: http://www.nabble.com/Gtk-issues-tp23803508p23810538.html > Sent from the Python - pythonmac-sig mailing list archive at Nabble.com. > > _______________________________________________ > Pythonmac-SIG maillist ?- ?Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From martin.laloux at gmail.com Mon Jun 8 11:37:14 2009 From: martin.laloux at gmail.com (genemartin) Date: Mon, 8 Jun 2009 02:37:14 -0700 (PDT) Subject: [Pythonmac-SIG] Gtk issues In-Reply-To: <5465ee790906071204y6cdb12a9s77d13fb243c9d384@mail.gmail.com> References: <786164.38114.qm@web57207.mail.re3.yahoo.com> <23810538.post@talk.nabble.com> <5465ee790906071204y6cdb12a9s77d13fb243c9d384@mail.gmail.com> Message-ID: <23920808.post@talk.nabble.com> i type PKG_CONFIG_PATH=/Library/Frameworks/GLib.framework/Resources/dev/lib/pkgconfig:/Library/Frameworks/Gtk.framework/Resources/dev/lib/pkgconfig:/Library/Frameworks/Cairo.framework/Resources/dev/lib/pkgconfig:/Library/Frameworks/Python.framework/Versions/2.5/lib/pkgconfig: ./configure --prefix=/Library/Frameworks/Python.framework/Versions/2.5 with PKG_CONFIG_PATH=/Library/Frameworks/GLib.framework/Resources/dev/lib/pkgconfig: -> for Glib /Library/Frameworks/Gtk.framework/Resources/dev/lib/pkgconfig: -> for gtk /Library/Frameworks/Cairo.framework/Resources/dev/lib/pkgconfig: -> for cairo /Library/Frameworks/Python.framework/Versions/2.5/lib/pkgconfig -> for pygobject.2.0.pc, you need to find this file in your system ./configure --prefix=/Library/Frameworks/Python.framework/Versions/2.5 -> my python -- View this message in context: http://www.nabble.com/Gtk-issues-tp23803508p23920808.html Sent from the Python - pythonmac-sig mailing list archive at Nabble.com. From fredrik at pythonware.com Wed Jun 3 00:38:56 2009 From: fredrik at pythonware.com (Fredrik Lundh) Date: Wed, 3 Jun 2009 00:38:56 +0200 Subject: [Pythonmac-SIG] [Image-SIG] Python Core Graphics Question (resent) In-Reply-To: References: Message-ID: <368a5cd50906021538x1deca389u7dce3502dcc26092@mail.gmail.com> On Tue, Jun 2, 2009 at 9:13 PM, Geert Dekkers wrote: > (I just resent this message as I couldn't it find it on the digest even > after days - again, I apologise for any cross-posting) It's in the image-sig archive, at least: http://mail.python.org/pipermail/image-sig/2009-May/005709.html From jreese99 at verizon.net Thu Jun 11 04:43:59 2009 From: jreese99 at verizon.net (James Reese) Date: Wed, 10 Jun 2009 22:43:59 -0400 Subject: [Pythonmac-SIG] Problems with appscript Message-ID: <79D68483-15A0-49FF-886F-5B8865A2C375@verizon.net> Hi, I'm having several problems with appscript. I'm running OS X 10.5.7 with all the latest updates, and I've installed the latest release using easy_install: Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import appscript >>> appscript.__version__ '0.19.0' I've downloaded the sample scripts, and when I try to run AB_list_people_with_emails.py, I get this: > ./AB_list_people_with_emails.py Traceback (most recent call last): File "./AB_list_people_with_emails.py", line 9, in for name, emails in zip(peopleref.name.get(), peopleref.emails.value.get()): File "/Library/Python/2.5/site-packages/appscript-0.19.0-py2.5- macosx-10.5-i386.egg/appscript/reference.py", line 513, in __call__ appscript.reference.CommandError: Command failed: OSERROR: -1708 MESSAGE: Application could not handle this command. COMMAND: app(u'/Applications/Address Book.app').people[its.emails != []].name.get() I'm also having problems with the ASDictionary program. Get Info says the version is 0.11.2. When I try to run it, it crashes, and these messages appear in the console log: 6/10/09 10:36:27 PM [0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049] Traceback (most recent call last): 6/10/09 10:36:27 PM [0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049] File "/ Users/jreese/Development/Python/Appscript/ASDictionary/ ASDictionary.app/Contents/Resources/__boot__.py", line 31, in 6/10/09 10:36:27 PM [0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049] _run('ASDictionary.py') 6/10/09 10:36:27 PM [0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049] File "/ Users/jreese/Development/Python/Appscript/ASDictionary/ ASDictionary.app/Contents/Resources/__boot__.py", line 28, in _run 6/10/09 10:36:27 PM [0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049] execfile(path, globals(), globals()) 6/10/09 10:36:27 PM [0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049] File "/ Users/jreese/Development/Python/Appscript/ASDictionary/ ASDictionary.app/Contents/Resources/ASDictionary.py", line 17, in 6/10/09 10:36:27 PM [0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049] import osax, appscript, mactypes 6/10/09 10:36:27 PM [0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049] File "build/bdist.macosx-10.3-i386/egg/osax.py", line 37, in 6/10/09 10:36:27 PM [0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049] File "build/bdist.macosx-10.3-i386/egg/aem/aemsend.py", line 82, in send 6/10/09 10:36:27 PM [0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049] aem.aemsend.EventError: Command failed: Application could not handle this command. (-1708) 6/10/09 10:36:27 PM ASDictionary[9049] ASDictionary Error 6/10/09 10:36:27 PM ASDictionary[9049] ASDictionary Error An unexpected error has occurred during execution of the main script EventError: Command failed: Application could not handle this command. (-1708) 6/10/09 10:36:29 PM [0x0-0x1e51e5].com.apple.systemevents[9050] com.apple.FolderActions.enabled: Already loaded 6/10/09 10:36:30 PM com.apple.launchd[118] ([0x0-0x1e41e4].net.sourceforge.appscript.asdictionary[9049]) Exited with exit code: 255 Any help with these problems will be greatly appreciated. Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: From hengist.podd at virgin.net Thu Jun 11 16:06:17 2009 From: hengist.podd at virgin.net (has) Date: Thu, 11 Jun 2009 15:06:17 +0100 Subject: [Pythonmac-SIG] Problems with appscript In-Reply-To: References: Message-ID: <3A0909B3-2D9D-42FA-B18B-4451285AE337@virgin.net> James Reese wrote: > I'm having several problems with appscript. I'm running OS X 10.5.7 > with all the latest updates, and I've installed the latest release > using easy_install: > > Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import appscript > >>> appscript.__version__ > '0.19.0' > > I've downloaded the sample scripts, and when I try to run > AB_list_people_with_emails.py, I get this: > > > ./AB_list_people_with_emails.py > Traceback (most recent call last): > File "./AB_list_people_with_emails.py", line 9, in > for name, emails in zip(peopleref.name.get(), > peopleref.emails.value.get()): > File "/Library/Python/2.5/site-packages/appscript-0.19.0-py2.5- > macosx-10.5-i386.egg/appscript/reference.py", line 513, in __call__ > appscript.reference.CommandError: Command failed: > OSERROR: -1708 > MESSAGE: Application could not handle this command. > COMMAND: app(u'/Applications/Address Book.app').people[its.emails ! > = []].name.get() Don't suppose you have Default Folder X installed? There's been a couple other recent compatibility reports with that - it's being looked into. has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From georg.seifert at gmx.de Fri Jun 12 01:56:28 2009 From: georg.seifert at gmx.de (Georg Seifert) Date: Fri, 12 Jun 2009 01:56:28 +0200 Subject: [Pythonmac-SIG] scripting over Distributed Objects Message-ID: <22F0FE36-58E9-4451-9CB5-7F8BA0443521@gmx.de> Hi, I try to script me app using the JSTalk framework. My app i written in cocoa. I works nice with Javascript and if I use python from within my app with "PyRun_SimpleString" but if I use python over the DO connection I get problems. What the JSTalk framework does is it establishes a connection between two app (or one app and a python interpreter) over Distributed Objects. In the script I get a reference to my NSApplication delegate and can use all its properties and function. But if I add some objects to my documents it works only as long as the script runs. It is a problem with the proxy objects. As long as the script runs, the proxy is working and the pyObjC bridge routes the method calls correctly. I resolved this with copying the object in my accessors but then the reference to the object in the script becomes invalid (and I need an extra copy) Does anybody has an idea what to do? Can I somehow make python to return the actual cocoa object rather than the proxy? Many Thanks Georg excerpt of my python code: [..] def application(appName): appPath = NSWorkspace.sharedWorkspace().fullPathForApplication_(appName); appBundle = NSBundle.bundleWithPath_(appPath) bundleId = appBundle.bundleIdentifier() [..] port = bundleId + ".JSTalk" conn = None tries = 0 while ((conn is None) and (tries < 10)): conn = NSConnection.connectionWithRegisteredName_host_(port, None) tries = tries + 1; if (not conn): time.sleep(1) if (not conn): print("Could not find a JSTalk connection to " + appName) return None return conn.rootProxy() glyphs = application("Glyphs") # the reference to my App delegate node = glyphs.node() # I need the method return a new instance as I am not in the scope of my app and python does not know of my classes. [..] path.addNode_(node) From jreese99 at verizon.net Sat Jun 13 21:39:08 2009 From: jreese99 at verizon.net (James Reese) Date: Sat, 13 Jun 2009 15:39:08 -0400 Subject: [Pythonmac-SIG] Problems with appscript In-Reply-To: References: Message-ID: On Jun 12, 2009, at 6:00 AM, pythonmac-sig-request at python.org wrote: > > From: has > Date: June 11, 2009 10:06:17 AM EDT > To: pythonmac-sig at python.org > Subject: Re: [Pythonmac-SIG] Problems with appscript > > > James Reese wrote: > >> I'm having several problems with appscript. I'm running OS X 10.5.7 >> with all the latest updates, and I've installed the latest release >> using easy_install: >> >> Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) >> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin >> Type "help", "copyright", "credits" or "license" for more >> information. >> >>> import appscript >> >>> appscript.__version__ >> '0.19.0' >> >> I've downloaded the sample scripts, and when I try to run >> AB_list_people_with_emails.py, I get this: >> >> > ./AB_list_people_with_emails.py >> Traceback (most recent call last): >> File "./AB_list_people_with_emails.py", line 9, in >> for name, emails in zip(peopleref.name.get(), >> peopleref.emails.value.get()): >> File "/Library/Python/2.5/site-packages/appscript-0.19.0-py2.5- >> macosx-10.5-i386.egg/appscript/reference.py", line 513, in __call__ >> appscript.reference.CommandError: Command failed: >> OSERROR: -1708 >> MESSAGE: Application could not handle this command. >> COMMAND: app(u'/Applications/Address >> Book.app').people[its.emails != []].name.get() > > Don't suppose you have Default Folder X installed? There's been a > couple other recent compatibility reports with that - it's being > looked into. > > has > > -- > Control AppleScriptable applications from Python, Ruby and ObjC: > http://appscript.sourceforge.net That is indeed the source of my problems. Thanks for the information. Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: From bgquest at gmail.com Sat Jun 20 19:39:03 2009 From: bgquest at gmail.com (beegee beegee) Date: Sat, 20 Jun 2009 23:09:03 +0530 Subject: [Pythonmac-SIG] Cant open file Message-ID: <4644d56e0906201039t76befd13id6c365099e96c964@mail.gmail.com> Hello,I am new to python, I have a mac os tiger 10.4.11 I created a simple text file using textwrangler and wrote the following code : print "Hello World" I saved this file on my desktop as *first_print.py* I opened terminal I typed python and I got >>> as the prompt I typed *python first_print.py* and I got the following error message: python first_print.py /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python: can't open file 'first_print.py': [Errno 2] No such file or directory please help Also please let me know as to what is this error message for? what does it tell a user Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From pythonmac at rebertia.com Sat Jun 20 20:09:27 2009 From: pythonmac at rebertia.com (Chris Rebert) Date: Sat, 20 Jun 2009 11:09:27 -0700 Subject: [Pythonmac-SIG] Cant open file In-Reply-To: <4644d56e0906201039t76befd13id6c365099e96c964@mail.gmail.com> References: <4644d56e0906201039t76befd13id6c365099e96c964@mail.gmail.com> Message-ID: <50697b2c0906201109s222f950dw5bd106dc2200e011@mail.gmail.com> On Sat, Jun 20, 2009 at 10:39 AM, beegee beegee wrote: > Hello, > I am new to python, I have a mac os tiger 10.4.11 > I created a simple text file using textwrangler > and wrote the following code : > > print "Hello World" > > I saved this file on my desktop as first_print.py > I opened terminal > I typed python > and I got >>> as the prompt > I typed python first_print.py > and I got the following error message: > > python first_print.py > /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python: > can't open file 'first_print.py': [Errno 2] No such file or directory > > please help > Also please let me know as to what is this error message for? what does it > tell a user "python first_print.py" is a command to be run in the *bash* shell (i.e. raw Terminal). When you do "python" in Terminal, you've opened Python itself, so it makes no sense to then try and run a shell command from within Python itself. So, to run your program: 1. Open Terminal 2. cd Desktop 3. python first_print.py Cheers, Chris -- http://blog.rebertia.com From Brendan.Simon at eTRIX.com.au Mon Jun 22 04:58:21 2009 From: Brendan.Simon at eTRIX.com.au (Brendan Simon (eTRIX)) Date: Mon, 22 Jun 2009 12:58:21 +1000 Subject: [Pythonmac-SIG] interrogating I/O Registry Message-ID: <4A3EF34D.4000403@eTRIX.com.au> I have a USB device that registers itself as a serial device (/dev/usbmodemXXXX). I have used pyusb to detect the device, and now I need to know what serial device has been "created" so I can talk to it using pyserial. I don't know what the best way is to find that association, but I came across the I/O registry via a google search, and I think that will give me enough info to obtain that association. Is there a python way of reading the OS X I/O Registry ??? All I've come up with so far is to run the "ioreg" command via the subprocess module and parse the output. Is there a better python module to interrogate the I/O registry ?? or is there a better way to find the association between the USB serial device and the serial device filename that is generated ?? Thanks very much for any help or pointers, Brendan. -------------- next part -------------- A non-text attachment was scrubbed... Name: Brendan_Simon.vcf Type: text/x-vcard Size: 267 bytes Desc: not available URL: From Brendan.Simon at eTRIX.com.au Wed Jun 24 07:09:01 2009 From: Brendan.Simon at eTRIX.com.au (Brendan Simon (eTRIX)) Date: Wed, 24 Jun 2009 15:09:01 +1000 Subject: [Pythonmac-SIG] py2app not copying PySerial module Message-ID: <4A41B4ED.6040303@eTRIX.com.au> I'm running py2app for the first time -- following the instructions on the web. I've created an app bundle but running the app fails as it can't find a module named "serial". The "serial" module is part of PySerial-2.4. I couldn't find serial.py on my system but notice that there is a pyserial-2.4-py2.5.egg in the site-packages directory. The `file` command tells me it's a zip file and `unzip -l` shows the serial/*.py files. Is there a way to include the serial module in the app bundle ?? I've played with --includes and --packages py2app options without any success. Is there a way to include eggs with py2app ?? I'm thinking not based on the web page information. There must be a way to resolve this, either through py2app or some manual tweaking. Thanks for any help, Brendan. -------------- next part -------------- A non-text attachment was scrubbed... Name: Brendan_Simon.vcf Type: text/x-vcard Size: 267 bytes Desc: not available URL: From hraban at fiee.net Wed Jun 24 20:50:30 2009 From: hraban at fiee.net (Henning Hraban Ramm) Date: Wed, 24 Jun 2009 20:50:30 +0200 Subject: [Pythonmac-SIG] py2app not copying PySerial module In-Reply-To: <4A41B4ED.6040303@eTRIX.com.au> References: <4A41B4ED.6040303@eTRIX.com.au> Message-ID: <8C5D6143-B3DA-4789-8F6C-EA8CE6788A76@fiee.net> Am 2009-06-24 um 07:09 schrieb Brendan Simon (eTRIX): > I'm running py2app for the first time -- following the instructions on > the web. > > I've created an app bundle but running the app fails as it can't > find a > module named "serial". > > The "serial" module is part of PySerial-2.4. I couldn't find > serial.py > on my system but notice that there is a pyserial-2.4-py2.5.egg in the > site-packages directory. The `file` command tells me it's a zip file > and `unzip -l` shows the serial/*.py files. py2app has trouble with zipped eggs. Just install everything unzipped. (easy_install -Z) Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: Signierter Teil der Nachricht URL: From Brendan at BrendanSimon.com Mon Jun 22 05:09:45 2009 From: Brendan at BrendanSimon.com (Brendan Simon) Date: Mon, 22 Jun 2009 13:09:45 +1000 Subject: [Pythonmac-SIG] pyusb error Message-ID: <4A3EF5F9.50109@BrendanSimon.com> I'm using pyusb and having problems with the getString() method on OS X. I can successfully read the bus and device info and display the output by running the sample program usbenum.py, but when I try to get the manufacturer string I get a usb_control_msg(DeviceRequestTO) error. I assume this is a TimeOut error, but I'm not sure what is causing this. I know this isn't a usb list, but I think it may be an OS X problem ??? Thanks for any help. From Brendan at BrendanSimon.com Mon Jun 22 10:18:11 2009 From: Brendan at BrendanSimon.com (Brendan Simon) Date: Mon, 22 Jun 2009 18:18:11 +1000 Subject: [Pythonmac-SIG] Calling OS X libraries from python Message-ID: <4A3F3E43.7080506@BrendanSimon.com> I have found a function in OS X library IOUSBlib called GetLocationId(self, location) -- specified in IOUSBLib.h How can I call this function from python ?? Is there a python wrapper for this OS X library ?? If not, what is the best/easiest way to get a python interface to this library that will interoperate with PyUSB ?? Anyone know if there is a command line utility that I could run to find this ?? Thanks for any help or suggestions. Brendan. From ssquery at gmail.com Thu Jun 25 15:05:42 2009 From: ssquery at gmail.com (sudhakar s) Date: Thu, 25 Jun 2009 18:35:42 +0530 Subject: [Pythonmac-SIG] Fwd: py2app help needed In-Reply-To: <1528d2590906250542u5eddc294t455e81023b5e3add@mail.gmail.com> References: <1528d2590906250542u5eddc294t455e81023b5e3add@mail.gmail.com> Message-ID: <1528d2590906250605y5250c567o8866a835ee225716@mail.gmail.com> ---------- Forwarded message ---------- From: sudhakar s Date: Thu, Jun 25, 2009 at 6:12 PM Subject: py2app help needed To: bangpypers at python.org HI everyone... I am working on python pmw on Mac and i am in my final stage of project, and when i came to make an .app file or an executable i am getting an error which was heart breaking, because on i was unable to run my application which was made using py2app. Procedure I used to convert .py to .app is as below : curl -O http://peak.telecommunity.com/dist/ez_setup.py sudo python ez_setup.py -U setuptools python setup.py install python setup.py develop py2applet --make-setup invpmw.py rm -rf build dist python setup.py py2app By the above steps i got a .app file in dist and when i click on the .app file i get result as below... Please someone help how to rectify my problem or suggest how to make a .app from .py using pmw..... And one more thing is that when i use -A in "python setup.py py2app" i am getting result which is offcourse its standalone appilication. Is there any method to convert standalone application to work on other system........ Thanks in advance. with regards S Sudhakar. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Picture 1.png Type: image/png Size: 43516 bytes Desc: not available URL: From ssquery at gmail.com Fri Jun 26 06:37:03 2009 From: ssquery at gmail.com (sudhakar s) Date: Fri, 26 Jun 2009 10:07:03 +0530 Subject: [Pythonmac-SIG] py2exe with pmw...help needed Message-ID: <1528d2590906252137p10f9d634h71f0a0056fe0c2a3@mail.gmail.com> Hi Everyone, This is sudhakar,i want to covert my pmw application into an executable on Windows and ".dmg or .app" on Mac. while i was trying i am able to convert but unable to run my application. After coverting Menubar.py into Menubar.exe using py2exe and when i run it i get the ERROR: C:\Python25\dist>MenuBar.exe Traceback (most recent call last): File "MenuBar.py", line 160, in File "Pmw\Pmw_1_3\lib\PmwLoader.pyc", line 134, in __getattr__ File "Pmw\Pmw_1_3\lib\PmwLoader.pyc", line 113, in _initialise IOError: [Errno 2] No such file or directory: 'C:\\Python25\\dist\\.\\Pmw\\Pmw_1_3\\lib\\Pmw.def' Please help me how to solve the error and make an executable... I was using the setup.py script as below: from distutils.core import setup import py2exe setup( console=['MenuBar.py'], options={ 'py2exe': { 'packages':['Pmw', 'Pmw.Pmw_1_3', 'Pmw.Pmw_1_3.lib',], 'skip_archive': True, 'dll_excludes': ['MSVCR71.dll'] } } ) With Regards S Sudhakar. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tangle1 at mindspring.com Fri Jun 26 16:44:51 2009 From: tangle1 at mindspring.com (tangle1 at mindspring.com) Date: Fri, 26 Jun 2009 07:44:51 -0700 (GMT-07:00) Subject: [Pythonmac-SIG] py2app, PyQt4, jpg converter plugin Message-ID: <20407809.1246027491784.JavaMail.root@mswamui-chipeau.atl.sa.earthlink.net> I used py2app to convert my mac python/PyQt script to a mac app. Everything works except for cache/display of jpg images. I confirmed with diagnostic code: - QImage(path to jpg) returns null image - 'jpg','jpeg' are not in list returned by QImageReader.supportedImageFormats() The jpgs ARE cached and displayed if I run the same script from python interpreter. I used macports to install components and then ran "python setup.py py2app" I have seen previous posts on this issue. However solution does not appear to be spelled out. I am not an experienced mac/python developer, but I need to get this last critical step working. Any help would be greatly appreciated!! ... I know the alternative is to do separate XCode,Qt,sip,PyQt installs on every Mac in our facility (sigh) Here is a copy of setup.py: (I copied from http://www.rkblog.rk.edu.pl/w/p/building-mac-os-x-applications-py2app/) ---------------------------------------------------------------------- from setuptools import setup APP = ['mvrv.py'] OPTIONS = {'argv_emulation': True, 'includes': ['sip','PyQt4._qt','PyQt4.QtCore','PyQt4.QtGui'], 'excludes':['PyQt4.QtDesigner','PyQt4.QtNetwork','PyQt4.QtOpenGl','PyQt4.QtScript','PyQt4.QtSql','PyQt4.QtTest','PyQt4.QtWebKit','PyQt4.QtXml','PyQt4.phonon']} setup( app=APP, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) ---------------------------------------------------------------------- Thanks! Suzanne From hengist.podd at virgin.net Fri Jun 26 21:33:43 2009 From: hengist.podd at virgin.net (has) Date: Fri, 26 Jun 2009 20:33:43 +0100 Subject: [Pythonmac-SIG] [ann] py-appscript 0.20.0 released Message-ID: <16829167-59B7-439F-AD95-06EB64C9793C@virgin.net> Hi all, I am pleased to announce the release of Python appscript 0.20.0: http://pypi.python.org/pypi/appscript Py-appscript 0.20.0 adds support for Python 3.0 and fixes several bugs. Enjoy, has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From half.italian at gmail.com Sat Jun 27 01:57:20 2009 From: half.italian at gmail.com (Sean DiZazzo) Date: Fri, 26 Jun 2009 16:57:20 -0700 Subject: [Pythonmac-SIG] appscript with Quicktime - "Connection is invalid' error Message-ID: <7baa94f60906261657m1bb39d78g3d8dd3055ed64ebe@mail.gmail.com> Let me first say thank you. This is my first time playing with appscript, and it has been a joy to work with. It took me about a half hour of figuring out a few commands that I was trying to do. Then, all of a sudden, I was writing it almost as if I had known it for years. It scared me a bit at first, but once I got started, it became very intuitive. I'm doing some work with quicktime, and I'm getting an error (-609, "Connection is invalid") when trying to save a large movie as self contained. The error is a bit inconsistent, and actually came up as a different error once so far. (-1708, "Application could not handle this command") It seems as if the movie is written to the destination as I expect sometimes, but other times it isn't. The save_self_contained() process takes about 5 minutes, and there is no "timeout" arg to save_self_contained() like there is for export(). Could this be the problem? Is there a way to force a timeout using save_self_contained() ?? I've got 'appscript-0.19.0-py2.5-macosx-10.5-i386.egg' on 10.5.6 with default apple python 2.5.1. Thanks in advance, ~Sean D -------------- next part -------------- An HTML attachment was scrubbed... URL: From half.italian at gmail.com Sat Jun 27 02:43:21 2009 From: half.italian at gmail.com (Sean DiZazzo) Date: Fri, 26 Jun 2009 17:43:21 -0700 Subject: [Pythonmac-SIG] appscript with Quicktime - "Connection is invalid' error In-Reply-To: <7baa94f60906261657m1bb39d78g3d8dd3055ed64ebe@mail.gmail.com> References: <7baa94f60906261657m1bb39d78g3d8dd3055ed64ebe@mail.gmail.com> Message-ID: <7baa94f60906261743r509ed3ccmeafcda4fcbef3fe3@mail.gmail.com> On a whim I tried the 0.20.0 version that was released today. To my surprise, export() has grown a new keyword... timeout! Look like it's solved my problem so far... Talk about luck. Thanks. ~Sean On Fri, Jun 26, 2009 at 4:57 PM, Sean DiZazzo wrote: > Let me first say thank you. This is my first time playing with appscript, > and it has been a joy to work with. It took me about a half hour of > figuring out a few commands that I was trying to do. Then, all of a sudden, > I was writing it almost as if I had known it for years. It scared me a bit > at first, but once I got started, it became very intuitive. > I'm doing some work with quicktime, and I'm getting an error (-609, > "Connection is invalid") when trying to save a large movie as self > contained. The error is a bit inconsistent, and actually came up as a > different error once so far. (-1708, "Application could not handle this > command") It seems as if the movie is written to the destination as I > expect sometimes, but other times it isn't. > > The save_self_contained() process takes about 5 minutes, and there is no > "timeout" arg to save_self_contained() like there is for export(). Could > this be the problem? Is there a way to force a timeout using > save_self_contained() ?? > > I've got > 'appscript-0.19.0-py2.5-macosx-10.5-i386.egg' on 10.5.6 with default apple python > 2.5.1. > > Thanks in advance, > > ~Sean D > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hengist.podd at virgin.net Sat Jun 27 19:38:30 2009 From: hengist.podd at virgin.net (has) Date: Sat, 27 Jun 2009 18:38:30 +0100 Subject: [Pythonmac-SIG] appscript with Quicktime - "Connection is invalid' error In-Reply-To: References: Message-ID: Sean DiZazzo wrote: > On a whim I tried the 0.20.0 version that was released today. To my > surprise, export() has grown a new keyword... timeout! It's actually been around since the early days, although some older documentation wasn't as clear about it. Chapter 11 of the appscript manual lists all of the special arguments that are always available for use: waitreply, timeout, resulttype, ignore (though the last two are ignored by most applications). > I'm doing some work with quicktime, and I'm getting an error (-609, > "Connection is invalid") when trying to save a large movie as self > contained. The error is a bit inconsistent, and actually came up as > a different error once so far. (-1708, "Application could not handle > this command") It seems as if the movie is written to the > destination as I expect sometimes, but other times it isn't. Don't know about the -1708 error; a glitch in QTP? -609 normally indicates the target application has unexpectedly quit before replying to an event, but a bug/shortcoming in AESendMessage() means it often also gets returned when timeouts occur (normally error -1712). Anyway, nice to hear you're finding it useful. Regards, has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From pythonnutter at gmail.com Mon Jun 29 09:33:04 2009 From: pythonnutter at gmail.com (Python Nutter) Date: Mon, 29 Jun 2009 17:33:04 +1000 Subject: [Pythonmac-SIG] Python program done, now need to Change Rocketship Icon, Remove Python menu? Message-ID: I've completed a GUI program in Python and used wxPython for a cross platform GUI solution. Now I need to focus on polishing up the Mac OS X distribution side of things. I've scanned my email program's archives of pythonmac-sig and I didn't get any results on a few first items I need to learn. The Mac Python Framework launches GUI based applications using Python Launcher, which gives a Rocketship icon on the Dock and inserts a Python menu on the Mac menubar. 1. I wish to override the Rocketship icon and display an icon representing my Application. 2. I wish to override/remove the Python menu item on the toolbar so that only my wxPython menus appear on the Mac toolbar when my program has focus. 3. I don't suppose there is an easy way to make an application folder in the Mac OS X Application folder representing my python program with the same Icon that would appear on the Dock when the user launches my program? I don't see any easy references to the folder structure for Python programmers to deploy on the OS X platform. Is there any good resources out there that will teach how to do this? I noticed that there is a "Build Applet" program on the Mac, and it prompts to select Source or Python file. However all the .py files are grayed out when I browse any directory on my USB Drive. I had small hopes it would help build the folder structure mentioned in Item#3 so I could then learn how to build a DMG file that will let a user drag the Icon/folder representing my program into the Applications folder to install it. What are some good resources to learn how to deploy on this platform? Cheers, PN From kw at codebykevin.com Mon Jun 29 14:04:09 2009 From: kw at codebykevin.com (Kevin Walzer) Date: Mon, 29 Jun 2009 08:04:09 -0400 Subject: [Pythonmac-SIG] Python program done, now need to Change Rocketship Icon, Remove Python menu? In-Reply-To: References: Message-ID: <4A48ADB9.4070009@codebykevin.com> Python Nutter wrote: > > What are some good resources to learn how to deploy on this platform? py2app is what you're looking for--it will wrap Python and your application code into a standalone application with its own icon. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From janssen at parc.com Mon Jun 29 17:53:07 2009 From: janssen at parc.com (Bill Janssen) Date: Mon, 29 Jun 2009 08:53:07 PDT Subject: [Pythonmac-SIG] Python program done, now need to Change Rocketship Icon, Remove Python menu? In-Reply-To: References: Message-ID: <96755.1246290787@parc.com> Python Nutter wrote: > 1. I wish to override the Rocketship icon and display an icon > representing my Application. Put your icon in the Info.plist file of your application: CFBundleIconFile YourLogo.icns You can use /Developer/Applications/Utilities/Icon Composer to build the icons file. > 3. I don't suppose there is an easy way to make an application folder > in the Mac OS X Application folder representing my python program with > the same Icon that would appear on the Dock when the user launches my > program? I don't see any easy references to the folder structure for > Python programmers to deploy on the OS X platform. Is there any good > resources out there that will teach how to do this? Again, just set the icon bundle in the Info.plist. There are lots of different ways to do this. Kevin's advice to just use py2app may be a good idea. Bill From tangle1 at mindspring.com Fri Jun 26 03:55:38 2009 From: tangle1 at mindspring.com (tangle1 at mindspring.com) Date: Thu, 25 Jun 2009 18:55:38 -0700 (GMT-07:00) Subject: [Pythonmac-SIG] py2app, PyQt4, QImage, jpg converter plugin Message-ID: <18233490.1245981339201.JavaMail.root@elwamui-lapwing.atl.sa.earthlink.net> I have read previous posts on this issue and it is not clear to me if there is a solution. Any help or hints would be greatly appreciated!! I am using py2app for first time. My script uses PyQt and specifically calls QImage to load jpg images. It works when I run the script from python interpreter. When run as app built by py2app, the QImage(path to jpg image) returns a null image and 'jpg','jpeg' are not in list returned by QImageReader.supportedImageFormats(). How do I get py2app to build my.app that points to Qt jpg converter plugin? Here is a copy of setup.py: (I copied from http://www.rkblog.rk.edu.pl/w/p/building-mac-os-x-applications-py2app/) ---------------------------------------------------------------------- from setuptools import setup APP = ['mvrv.py'] OPTIONS = {'argv_emulation': True, 'includes': ['sip','PyQt4._qt','PyQt4.QtCore','PyQt4.QtGui'], 'excludes':['PyQt4.QtDesigner','PyQt4.QtNetwork','PyQt4.QtOpenGl','PyQt4.QtScript','PyQt4.QtSql','PyQt4.QtTest','PyQt4.QtWebKit','PyQt4.QtXml','PyQt4.phonon']} setup( app=APP, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) ---------------------------------------------------------------------- Originally, I manually installed needed components, then I re-installed using macports. Attached is png that shows 2 windows: top is path to macports install of qt4 and bottom is my original install. When I run python interpreter, everything points to macports install. Thanks!! Suzanne -------------- next part -------------- A non-text attachment was scrubbed... Name: Picture_1.png Type: image/png Size: 281997 bytes Desc: not available URL: From arthamax at sbcglobal.net Mon Jun 29 03:14:44 2009 From: arthamax at sbcglobal.net (arthamax at sbcglobal.net) Date: Sun, 28 Jun 2009 18:14:44 -0700 Subject: [Pythonmac-SIG] Installing Pygame Message-ID: Hi, I am using a Mac PPC with Tiger 10.4.11 and I recently downloaded and installed Python 2.6.2. and I am having difficulties getting started. I purchased "Python Programming, 2nd Ed. for the absolute beginner" by Michael Dawson because he uses games to teach programming and the book got great reviews at Amazon.com. When I opened the CD that came with the Python book I could not open the software (Pygame, Livewires, etc.) and there was no reference to Mac or Windows unless it was in the file names which I don't know. I went to Pygame website http://www.pygame.org/download.shtml "Macintosh" to download Pygame "These are packages for the python from python.org, not the system python. These packages work with OSX 10.3.9 upwards. # pygame-1.8.1release-py2.5-macosx10.5.zip # pygame-1.8.1release-py2.4-macosx10.5.zip # pyobjc-1.4-py2.5-macosx10.4.mpkg.zip - pyobjc is needed for OSX 10.3, 10.4, and 10.5." and for the first time using this Mac I couldn't install anything. All three installation attempts ended with a red exclamation point over the Macintosh HD icon and a button saying "Go Back." The "Continue" button was grayed out. What am I missing? Setting up Python to learn through Dawson's book is becoming too much for me and I haven't even looked at Livewires and the other stuff. Has any Mac users here worked with this book or know where I can go for further assistance? I'm just about ready to send it back to Amazon.com (along with another book by Dawson called "Beginning C++ Through Game Programming, 2nd Ed" which I haven't even looked at yet). Apparently I have a lot to learn before I can even start to learn programming through games ? my ambitions have greatly exceeded my capabilities. Any assistance regarding this matter would be greatly appreciated. If there's a better or more useful place to post this message please let me know. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From arthamax at sbcglobal.net Mon Jun 29 21:30:19 2009 From: arthamax at sbcglobal.net (arthamax at sbcglobal.net) Date: Mon, 29 Jun 2009 12:30:19 -0700 Subject: [Pythonmac-SIG] Installing Pygame Message-ID: <90D0B657-7DD6-472D-9963-D63F0F46825F@sbcglobal.net> I am using a Mac PPC with Tiger 10.4.11 and I recently downloaded and installed Python 2.6.2. and I am having difficulties getting started. I purchased "Python Programming, 2nd Ed. for the absolute beginner" by Michael Dawson because he uses games to teach programming and the book got great reviews at Amazon.com. When I opened the CD that came with the Python book I could not open the software (Pygame, Livewires, etc.) and I could find no reference to Mac or Windows unless it was in the file names which I don't know. I went to the Pygame website http://www.pygame.org/download.shtml "Macintosh" to download Pygame "These are packages for the python from python.org, not the system python. These packages work with OSX 10.3.9 upwards. # pygame-1.8.1release-py2.5-macosx10.5.zip # pygame-1.8.1release-py2.4-macosx10.5.zip # pyobjc-1.4-py2.5-macosx10.4.mpkg.zip - pyobjc is needed for OSX 10.3, 10.4, and 10.5." and for the first time using this Mac I couldn't install anything. All three installation attempts ended with a red exclamation point over the Macintosh HD icon and a button saying "Go Back." The "Continue" button was grayed out. In the Pygame Readme it says, Installation You should definitely begin by installing a binary package for your system. The binary packages usually come with or give the information needed for dependencies. Choose an appropriate installer for your system and version of python from the pygame downloads page. http:// www.pygame.org/download.shtml I don't know what a "binary package" is or where to get one. Nor do I know what "dependencies" are. Apparently I have a lot to learn before I can even start to learn programming through games ? my ambitions have greatly exceeded my present capabilities. Any assistance regarding this matter would be greatly appreciated. If there's a better or more useful place to post this message please let me know. Thank you. P.S. I like the idea of learning programming through games so much that I also purchased Dawson's highly rated book "Beginning C++ Through Game Programming, 2nd Ed" which I haven't looked at yet. I don't want to open the CD in case I have to send both books back to Amazon.com which I don't really want to do. Has anyone here used Michael Dawson's books and can they be made to work on a Mac? Thanks again. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pythonmac at rebertia.com Mon Jun 29 21:56:56 2009 From: pythonmac at rebertia.com (Chris Rebert) Date: Mon, 29 Jun 2009 12:56:56 -0700 Subject: [Pythonmac-SIG] Installing Pygame In-Reply-To: References: Message-ID: <50697b2c0906291256w590c9055uf07bafead1786be9@mail.gmail.com> On Sun, Jun 28, 2009 at 6:14 PM, wrote: > Hi, > I am using a Mac PPC with Tiger 10.4.11 and I recently downloaded and > installed Python 2.6.2. and I am having difficulties getting started. > I purchased "Python Programming, 2nd Ed. for the absolute beginner" by > Michael Dawson because he uses games to teach programming and the book got > great reviews at Amazon.com. > When I opened the CD that came with the Python book I could not open the > software (Pygame, Livewires, etc.) and there was no reference to Mac or > Windows unless it was in the file names which I don't know. > I went to Pygame website > http://www.pygame.org/download.shtml > "Macintosh" to download Pygame > "These are packages for the python from python.org, not the system python. > These packages work with OSX 10.3.9 upwards. > # pygame-1.8.1release-py2.5-macosx10.5.zip > # pygame-1.8.1release-py2.4-macosx10.5.zip > # pyobjc-1.4-py2.5-macosx10.4.mpkg.zip - pyobjc is needed for OSX 10.3, > 10.4, and 10.5." > and for the first time using this Mac I couldn't install anything. All three > installation attempts ended with a red exclamation point over the Macintosh > HD icon and a button saying "Go Back." The "Continue" button was grayed out. > What am I missing? > Setting up Python to learn through Dawson's book is becoming too much for me > and I haven't even looked at Livewires and the other stuff. Has any Mac > users here worked with this book or know where I can go for further > assistance? I'm just about ready to send it back to Amazon.com (along with I haven't used Pygame, but you could try installing Fink (http://www.finkproject.org/index.php) and then installing Python and Pygame through it. I've had very good experiences installing Python packages thru Fink. Cheers, Chris -- http://blog.rebertia.com From lists at mostrom.pp.se Tue Jun 30 00:10:36 2009 From: lists at mostrom.pp.se (=?UTF-8?Q?Ja=6E_E=72ik_M=6Fs=74=72=C3=B6?= =?UTF-8?Q?m?=) Date: Tue, 30 Jun 2009 00:10:36 +0200 Subject: [Pythonmac-SIG] Trying to use appscript need some help Message-ID: I'm trying to learn how to use appscript but I don't understand what I'm missing. I want to read photo info from iPhoto and have things working ... partly The script looks like this from appscript import * selected = app('iPhoto').selection.get() for item in selected: print 'Width : ', item.width.get() print 'Height : ', item.height.get() print 'Path : ', item.image_path.get() print 'Comment : ', item.comment.get().encode('utf-8') print 'Title : ', item.title.get().encode('utf-8') # set ptitle to date of item 1 of the selection # app(u'iPhoto').selection.items[1].date.get() print 'Date : ', item.date.get() # AttributeError: Unknown property, element or command: 'date' The problem is the line where I try to get the date info, the first commented line is the applescript line I'm trying to translate, the second is what ASTranslate tells me, and the third is the error message I get. Does anyone have a suggestion what I'm missing? jem -- Jan Erik Mostr?m, http://mostrom.eu From sato.photo at gmail.com Tue Jun 30 00:59:34 2009 From: sato.photo at gmail.com (Daniel Sato) Date: Mon, 29 Jun 2009 15:59:34 -0700 Subject: [Pythonmac-SIG] GASP on OSX 10.5.6 Message-ID: Hi, I am a complete python beginner. I have been going through How to Think Like A Computer Scientist 2nd edition online and have come across installing GASP in chapter 4. Unfortunately, I can't seem to find much documentation on how to install GASP when running OSX and Python 2.6.2. Any help would be greatly appreciated. Thanks! -Daniel -- Daniel Sato http://www.danielsato.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From pythonmac at rebertia.com Tue Jun 30 01:06:20 2009 From: pythonmac at rebertia.com (Chris Rebert) Date: Mon, 29 Jun 2009 16:06:20 -0700 Subject: [Pythonmac-SIG] GASP on OSX 10.5.6 In-Reply-To: References: Message-ID: <50697b2c0906291606l57cfc85akc7aed40aae3c59f2@mail.gmail.com> On Mon, Jun 29, 2009 at 3:59 PM, Daniel Sato wrote: > Hi, > > I am a complete python beginner.? I have been going through How to Think > Like A Computer Scientist 2nd edition online and have come across installing > GASP in chapter 4.? Unfortunately, I can't seem to find much documentation > on how to install GASP when running OSX and Python 2.6.2.? Any help would be > greatly appreciated. Mac OS X apparently not a supported platform: https://answers.launchpad.net/gasp-code/+faq/42 Cheers, Chris -- http://blog.rebertia.com From janssen at parc.com Tue Jun 30 02:07:30 2009 From: janssen at parc.com (Bill Janssen) Date: Mon, 29 Jun 2009 17:07:30 PDT Subject: [Pythonmac-SIG] Installing Pygame In-Reply-To: References: Message-ID: <16243.1246320450@parc.com> My two cents: Don't try to install a new Python on OS X. Just use /usr/bin/python. arthamax at sbcglobal.net wrote: > I am using a Mac PPC with Tiger 10.4.11 and I recently downloaded and > installed Python 2.6.2. and I am having difficulties getting started. What are you trying to do, learn Python? If so, don't mess around with games or any other package that requires you to use lots of extra packages that don't come with the standard Python. The Python that comes with Tiger is 2.3.5, a bit out of date but very stable and a good starting point. Work through the Python tutorial at http://www.python.org/doc/2.3.5/tut/tut.html. > I purchased "Python Programming, 2nd Ed. for the absolute beginner" by > Michael Dawson because he uses games to teach programming and the > book got great reviews at Amazon.com. Well, games are great, once you know what you're doing. One step at a time. I don't see any pygame downloads for 10.4, so I wouldn't try to use it till I had some understanding of how to build it from scratch. Bill From dwf at cs.toronto.edu Tue Jun 30 03:11:13 2009 From: dwf at cs.toronto.edu (David Warde-Farley) Date: Mon, 29 Jun 2009 21:11:13 -0400 Subject: [Pythonmac-SIG] GASP on OSX 10.5.6 In-Reply-To: <50697b2c0906291606l57cfc85akc7aed40aae3c59f2@mail.gmail.com> References: <50697b2c0906291606l57cfc85akc7aed40aae3c59f2@mail.gmail.com> Message-ID: <39213C23-2412-434A-83B8-6543388AECF7@cs.toronto.edu> On 29-Jun-09, at 7:06 PM, Chris Rebert wrote: > Mac OS X apparently not a supported platform: > https://answers.launchpad.net/gasp-code/+faq/42 It looks like the code is pure python and depends on pycairo, so in theory it should work provided cairo which has a Quartz backend) and pycairo work (and possibly pygame). MacPorts has cairo and I imagine pycairo is easy_install'able. It's unfortunately a lot of work for a beginner... David From dav at alum.mit.edu Tue Jun 30 04:40:06 2009 From: dav at alum.mit.edu (Dav Clark) Date: Mon, 29 Jun 2009 19:40:06 -0700 Subject: [Pythonmac-SIG] Installing Pygame In-Reply-To: <16243.1246320450@parc.com> References: <16243.1246320450@parc.com> Message-ID: <00185D36-9346-4E64-8EF6-64B66FE0BCCA@alum.mit.edu> On Jun 29, 2009, at 5:07 PM, Bill Janssen wrote: > I don't see any pygame downloads for 10.4, so I wouldn't try to use it > till I had some understanding of how to build it from scratch. From Macintosh section on http://pygame.org/download.shtml "These are packages for the python from python.org, not the system python. These packages work with OSX 10.3.9 upwards." Note - you will need to use the pyobjc installer (first) as well. Cheers, Dav From dav at alum.mit.edu Tue Jun 30 04:44:28 2009 From: dav at alum.mit.edu (Dav Clark) Date: Mon, 29 Jun 2009 19:44:28 -0700 Subject: [Pythonmac-SIG] Installing Pygame In-Reply-To: <90D0B657-7DD6-472D-9963-D63F0F46825F@sbcglobal.net> References: <90D0B657-7DD6-472D-9963-D63F0F46825F@sbcglobal.net> Message-ID: <9623938A-9C7F-49EC-929A-AE012A8932C1@alum.mit.edu> (I accidentally sent this just to arthamax) Pygame is the most difficult package I've installed by hand on the mac. I suspect the fink approach would be the easiest if you insist on python 2.6 and it supports pygame all with binary packages. I use MacPorts, which I've found to be more up-to-date and integrated with OSX (at least for scientific python type stuff), but with that you'll be building software for a good many hours! The nastiest requirement for building pygame was pyobjc. Now that you can easy-install pyobjc, it is a lot easier, but still non-trivial. There are also a number of SDL frameworks that need to be installed. And also numpy. You will also need to install Xcode and also a fortran compiler. You'll probably want to install a recent setuptools as well to get easy-install. The installers for pygame are pretty simple-minded - they will only install to a "framework" build (which you download from python.org, NOT pre-installed on your system) of the corresponding version (i.e. 2.4 or 2.5). BUT - if you install a framework build of python 2.4 or 2.5, the pygame (and pyobjc) installers do it all. Honestly, you will gain little by the latest-and-greatest python 2.6.2. Python 2.5 supports most modern python idioms, and you can just run the pygame installer and you're done. Your book includes a windows installer for python 2.3! So, I'm sure you won't miss much. If I were starting a new project that didn't really depend on pygame, I'd use pyglet. Based on my minimal experience, it is far easier to install and somewhat nicer with its event-loop semantics and text handling. You might also look at vpython for a graphics presentation framework that was designed with teaching in mind - they have some nice tutorials on their homepage. Cheers, Dav On Jun 29, 2009, at 12:30 PM, arthamax at sbcglobal.net wrote: > I am using a Mac PPC with Tiger 10.4.11 and I recently downloaded > and installed Python 2.6.2. and I am having difficulties getting > started. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan at rosspixelworks.com Tue Jun 30 14:30:18 2009 From: dan at rosspixelworks.com (Dan Ross) Date: Tue, 30 Jun 2009 07:30:18 -0500 (CDT) Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework Message-ID: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> I currently use a Framework of 2.6.2 for my Python work but I always see a lot of posts about using Fink or MacPorts builds. Could anyone shed some light on why they use these rather than a Framework? Advantages/disadvantages? Thanks, Dan From alexandre at quessy.net Tue Jun 30 15:11:00 2009 From: alexandre at quessy.net (Alexandre Quessy) Date: Tue, 30 Jun 2009 09:11:00 -0400 Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework In-Reply-To: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> References: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> Message-ID: <72236ba90906300611y2efdd2cel990ead26ee2da815@mail.gmail.com> Hi ! Seems to me there are a lot of python packages that are available through the MacPorts. In the built-in framework, there are only a few basic packages. Fink gives the same benefits than MacPorts, but there might be fewer packages available though it than through MacPorts. That's why I use MacPorts. Is this right ? a 2009/6/30 Dan Ross : > I currently use a Framework of 2.6.2 for my Python work but I always see a > lot of posts about using Fink or MacPorts builds. > > Could anyone shed some light on why they use these rather than a Framework? > > Advantages/disadvantages? > > Thanks, > > Dan > > _______________________________________________ > Pythonmac-SIG maillist ?- ?Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- Alexandre Quessy http://alexandre.quessy.net/ From dan at rosspixelworks.com Tue Jun 30 17:11:15 2009 From: dan at rosspixelworks.com (Dan Ross) Date: Tue, 30 Jun 2009 10:11:15 -0500 (CDT) Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework In-Reply-To: <72236ba90906300611y2efdd2cel990ead26ee2da815@mail.gmail.com> References: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> <72236ba90906300611y2efdd2cel990ead26ee2da815@mail.gmail.com> Message-ID: <64504.66.43.195.184.1246374675.squirrel@rosspixelworks.com> I'm not sure I understand what you mean. I can certainly add any packages I like to my Framework build so I don't think availability of packages is a concern. Unless I'm misinterpreting the term "packages"? On Tue, June 30, 2009 8:11 am, Alexandre Quessy wrote: > Hi ! > Seems to me there are a lot of python packages that are available > through the MacPorts. In the built-in framework, there are only a few > basic packages. Fink gives the same benefits than MacPorts, but there > might be fewer packages available though it than through MacPorts. > That's why I use MacPorts. > Is this right ? > > a > > 2009/6/30 Dan Ross : >> I currently use a Framework of 2.6.2 for my Python work but I always see >> a >> lot of posts about using Fink or MacPorts builds. >> >> Could anyone shed some light on why they use these rather than a >> Framework? >> >> Advantages/disadvantages? >> >> Thanks, >> >> Dan >> >> _______________________________________________ >> Pythonmac-SIG maillist ?- ?Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> > > > > -- > Alexandre Quessy > http://alexandre.quessy.net/ > From santagada at gmail.com Tue Jun 30 18:50:51 2009 From: santagada at gmail.com (Leonardo Santagada) Date: Tue, 30 Jun 2009 13:50:51 -0300 Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework In-Reply-To: <64504.66.43.195.184.1246374675.squirrel@rosspixelworks.com> References: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> <72236ba90906300611y2efdd2cel990ead26ee2da815@mail.gmail.com> <64504.66.43.195.184.1246374675.squirrel@rosspixelworks.com> Message-ID: <73173DAD-406B-4CB5-B025-470CF1465BE9@gmail.com> On Jun 30, 2009, at 12:11 PM, Dan Ross wrote: > I'm not sure I understand what you mean. > > I can certainly add any packages I like to my Framework build so I > don't > think availability of packages is a concern. > > Unless I'm misinterpreting the term "packages"? Pygame for example, that is a pain to build right, is avaliable in macports, the same with subversion bindings and so on. The macport version of python 2.5 and 2.6 is a framework build so it is almost the same as the default leopard python sans dtrace support and probably the same as python.org ones. So it is just advantages in using the macports one I think :) -- Leonardo Santagada santagada at gmail.com From janssen at parc.com Tue Jun 30 18:54:10 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 30 Jun 2009 09:54:10 PDT Subject: [Pythonmac-SIG] Installing Pygame In-Reply-To: <00185D36-9346-4E64-8EF6-64B66FE0BCCA@alum.mit.edu> References: <16243.1246320450@parc.com> <00185D36-9346-4E64-8EF6-64B66FE0BCCA@alum.mit.edu> Message-ID: <26046.1246380850@parc.com> Dav Clark wrote: > On Jun 29, 2009, at 5:07 PM, Bill Janssen wrote: > > > I don't see any pygame downloads for 10.4, so I wouldn't try to use it > > till I had some understanding of how to build it from scratch. > > From Macintosh section on http://pygame.org/download.shtml > > "These are packages for the python from python.org, not the system > python. These packages work with OSX 10.3.9 upwards." Yes, indeed! I was looking at http://code.google.com/p/pygame/downloads/list, for some reason. Still, complicated for a beginner. SDL, for heaven's sake! Bill From janssen at parc.com Tue Jun 30 19:01:56 2009 From: janssen at parc.com (Bill Janssen) Date: Tue, 30 Jun 2009 10:01:56 PDT Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework In-Reply-To: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> References: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> Message-ID: <26134.1246381316@parc.com> Dan Ross wrote: > I currently use a Framework of 2.6.2 for my Python work but I always see a > lot of posts about using Fink or MacPorts builds. > > Could anyone shed some light on why they use these rather than a Framework? > > Advantages/disadvantages? I think the big reason is that they are an integrated system rather than separate installs and typically no way to uninstall. Easy to add/remove/upgrade stuff, without having to know how everything works. Of course, OS X isn't really designed to support either. So you take your chances with OS upgrades. I used Fink in 2003-2004, and found that it got me into lots of hard-to-diagnose trouble, due to minor inconsistencies between Fink packages, and between Fink system assumptions and OS X system assumptions. I finally gave up on it, re-installed my system to get rid of any /sw bits, and have since then always installed open source packages from source. Sometimes it takes a bit longer, but at least I can figure out what's happening. (This was a few years ago; Fink may have improved mightily since then, for all I know.) Bill From kw at codebykevin.com Tue Jun 30 19:03:46 2009 From: kw at codebykevin.com (Kevin Walzer) Date: Tue, 30 Jun 2009 13:03:46 -0400 Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework In-Reply-To: <73173DAD-406B-4CB5-B025-470CF1465BE9@gmail.com> References: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> <72236ba90906300611y2efdd2cel990ead26ee2da815@mail.gmail.com> <64504.66.43.195.184.1246374675.squirrel@rosspixelworks.com> <73173DAD-406B-4CB5-B025-470CF1465BE9@gmail.com> Message-ID: <4A4A4572.10108@codebykevin.com> Leonardo Santagada wrote: > > On Jun 30, 2009, at 12:11 PM, Dan Ross wrote: > >> I'm not sure I understand what you mean. >> >> I can certainly add any packages I like to my Framework build so I don't >> think availability of packages is a concern. >> >> Unless I'm misinterpreting the term "packages"? > > > Pygame for example, that is a pain to build right, is avaliable in > macports, the same with subversion bindings and so on. > > The macport version of python 2.5 and 2.6 is a framework build so it is > almost the same as the default leopard python sans dtrace support and > probably the same as python.org ones. > > So it is just advantages in using the macports one I think :) > > This is the main reason to use a packaging system like MacPorts or Fink--if you have a complicated set of libraries to build, they can streamline things. Otherwise there is no particular advantage to using them. -- Kevin Walzer Code by Kevin http://www.codebykevin.com From dan at rosspixelworks.com Tue Jun 30 19:09:55 2009 From: dan at rosspixelworks.com (Dan Ross) Date: Tue, 30 Jun 2009 12:09:55 -0500 Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework In-Reply-To: <73173DAD-406B-4CB5-B025-470CF1465BE9@gmail.com> References: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> <72236ba90906300611y2efdd2cel990ead26ee2da815@mail.gmail.com> <64504.66.43.195.184.1246374675.squirrel@rosspixelworks.com> <73173DAD-406B-4CB5-B025-470CF1465BE9@gmail.com> Message-ID: <4A4A46E2.9050403@rosspixelworks.com> That makes a great deal of sense. I tried to mess with pygame at one time, but as you stated, it was such a pain to build I gave up. Leonardo Santagada wrote: > On Jun 30, 2009, at 12:11 PM, Dan Ross wrote: > >> I'm not sure I understand what you mean. >> >> I can certainly add any packages I like to my Framework build so I don't >> think availability of packages is a concern. >> >> Unless I'm misinterpreting the term "packages"? > > > Pygame for example, that is a pain to build right, is avaliable in > macports, the same with subversion bindings and so on. > > The macport version of python 2.5 and 2.6 is a framework build so it > is almost the same as the default leopard python sans dtrace support > and probably the same as python.org ones. > > So it is just advantages in using the macports one I think :) > > > -- > Leonardo Santagada > santagada at gmail.com From martin.laloux at gmail.com Tue Jun 30 19:50:03 2009 From: martin.laloux at gmail.com (genemartin) Date: Tue, 30 Jun 2009 10:50:03 -0700 (PDT) Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework In-Reply-To: <26134.1246381316@parc.com> References: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> <26134.1246381316@parc.com> Message-ID: <24276543.post@talk.nabble.com> My experience shows me that using fink or macports with python framework create problems with version mismatches and library duplication. So now, I only use the framework because i want to learn. With a little patience and trying a lot (with the help of google), I gradually install what I want, even pygame pygame but I must admit it was a bit complicated.... -- View this message in context: http://www.nabble.com/Fink-vs-MacPorts-vs-Framework-tp24271594p24276543.html Sent from the Python - pythonmac-sig mailing list archive at Nabble.com. From hengist.podd at virgin.net Tue Jun 30 21:15:30 2009 From: hengist.podd at virgin.net (has) Date: Tue, 30 Jun 2009 20:15:30 +0100 Subject: [Pythonmac-SIG] Trying to use appscript need some help In-Reply-To: References: Message-ID: <1A76DCF6-7539-4C1E-93B6-9726FFD497F2@virgin.net> Jan Erik Mostr?m wrote: > I'm trying to learn how to use appscript but I don't understand what > I'm missing. I want to read photo info from iPhoto and have things > working ... partly > [...] > # set ptitle to date of item 1 of the selection > # app(u'iPhoto').selection.items[1].date.get() > print 'Date : ', item.date.get() > # AttributeError: Unknown property, element or command: 'date' > > The problem is the line where I try to get the date info, the first > commented line is the applescript line I'm trying to translate, the > second is what ASTranslate tells me, and the third is the error > message I get. ASTranslate is wrong here; it should be 'date_' with a trailing underscore, not 'date'. In situations where application-defined terms conflict with built-in terms (i.e. use the same keyword but a different four-char code), appscript appends an underscore to the application-defined term to prevent any problems. There was a known inconsistency in how older versions of appscript applied these escapes; that has been fixed in the latest appscript and ASDictionary releases, but I've not had time to update ASTranslate yet. Meantime, if in doubt, go by the appscript-style dictionary, which you can export as HTML from ASDictionary or browse via appscript's built- in help() method (see the appscript manual for details). HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net From santagada at gmail.com Tue Jun 30 21:21:29 2009 From: santagada at gmail.com (Leonardo Santagada) Date: Tue, 30 Jun 2009 16:21:29 -0300 Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework In-Reply-To: <24276543.post@talk.nabble.com> References: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> <26134.1246381316@parc.com> <24276543.post@talk.nabble.com> Message-ID: <20D27D42-3368-45A5-9D69-0DE3F593355F@gmail.com> On Jun 30, 2009, at 2:50 PM, genemartin wrote: > > My experience shows me that using fink or macports with python > framework > create problems with version mismatches and library duplication. So > now, I > only use the framework because i want to learn. With a little > patience and > trying a lot (with the help of google), I gradually install what I > want, > even pygame pygame but I must admit it was a bit complicated.... You meant using a macports framework build or having both macports and python.org versions? The former and maybe the later (I never tried) you can fix installing python_select and selecting the right python version from its list. So this simple command can save a lot of pain for new macports python users: $ sudo -s # port install python25 python_select # python_select python25 (or python26) -- Leonardo Santagada santagada at gmail.com From martin.laloux at gmail.com Tue Jun 30 22:03:28 2009 From: martin.laloux at gmail.com (genemartin) Date: Tue, 30 Jun 2009 13:03:28 -0700 (PDT) Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework In-Reply-To: <20D27D42-3368-45A5-9D69-0DE3F593355F@gmail.com> References: <62783.66.43.195.184.1246365018.squirrel@rosspixelworks.com> <26134.1246381316@parc.com> <24276543.post@talk.nabble.com> <20D27D42-3368-45A5-9D69-0DE3F593355F@gmail.com> Message-ID: <24278207.post@talk.nabble.com> Thanks but I do not want MacPorts or fink, I want to do it myself with only the tools of mac os x -- View this message in context: http://www.nabble.com/Fink-vs-MacPorts-vs-Framework-tp24271594p24278207.html Sent from the Python - pythonmac-sig mailing list archive at Nabble.com. From cs at zip.com.au Tue Jun 30 23:46:16 2009 From: cs at zip.com.au (Cameron Simpson) Date: Wed, 1 Jul 2009 07:46:16 +1000 Subject: [Pythonmac-SIG] Fink vs MacPorts vs Framework In-Reply-To: <64504.66.43.195.184.1246374675.squirrel@rosspixelworks.com> Message-ID: <20090630214616.GA25491@cskk.homeip.net> On 30Jun2009 10:11, Dan Ross wrote: | I'm not sure I understand what you mean. | I can certainly add any packages I like to my Framework build so I don't | think availability of packages is a concern. | Unless I'm misinterpreting the term "packages"? Yeah. You mean "package" == "python module", yes? I believe he means "packge" == "app install", a MacPorts or Fink level "package"; you can install python 2.5 and/or python 2.6 with MacPorts and use each as needed. That said, I use python out of MacPorts, at least when I need 2.6. Cheers, -- Cameron Simpson DoD#743 http://www.cskk.ezoshosting.com/cs/ Trust the computer... the computer is your friend. - Richard Dominelli