From donbro at mac.com Tue Nov 1 02:26:27 2005 From: donbro at mac.com (Laura McColm) Date: Mon, 31 Oct 2005 17:26:27 -0800 Subject: [Pythonmac-SIG] In Mac/Modules/file/_Filemodule.c dataLogicalSize, etc., should be UInt64 ("L") Message-ID: <12983857.1130808387992.JavaMail.donbro@mac.com> Greetings All! I am moving a document management app from C++/OS9 to Python/OSX Carbon and I am delighted with the functionality I'm finding in the MacOS specific extension modules. Just what I needed! But I was dismayed to be unable to get anything but the value 0L for the file sizes (dataLogicalSize, dataPhysicalSize, rsrcLogicalSize, rsrcPhysicalSize) in the catinfo structure returned by FSRef.FSGetCatalogInfo(). Python 2.3 and 2.4.2 (and 2.5!) on MacOS 10.3.9 returns 0L for the various file size values and correct values for other elements in the structure such as parentDirID: >>> fsRef = FSRef('LICENSE') >>> catinfo, d1, d2, d3 ?= fsRef.FSGetCatalogInfo(-1L) >>> catinfo.dataPhysicalSize 0 >>> catinfo.parentDirID 2026177 I'm new to the mechanisms inside the extensions themselves, but it looks to me that the routines building the return values (such as FSCatalogInfo_get_dataLogicalSize() in source file Mac/Modules/file/_Filemodule.c) should specify UInt64 instead of UInt32. static PyObject *FSCatalogInfo_get_dataLogicalSize(FSCatalogInfoObject *self, void *closure) { return Py_BuildValue("l", self->ob_itself.dataLogicalSize); } Should change the "l" to "L" in each of the four routines: static PyObject *FSCatalogInfo_get_dataLogicalSize(FSCatalogInfoObject *self, void *closure) { return Py_BuildValue("L", self->ob_itself.dataLogicalSize); } Works fine now: manny:~/dev/python/dist/src donb$ ./python.exe Python 2.5a0 (#1, Oct 31 2005, 01:18:46) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from Carbon.File import FSRef >>> fsRef = FSRef('LICENSE') >>> catinfo, d1, d2, d3 = fsRef.FSGetCatalogInfo(-1L) >>> catinfo.dataLogicalSize 13423L >>> ^D But my questions are: Has anyone else seen this? The os.stat() function returns a "unix-like" file size, i.e. data fork only, and I needed the "Mac-like" size (catinfo.dataLogicalSize+catinfo.rsrcLogicalSize) Does this seem like the right fix? Am I catching all the implications? There is another routine in _Filemodule.c: static int FSCatalogInfo_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds) { static char *kw[] = { [...] "dataLogicalSize", "dataPhysicalSize", "rsrcLogicalSize", "rsrcPhysicalSize", [...] , 0}; if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|HhllO&O&O&O&O&llllllb", kw, &((FSCatalogInfoObject *)_self)->ob_itself.nodeFlags, [...] This also seems to hold information about parameter size. Should these four "l"'s be changed as well? (My intuition/luck is running out here, guess I'll have to read up on what all of these mechanisms are actually doing :-) If this is a good patch, what's the best place to submit this? Sourceforge? This mailing list? Since I'm porting a MacOS9 application from C++ to Python I'm prepared to spend some time with Python and the extension mechanisms in the near future! Thanks for any help Don From bob at redivi.com Tue Nov 1 02:51:54 2005 From: bob at redivi.com (Bob Ippolito) Date: Mon, 31 Oct 2005 17:51:54 -0800 Subject: [Pythonmac-SIG] In Mac/Modules/file/_Filemodule.c dataLogicalSize, etc., should be UInt64 ("L") In-Reply-To: <12983857.1130808387992.JavaMail.donbro@mac.com> References: <12983857.1130808387992.JavaMail.donbro@mac.com> Message-ID: <8A6D157C-A5E6-4EEE-8263-769BEDCE36F1@redivi.com> On Oct 31, 2005, at 5:26 PM, Laura McColm wrote: > Greetings All! > > I am moving a document management app from C++/OS9 to Python/ > OSX Carbon and I am delighted with the functionality I'm finding in > the MacOS specific extension modules. Just what I needed! But I > was dismayed to be unable to get anything but the value 0L for the > file sizes (dataLogicalSize, dataPhysicalSize, rsrcLogicalSize, > rsrcPhysicalSize) in the catinfo structure returned by > FSRef.FSGetCatalogInfo(). > > Python 2.3 and 2.4.2 (and 2.5!) on MacOS 10.3.9 returns 0L for > the various file size > values and correct values for other elements in the structure such > as parentDirID: That's a bug :) > I'm new to the mechanisms inside the extensions themselves, but it > looks to me that the routines building the return values (such as > FSCatalogInfo_get_dataLogicalSize() in source file Mac/Modules/file/ > _Filemodule.c) should specify UInt64 instead of UInt32. > > static PyObject *FSCatalogInfo_get_dataLogicalSize(FSCatalogInfoObject > *self, void *closure) > { > return Py_BuildValue("l", self->ob_itself.dataLogicalSize); > > } > > Should change the "l" to "L" in each of the four routines: Should be "K" actually, those are UInt64.. though, god help you if your file is big enough to hit the sign bit on a 64-bit number! :) > But my questions are: > > Has anyone else seen this? The os.stat() function returns a "unix- > like" file size, i.e. data fork only, and I needed the "Mac-like" > size (catinfo.dataLogicalSize+catinfo.rsrcLogicalSize) > > Does this seem like the right fix? Am I catching all the > implications? Well if you're hard pressed to get something that works right now without building a custom Python, you can try: def getResourceSize(fn): if os.path.exists(fn + "/..namedfork/rsrc"): # "Private" API for HFS partitions return os.path.getsize(fn + "/..namedfork/rsrc") if os.path.exists("._" + fn): # Non-HFS API for storing resforks return os.path.getsize("._" + fn) return 0 def getFullSize(fn): return os.path.getsize(fn) + getResourceSize(fn) Someday this might break if Apple decides to support extended attributes on UFS/NFS/etc. partitions and to store the resource forks there instead of in "._" files, though. That's probably unlikely though. > There is another routine in _Filemodule.c: > > static int FSCatalogInfo_tp_init(PyObject *_self, PyObject *_args, > PyObject *_kwds) > { > static char *kw[] = { > [...] > "dataLogicalSize", > "dataPhysicalSize", > "rsrcLogicalSize", > "rsrcPhysicalSize", > [...] > , 0}; > > if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "| > HhllO&O&O&O&O&llllllb", kw, &((FSCatalogInfoObject *)_self)- > >ob_itself.nodeFlags, > [...] > > > This also seems to hold information about parameter size. Should > these four "l"'s be changed as well? (My intuition/luck is running > out here, guess I'll have to read up on what all of these > mechanisms are actually doing :-) Yeah, they should be changed. The Python C API is quite simple and well documented, easy to double-check your (almost correct) guesses: http://docs.python.org/api/ > If this is a good patch, what's the best place to submit this? > Sourceforge? This mailing list? Sourceforge > Since I'm porting a MacOS9 application from C++ to Python I'm > prepared to spend some time with Python and the extension > mechanisms in the > near future! Normally you shouldn't have to deal with Python's internals, but the MacOS-specific stuff that ships with Python was all written in the pre-Carbon era and a lot of it is/was automatically generated and never verified against reality. I'd avoid anything in the MacOS or Carbon packages unless you absolutely need that functionality and you can't get it elsewhere (e.g. from Cocoa via PyObjC). -bob From gm770 at nyc.rr.com Wed Nov 2 04:24:36 2005 From: gm770 at nyc.rr.com (Richard Rodriguez) Date: Tue, 1 Nov 2005 22:24:36 -0500 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app Message-ID: <008401c5df5c$f41613c0$0502a8c0@giga> I created a python cgi-server, and generate web pages with python. After getting past the main mac issues, I'm down to the last 1, a stand-alone app. My "py2app" generated app works, except that it is looking at the installed python for something. I didn't notice until I tried on a mac without python, and after renaming the folder where I have python installed. here's my error: localhost - - [01/Nov/2005 13:00:06] dyld: /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/Frameworks/Python.framework/Versions/2.4/bin/python can't open library: /Library/Frameworks/Python.framework/Versions/2.4/Python (No such file or directory, errno = 2) The library it's trying to open is the version installed locally, when it should be looking at the library inside "webdemo.app". Most likly a path problem. My guess is that I can fix this by modifying my py2app setup script, but don't understand how. Any help would be great. Below is the rest of my setup and errors: ------ file info ------ "webdemo.app" - the cgi web-server cgi-bin/test_real3.py - generates html page /Library/Frameworks/Python.framework - this is the locally installed python /Users/mayu/Desktop/dist_win_10_25_05/ - this is where the py2app generated mac app is located ------- my simple setup script for py2app ---------- # setup.py from distutils.core import setup import py2app setup(app=["webdemo.py"]) ------- full list of console messages ---------- serving at port 1770 localhost - - [01/Nov/2005 13:00:05] "GET /cgi-bin/test_real3.py HTTP/1.1" 200 - localhost - - [01/Nov/2005 13:00:05] Trying to execute scriptfile /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/Resources/cgi-bin/test_real3.py localhost - - [01/Nov/2005 13:00:05] command: /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/Frameworks/Python.framework/Versions/2.4/bin/python -u /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/Resources/cgi-bin/test_real3.py "" localhost - - [01/Nov/2005 13:00:06] dyld: /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/Frameworks/Python.framework/Versions/2.4/bin/python can't open library: /Library/Frameworks/Python.framework/Versions/2.4/Python (No such file or directory, errno = 2) localhost - - [01/Nov/2005 13:00:06] CGI script exited OK -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051101/d881056a/attachment.html From gm770 at nyc.rr.com Wed Nov 2 04:24:36 2005 From: gm770 at nyc.rr.com (Richard Rodriguez) Date: Tue, 1 Nov 2005 22:24:36 -0500 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app Message-ID: <008501c5df5d$885f0b90$0502a8c0@giga> I created a python cgi-server, and generate web pages with python. After getting past the main mac issues, I'm down to the last 1, a stand-alone app. My "py2app" generated app works, except that it is looking at the installed python for something. I didn't notice until I tried on a mac without python, and after renaming the folder where I have python installed. here's my error: localhost - - [01/Nov/2005 13:00:06] dyld: /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/Frameworks/Python.framework/Versions/2.4/bin/python can't open library: /Library/Frameworks/Python.framework/Versions/2.4/Python (No such file or directory, errno = 2) The library it's trying to open is the version installed locally, when it should be looking at the library inside "webdemo.app". Most likly a path problem. My guess is that I can fix this by modifying my py2app setup script, but don't understand how. Any help would be great. Below is the rest of my setup and errors: ------ file info ------ "webdemo.app" - the cgi web-server cgi-bin/test_real3.py - generates html page /Library/Frameworks/Python.framework - this is the locally installed python /Users/mayu/Desktop/dist_win_10_25_05/ - this is where the py2app generated mac app is located ------- my simple setup script for py2app ---------- # setup.py from distutils.core import setup import py2app setup(app=["webdemo.py"]) ------- full list of console messages ---------- serving at port 1770 localhost - - [01/Nov/2005 13:00:05] "GET /cgi-bin/test_real3.py HTTP/1.1" 200 - localhost - - [01/Nov/2005 13:00:05] Trying to execute scriptfile /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/Resources/cgi-bin/test_real3.py localhost - - [01/Nov/2005 13:00:05] command: /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/Frameworks/Python.framework/Versions/2.4/bin/python -u /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/Resources/cgi-bin/test_real3.py "" localhost - - [01/Nov/2005 13:00:06] dyld: /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/Frameworks/Python.framework/Versions/2.4/bin/python can't open library: /Library/Frameworks/Python.framework/Versions/2.4/Python (No such file or directory, errno = 2) localhost - - [01/Nov/2005 13:00:06] CGI script exited OK -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051101/fd1018d6/attachment.html From daavidb at gmail.com Wed Nov 2 15:38:21 2005 From: daavidb at gmail.com (David) Date: Wed, 2 Nov 2005 14:38:21 +0000 Subject: [Pythonmac-SIG] Using Sync Services from python Message-ID: <225C1B89-E0E2-4BD8-9C95-57F002E739A1@gmail.com> Does anyone know if it would be possible to use Sync Services from python, or from any other programming language than obj C? Can it be accessed through Apple Script? thanks /David From jurem at si.insilica.com Wed Nov 2 07:38:08 2005 From: jurem at si.insilica.com (Jure Menart) Date: Wed, 02 Nov 2005 07:38:08 +0100 Subject: [Pythonmac-SIG] Loading modules on MacOS In-Reply-To: <90ACA759-407E-43F1-B68B-9213345AE932@mac.com> References: <1137.193.111.223.171.1130655970.squirrel@193.111.223.171> <90ACA759-407E-43F1-B68B-9213345AE932@mac.com> Message-ID: <43685ED0.3050905@si.insilica.com> Hi, Ronald Oussoren wrote: > Why not build libcore_module1.dylib as one would normally do (and I > haven't done that yet, so can't help you there, -dynamiclib seems to > be the right way). Then use distutils to build the extensions, that > way the exentions get build how they should be. well, I'd like to use existing Makefiles because many python scripts are called during compilation (it is huge Makefile/Python compilation sistem :)) - I was already thinking about moving compilation to distutils - but there'd be too much things to rewrite, so I'm using distutils only for installation. I'll look into this option, when everything else fails. :/ For now I will investigate if .dylib is generated correctly - if there are any 'features' with dlcompat wrapper that I'm not familiar with. > What do you mean by 'hangs'? I suppose your script stops executing > when it hits the import statement, but the quotes make me curious. > You're correct - by 'hangs' I meant, that Python freezes, when import is called. Regards, Jure From jurem at si.insilica.com Wed Nov 2 08:28:37 2005 From: jurem at si.insilica.com (Jure Menart) Date: Wed, 02 Nov 2005 08:28:37 +0100 Subject: [Pythonmac-SIG] Loading modules on MacOS In-Reply-To: <43685ED0.3050905@si.insilica.com> References: <1137.193.111.223.171.1130655970.squirrel@193.111.223.171> <90ACA759-407E-43F1-B68B-9213345AE932@mac.com> <43685ED0.3050905@si.insilica.com> Message-ID: <43686AA5.50107@si.insilica.com> To answer myself: My compilation/linking and everything was OK, it was MacOS system problem. Here is link to the answer: http://lists.apple.com/archives/darwin-development/2002/Dec/msg00179.html Thanks for suggestions, Regards, Jure Menart Jure Menart wrote: > Hi, > > Ronald Oussoren wrote: > >> Why not build libcore_module1.dylib as one would normally do (and I >> haven't done that yet, so can't help you there, -dynamiclib seems to >> be the right way). Then use distutils to build the extensions, that >> way the exentions get build how they should be. > > > well, I'd like to use existing Makefiles because many python scripts are > called during compilation (it is huge Makefile/Python compilation sistem > :)) - I was already thinking about moving compilation to distutils - but > there'd be too much things to rewrite, so I'm using distutils only for > installation. > I'll look into this option, when everything else fails. :/ > > For now I will investigate if .dylib is generated correctly - if there > are any 'features' with dlcompat wrapper that I'm not familiar with. > >> What do you mean by 'hangs'? I suppose your script stops executing >> when it hits the import statement, but the quotes make me curious. >> > > You're correct - by 'hangs' I meant, that Python freezes, when import is > called. > > Regards, Jure > From ronaldoussoren at mac.com Wed Nov 2 20:14:42 2005 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 2 Nov 2005 20:14:42 +0100 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app In-Reply-To: <008501c5df5d$885f0b90$0502a8c0@giga> References: <008501c5df5d$885f0b90$0502a8c0@giga> Message-ID: <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> On 2-nov-2005, at 4:24, Richard Rodriguez wrote: > I created a python cgi-server, and generate web pages with python. > After getting past the main mac issues, I'm down to the last 1, a > stand-alone app. My "py2app" generated app works, except that it > is looking at the installed python for something. I didn't notice > until I tried on a mac without python, and after renaming the > folder where I have python installed. What does webdemo.py do? Does it execute test_real3.py in a seperate process (using os.popen or something like that)? Ronald > > here's my error: > localhost - - [01/Nov/2005 13:00:06] dyld: /Users/mayu/Desktop/ > dist_win_10_25_05/webdemo.app/Contents/Frameworks/Python.framework/ > Versions/2.4/bin/python > can't open library: /Library/Frameworks/Python.framework/Versions/ > 2.4/Python (No such file or directory, errno = 2) > > The library it's trying to open is the version installed locally, > when it should be looking at the library inside "webdemo.app". > Most likly a path problem. > My guess is that I can fix this by modifying my py2app setup > script, but don't understand how. > Any help would be great. > > > Below is the rest of my setup and errors: > ------ file info ------ > "webdemo.app" - the cgi web-server > cgi-bin/test_real3.py - generates html page > /Library/Frameworks/Python.framework - this is the locally > installed python > /Users/mayu/Desktop/dist_win_10_25_05/ - this is where the > py2app generated mac app is located > > ------- my simple setup script for py2app ---------- > # setup.py > from distutils.core import setup > import py2app > setup(app=["webdemo.py"]) > > ------- full list of console messages ---------- > serving at port 1770 > localhost - - [01/Nov/2005 13:00:05] "GET /cgi-bin/test_real3.py > HTTP/1.1" 200 - > localhost - - [01/Nov/2005 13:00:05] Trying to execute scriptfile > /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ > Resources/cgi-bin/test_real3.py > localhost - - [01/Nov/2005 13:00:05] command: > /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ > Frameworks/Python.framework/Versions/2.4/bin/python > -u /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ > Resources/cgi-bin/test_real3.py > "" > localhost - - [01/Nov/2005 13:00:06] dyld: > /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ > Frameworks/Python.framework/Versions/2.4/bin/python > can't open library: > /Library/Frameworks/Python.framework/Versions/2.4/Python (No such > file or directory, errno = 2) > localhost - - [01/Nov/2005 13:00:06] CGI script exited OK > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From gm770 at nyc.rr.com Wed Nov 2 20:38:14 2005 From: gm770 at nyc.rr.com (Richard Rodriguez) Date: Wed, 2 Nov 2005 14:38:14 -0500 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app References: <008501c5df5d$885f0b90$0502a8c0@giga> <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> Message-ID: <006401c5dfe4$f786eec0$0502a8c0@giga> "webdemo.py" opens a cgi server on a port, I'm using port 1770. It does this by using: BaseHTTPServer.HTTPServer This allows me to use a web browser, and open a python file, which is generating HTML A browser url would look like: http://localhost:1770/cgi-bin/test_real3.py So I have 2+ files, "webdemo" and a html page generator "test_real3.py" It seems as if the "webdemo" script, is using the corect "stand-alone" version of python, but the python file that responds to the URL call, seems to be looking in the wrong place. it's looking at the installed Python, instead of the stand-alone Python. It could be a path problem of some kind. ----- Original Message ----- From: "Ronald Oussoren" To: "Richard Rodriguez" Cc: Sent: Wednesday, November 02, 2005 2:14 PM Subject: Re: [Pythonmac-SIG] py2app generated app,not acting as a stand-alone app > > On 2-nov-2005, at 4:24, Richard Rodriguez wrote: > >> I created a python cgi-server, and generate web pages with python. >> After getting past the main mac issues, I'm down to the last 1, a >> stand-alone app. My "py2app" generated app works, except that it is >> looking at the installed python for something. I didn't notice until I >> tried on a mac without python, and after renaming the folder where I >> have python installed. > > What does webdemo.py do? Does it execute test_real3.py in a seperate > process (using os.popen or something like that)? > > Ronald > >> >> here's my error: >> localhost - - [01/Nov/2005 13:00:06] dyld: /Users/mayu/Desktop/ >> dist_win_10_25_05/webdemo.app/Contents/Frameworks/Python.framework/ >> Versions/2.4/bin/python >> can't open library: /Library/Frameworks/Python.framework/Versions/ >> 2.4/Python (No such file or directory, errno = 2) >> >> The library it's trying to open is the version installed locally, when >> it should be looking at the library inside "webdemo.app". Most likly a >> path problem. >> My guess is that I can fix this by modifying my py2app setup script, but >> don't understand how. >> Any help would be great. >> >> >> Below is the rest of my setup and errors: >> ------ file info ------ >> "webdemo.app" - the cgi web-server >> cgi-bin/test_real3.py - generates html page >> /Library/Frameworks/Python.framework - this is the locally installed >> python >> /Users/mayu/Desktop/dist_win_10_25_05/ - this is where the py2app >> generated mac app is located >> >> ------- my simple setup script for py2app ---------- >> # setup.py >> from distutils.core import setup >> import py2app >> setup(app=["webdemo.py"]) >> >> ------- full list of console messages ---------- >> serving at port 1770 >> localhost - - [01/Nov/2005 13:00:05] "GET /cgi-bin/test_real3.py >> HTTP/1.1" 200 - >> localhost - - [01/Nov/2005 13:00:05] Trying to execute scriptfile >> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >> Resources/cgi-bin/test_real3.py >> localhost - - [01/Nov/2005 13:00:05] command: >> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >> Frameworks/Python.framework/Versions/2.4/bin/python >> -u /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >> Resources/cgi-bin/test_real3.py >> "" >> localhost - - [01/Nov/2005 13:00:06] dyld: >> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >> Frameworks/Python.framework/Versions/2.4/bin/python >> can't open library: >> /Library/Frameworks/Python.framework/Versions/2.4/Python (No such >> file or directory, errno = 2) >> localhost - - [01/Nov/2005 13:00:06] CGI script exited OK >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > From ronaldoussoren at mac.com Wed Nov 2 20:55:42 2005 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 2 Nov 2005 20:55:42 +0100 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app In-Reply-To: <006401c5dfe4$f786eec0$0502a8c0@giga> References: <008501c5df5d$885f0b90$0502a8c0@giga> <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> <006401c5dfe4$f786eec0$0502a8c0@giga> Message-ID: <4DF3749B-EFE4-4EA0-83E4-B1B5F11280CA@mac.com> On 2-nov-2005, at 20:38, Richard Rodriguez wrote: > "webdemo.py" opens a cgi server on a port, I'm using port 1770. It > does this by using: BaseHTTPServer.HTTPServer > This allows me to use a web browser, and open a python file, which > is generating HTML > A browser url would look like: http://localhost:1770/cgi-bin/ > test_real3.py > > So I have 2+ files, "webdemo" and a html page generator > "test_real3.py" > It seems as if the "webdemo" script, is using the corect "stand- > alone" version of python, but the python file that responds to the > URL call, seems to be looking in the wrong place. it's looking at > the installed Python, instead of the stand-alone Python. It could > be a path problem of some kind. You didn't quite answer my question :-). How does webdemo execute the code in test_real3.py? Does it import it as a module or execute it like a real CGI script? If you execute test_real3.py as a separate process your setup.py doesn't work. Py2app copies just enough of /Libary/Framework/ Python.framework to supply the dependencies of the script named in setup.py (e.g. webdemo.py), and therefore might not include modules imported by test_real3.py. I'm amazed that py2app even bothers to include bin/python. It definitely does not rewrite the paths to shared libraries used by bin/python. Ronald > > > ----- Original Message ----- From: "Ronald Oussoren" > > To: "Richard Rodriguez" > Cc: > Sent: Wednesday, November 02, 2005 2:14 PM > Subject: Re: [Pythonmac-SIG] py2app generated app,not acting as a > stand-alone app > > >> >> On 2-nov-2005, at 4:24, Richard Rodriguez wrote: >> >>> I created a python cgi-server, and generate web pages with >>> python. After getting past the main mac issues, I'm down to the >>> last 1, a stand-alone app. My "py2app" generated app works, >>> except that it is looking at the installed python for >>> something. I didn't notice until I tried on a mac without >>> python, and after renaming the folder where I have python >>> installed. >> >> What does webdemo.py do? Does it execute test_real3.py in a >> seperate process (using os.popen or something like that)? >> >> Ronald >> >>> >>> here's my error: >>> localhost - - [01/Nov/2005 13:00:06] dyld: /Users/mayu/Desktop/ >>> dist_win_10_25_05/webdemo.app/Contents/Frameworks/ >>> Python.framework/ Versions/2.4/bin/python >>> can't open library: /Library/Frameworks/Python.framework/ >>> Versions/ 2.4/Python (No such file or directory, errno = 2) >>> >>> The library it's trying to open is the version installed >>> locally, when it should be looking at the library inside >>> "webdemo.app". Most likly a path problem. >>> My guess is that I can fix this by modifying my py2app setup >>> script, but don't understand how. >>> Any help would be great. >>> >>> >>> Below is the rest of my setup and errors: >>> ------ file info ------ >>> "webdemo.app" - the cgi web-server >>> cgi-bin/test_real3.py - generates html page >>> /Library/Frameworks/Python.framework - this is the locally >>> installed python >>> /Users/mayu/Desktop/dist_win_10_25_05/ - this is where the >>> py2app generated mac app is located >>> >>> ------- my simple setup script for py2app ---------- >>> # setup.py >>> from distutils.core import setup >>> import py2app >>> setup(app=["webdemo.py"]) >>> >>> ------- full list of console messages ---------- >>> serving at port 1770 >>> localhost - - [01/Nov/2005 13:00:05] "GET /cgi-bin/test_real3.py >>> HTTP/1.1" 200 - >>> localhost - - [01/Nov/2005 13:00:05] Trying to execute scriptfile >>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>> Resources/cgi-bin/test_real3.py >>> localhost - - [01/Nov/2005 13:00:05] command: >>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>> Frameworks/Python.framework/Versions/2.4/bin/python >>> -u /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>> Resources/cgi-bin/test_real3.py >>> "" >>> localhost - - [01/Nov/2005 13:00:06] dyld: >>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>> Frameworks/Python.framework/Versions/2.4/bin/python >>> can't open library: >>> /Library/Frameworks/Python.framework/Versions/2.4/Python (No such >>> file or directory, errno = 2) >>> localhost - - [01/Nov/2005 13:00:06] CGI script exited OK >>> >>> _______________________________________________ >>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >>> http://mail.python.org/mailman/listinfo/pythonmac-sig > From gm770 at nyc.rr.com Wed Nov 2 21:06:49 2005 From: gm770 at nyc.rr.com (Richard Rodriguez) Date: Wed, 2 Nov 2005 15:06:49 -0500 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app References: <008501c5df5d$885f0b90$0502a8c0@giga> <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> <006401c5dfe4$f786eec0$0502a8c0@giga> <4DF3749B-EFE4-4EA0-83E4-B1B5F11280CA@mac.com> Message-ID: <006d01c5dfe8$f6ceec90$0502a8c0@giga> > On 2-nov-2005, at 20:38, Richard Rodriguez wrote: > >> "webdemo.py" opens a cgi server on a port, I'm using port 1770. It does >> this by using: BaseHTTPServer.HTTPServer >> This allows me to use a web browser, and open a python file, which is >> generating HTML >> A browser url would look like: http://localhost:1770/cgi-bin/ >> test_real3.py >> >> So I have 2+ files, "webdemo" and a html page generator "test_real3.py" >> It seems as if the "webdemo" script, is using the corect "stand- alone" >> version of python, but the python file that responds to the URL call, >> seems to be looking in the wrong place. it's looking at the installed >> Python, instead of the stand-alone Python. It could be a path problem >> of some kind. > > > You didn't quite answer my question :-). How does webdemo execute the > code in test_real3.py? Does it import it as a module or execute it like a > real CGI script? > > If you execute test_real3.py as a separate process your setup.py doesn't > work. Py2app copies just enough of /Libary/Framework/ Python.framework to > supply the dependencies of the script named in setup.py (e.g. > webdemo.py), and therefore might not include modules imported by > test_real3.py. I'm amazed that py2app even bothers to include bin/python. > It definitely does not rewrite the paths to shared libraries used by > bin/python. > > Ronald > I guess it executes it "like a real CGI script". The code in "webdemo" never calls any of the html python pages. webdemo starts a server on port 1770, opens a browser to a page linking to a python html page, and waits for any calls to port 1770. when the browser gets a call to port 1770, it can run a python script, and display the output, which could be formated html. >> >> >> ----- Original Message ----- From: "Ronald Oussoren" >> >> To: "Richard Rodriguez" >> Cc: >> Sent: Wednesday, November 02, 2005 2:14 PM >> Subject: Re: [Pythonmac-SIG] py2app generated app,not acting as a >> stand-alone app >> >> >>> >>> On 2-nov-2005, at 4:24, Richard Rodriguez wrote: >>> >>>> I created a python cgi-server, and generate web pages with python. >>>> After getting past the main mac issues, I'm down to the last 1, a >>>> stand-alone app. My "py2app" generated app works, except that it is >>>> looking at the installed python for something. I didn't notice until >>>> I tried on a mac without python, and after renaming the folder where >>>> I have python installed. >>> >>> What does webdemo.py do? Does it execute test_real3.py in a seperate >>> process (using os.popen or something like that)? >>> >>> Ronald >>> >>>> >>>> here's my error: >>>> localhost - - [01/Nov/2005 13:00:06] dyld: /Users/mayu/Desktop/ >>>> dist_win_10_25_05/webdemo.app/Contents/Frameworks/ Python.framework/ >>>> Versions/2.4/bin/python >>>> can't open library: /Library/Frameworks/Python.framework/ Versions/ >>>> 2.4/Python (No such file or directory, errno = 2) >>>> >>>> The library it's trying to open is the version installed locally, >>>> when it should be looking at the library inside "webdemo.app". Most >>>> likly a path problem. >>>> My guess is that I can fix this by modifying my py2app setup script, >>>> but don't understand how. >>>> Any help would be great. >>>> >>>> >>>> Below is the rest of my setup and errors: >>>> ------ file info ------ >>>> "webdemo.app" - the cgi web-server >>>> cgi-bin/test_real3.py - generates html page >>>> /Library/Frameworks/Python.framework - this is the locally >>>> installed python >>>> /Users/mayu/Desktop/dist_win_10_25_05/ - this is where the py2app >>>> generated mac app is located >>>> >>>> ------- my simple setup script for py2app ---------- >>>> # setup.py >>>> from distutils.core import setup >>>> import py2app >>>> setup(app=["webdemo.py"]) >>>> >>>> ------- full list of console messages ---------- >>>> serving at port 1770 >>>> localhost - - [01/Nov/2005 13:00:05] "GET /cgi-bin/test_real3.py >>>> HTTP/1.1" 200 - >>>> localhost - - [01/Nov/2005 13:00:05] Trying to execute scriptfile >>>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>>> Resources/cgi-bin/test_real3.py >>>> localhost - - [01/Nov/2005 13:00:05] command: >>>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>>> Frameworks/Python.framework/Versions/2.4/bin/python >>>> -u /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>>> Resources/cgi-bin/test_real3.py >>>> "" >>>> localhost - - [01/Nov/2005 13:00:06] dyld: >>>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>>> Frameworks/Python.framework/Versions/2.4/bin/python >>>> can't open library: >>>> /Library/Frameworks/Python.framework/Versions/2.4/Python (No such >>>> file or directory, errno = 2) >>>> localhost - - [01/Nov/2005 13:00:06] CGI script exited OK >>>> >>>> _______________________________________________ >>>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >>>> http://mail.python.org/mailman/listinfo/pythonmac-sig >> > From ronaldoussoren at mac.com Wed Nov 2 21:27:32 2005 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 2 Nov 2005 21:27:32 +0100 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app In-Reply-To: <006d01c5dfe8$f6ceec90$0502a8c0@giga> References: <008501c5df5d$885f0b90$0502a8c0@giga> <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> <006401c5dfe4$f786eec0$0502a8c0@giga> <4DF3749B-EFE4-4EA0-83E4-B1B5F11280CA@mac.com> <006d01c5dfe8$f6ceec90$0502a8c0@giga> Message-ID: On 2-nov-2005, at 21:06, Richard Rodriguez wrote: >> On 2-nov-2005, at 20:38, Richard Rodriguez wrote: >> >>> "webdemo.py" opens a cgi server on a port, I'm using port 1770. >>> It does this by using: BaseHTTPServer.HTTPServer >>> This allows me to use a web browser, and open a python file, >>> which is generating HTML >>> A browser url would look like: http://localhost:1770/cgi-bin/ >>> test_real3.py >>> >>> So I have 2+ files, "webdemo" and a html page generator >>> "test_real3.py" >>> It seems as if the "webdemo" script, is using the corect "stand- >>> alone" version of python, but the python file that responds to >>> the URL call, seems to be looking in the wrong place. it's >>> looking at the installed Python, instead of the stand-alone >>> Python. It could be a path problem of some kind. >> >> >> You didn't quite answer my question :-). How does webdemo execute >> the code in test_real3.py? Does it import it as a module or >> execute it like a real CGI script? >> >> If you execute test_real3.py as a separate process your setup.py >> doesn't work. Py2app copies just enough of /Libary/Framework/ >> Python.framework to supply the dependencies of the script named >> in setup.py (e.g. webdemo.py), and therefore might not include >> modules imported by test_real3.py. I'm amazed that py2app even >> bothers to include bin/python. It definitely does not rewrite the >> paths to shared libraries used by bin/python. >> >> Ronald >> > > I guess it executes it "like a real CGI script". The code in > "webdemo" never calls any of the html python pages. webdemo starts > a server on port 1770, opens a browser to a page linking to a > python html page, and waits for any calls to port 1770. when the > browser gets a call to port 1770, it can run a python script, and > display the output, which could be formated html. In that case you'll have to do some manual tweaking to get a working application bundle, py2app currently does not support your use case. I don't have a handy recipe for it either. The easiest way is probably to manually copy the entire /Library/Framework/ Python.framework into your bundle and then rewriting the load commands in the python executable inside that (in a script using macholib [part of py2app]). Ronald > > >>> >>> >>> ----- Original Message ----- From: "Ronald Oussoren" >>> >>> To: "Richard Rodriguez" >>> Cc: >>> Sent: Wednesday, November 02, 2005 2:14 PM >>> Subject: Re: [Pythonmac-SIG] py2app generated app,not acting as a >>> stand-alone app >>> >>> >>>> >>>> On 2-nov-2005, at 4:24, Richard Rodriguez wrote: >>>> >>>>> I created a python cgi-server, and generate web pages with >>>>> python. After getting past the main mac issues, I'm down to >>>>> the last 1, a stand-alone app. My "py2app" generated app >>>>> works, except that it is looking at the installed python for >>>>> something. I didn't notice until I tried on a mac without >>>>> python, and after renaming the folder where I have python >>>>> installed. >>>> >>>> What does webdemo.py do? Does it execute test_real3.py in a >>>> seperate process (using os.popen or something like that)? >>>> >>>> Ronald >>>> >>>>> >>>>> here's my error: >>>>> localhost - - [01/Nov/2005 13:00:06] dyld: /Users/mayu/Desktop/ >>>>> dist_win_10_25_05/webdemo.app/Contents/Frameworks/ >>>>> Python.framework/ Versions/2.4/bin/python >>>>> can't open library: /Library/Frameworks/Python.framework/ >>>>> Versions/ 2.4/Python (No such file or directory, errno = 2) >>>>> >>>>> The library it's trying to open is the version installed >>>>> locally, when it should be looking at the library inside >>>>> "webdemo.app". Most likly a path problem. >>>>> My guess is that I can fix this by modifying my py2app setup >>>>> script, but don't understand how. >>>>> Any help would be great. >>>>> >>>>> >>>>> Below is the rest of my setup and errors: >>>>> ------ file info ------ >>>>> "webdemo.app" - the cgi web-server >>>>> cgi-bin/test_real3.py - generates html page >>>>> /Library/Frameworks/Python.framework - this is the locally >>>>> installed python >>>>> /Users/mayu/Desktop/dist_win_10_25_05/ - this is where >>>>> the py2app generated mac app is located >>>>> >>>>> ------- my simple setup script for py2app ---------- >>>>> # setup.py >>>>> from distutils.core import setup >>>>> import py2app >>>>> setup(app=["webdemo.py"]) >>>>> >>>>> ------- full list of console messages ---------- >>>>> serving at port 1770 >>>>> localhost - - [01/Nov/2005 13:00:05] "GET /cgi-bin/ >>>>> test_real3.py HTTP/1.1" 200 - >>>>> localhost - - [01/Nov/2005 13:00:05] Trying to execute scriptfile >>>>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>>>> Resources/cgi-bin/test_real3.py >>>>> localhost - - [01/Nov/2005 13:00:05] command: >>>>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>>>> Frameworks/Python.framework/Versions/2.4/bin/python >>>>> -u /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>>>> Resources/cgi-bin/test_real3.py >>>>> "" >>>>> localhost - - [01/Nov/2005 13:00:06] dyld: >>>>> /Users/mayu/Desktop/dist_win_10_25_05/webdemo.app/Contents/ >>>>> Frameworks/Python.framework/Versions/2.4/bin/python >>>>> can't open library: >>>>> /Library/Frameworks/Python.framework/Versions/2.4/Python (No such >>>>> file or directory, errno = 2) >>>>> localhost - - [01/Nov/2005 13:00:06] CGI script exited OK >>>>> >>>>> _______________________________________________ >>>>> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >>>>> http://mail.python.org/mailman/listinfo/pythonmac-sig >>> > From bob at redivi.com Wed Nov 2 21:48:00 2005 From: bob at redivi.com (Bob Ippolito) Date: Wed, 2 Nov 2005 12:48:00 -0800 Subject: [Pythonmac-SIG] Using Sync Services from python In-Reply-To: <225C1B89-E0E2-4BD8-9C95-57F002E739A1@gmail.com> References: <225C1B89-E0E2-4BD8-9C95-57F002E739A1@gmail.com> Message-ID: <48803526-96FF-4721-82F9-679FA0AD889D@redivi.com> On Nov 2, 2005, at 6:38 AM, David wrote: > Does anyone know if it would be possible to use Sync Services from > python, or from any other programming language than obj C? Can it be > accessed through Apple Script? Nearly anything that you can do in Objective-C can be done in PyObjC with Python. -bob From Chris.Barker at noaa.gov Wed Nov 2 21:54:16 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Wed, 02 Nov 2005 12:54:16 -0800 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app In-Reply-To: <006d01c5dfe8$f6ceec90$0502a8c0@giga> References: <008501c5df5d$885f0b90$0502a8c0@giga> <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> <006401c5dfe4$f786eec0$0502a8c0@giga> <4DF3749B-EFE4-4EA0-83E4-B1B5F11280CA@mac.com> <006d01c5dfe8$f6ceec90$0502a8c0@giga> Message-ID: <43692778.1020506@noaa.gov> Richard Rodriguez wrote: > I guess it executes it "like a real CGI script". This is probably not the best mmodel to use for what you are doing. If I understand correctly, you're trying to write a small, stand-alone, custom web server, that the user can click on, then interact with through the browser. Using the CGI approach is going to get you into the kind of troubles you're having. The alternative is to use a web application framework that serves up your web pages directly from Python, without starting up any scripts as separate processes. You could also write your own, but unless you goal is to learn to write web servers, use an existing framework, there are a LOT of them out there, and most of them provide a stand alone web server as an optional part of the package. Here's a few to check out: Webware Twisted CherryPy Turbo Gears (built on Cherry Pie) Django Quixote Any number of others! In my shop, we're currently using Quixote, and are just starting on a project much like yours. In our case, we need a full fledged web app, but also want a version that will run stand-alone on a non-networked machine. Rather than writing two interfaces, we're planning on embedding the we server in the app, and using the browser as the interface. I've got a tiny little demo using Quixote and SQLLite. It bundles up just fine with Py2app (and Py2exe on Windows), it looks like it's going to work great. I'd be glad to send it to you if you like. Here's a thread where I got some questions answered on this group: http://aspn.activestate.com/ASPN/Mail/Message/pythonmac-sig/2784010 -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 Chris.Barker at noaa.gov From bob at redivi.com Wed Nov 2 22:17:42 2005 From: bob at redivi.com (Bob Ippolito) Date: Wed, 2 Nov 2005 13:17:42 -0800 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app In-Reply-To: <4DF3749B-EFE4-4EA0-83E4-B1B5F11280CA@mac.com> References: <008501c5df5d$885f0b90$0502a8c0@giga> <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> <006401c5dfe4$f786eec0$0502a8c0@giga> <4DF3749B-EFE4-4EA0-83E4-B1B5F11280CA@mac.com> Message-ID: On Nov 2, 2005, at 11:55 AM, Ronald Oussoren wrote: > On 2-nov-2005, at 20:38, Richard Rodriguez wrote: > > >> "webdemo.py" opens a cgi server on a port, I'm using port 1770. It >> does this by using: BaseHTTPServer.HTTPServer >> This allows me to use a web browser, and open a python file, which >> is generating HTML >> A browser url would look like: http://localhost:1770/cgi-bin/ >> test_real3.py >> >> So I have 2+ files, "webdemo" and a html page generator >> "test_real3.py" >> It seems as if the "webdemo" script, is using the corect "stand- >> alone" version of python, but the python file that responds to the >> URL call, seems to be looking in the wrong place. it's looking at >> the installed Python, instead of the stand-alone Python. It could >> be a path problem of some kind. > > > You didn't quite answer my question :-). How does webdemo execute the > code in test_real3.py? Does it import it as a module or execute it > like a real CGI script? > > If you execute test_real3.py as a separate process your setup.py > doesn't work. Py2app copies just enough of /Libary/Framework/ > Python.framework to supply the dependencies of the script named in > setup.py (e.g. webdemo.py), and therefore might not include modules > imported by test_real3.py. I'm amazed that py2app even bothers to > include bin/python. It definitely does not rewrite the paths to > shared libraries used by bin/python. If you set all of the right environment variables, it *almost* works. What really should happen is to place a modified Python interpreter in MacOS.. so that the @executable_path ends up right. I could probably just make the bootstrap check to see if it has some special name like "python" or "__python__" and act like the interpreter in that case. That might even have a few fringe benefits (getting an interpreter that has only access to the contents of your app bundle). I will be starting work on making the Mac OS X Python stack better handle universal binaries very soon, and will be making improvements to py2app in the process... so I'll probably actually make this happen in the next week or two because it's easy and I'll be staring at this stuff anyway. Speaking of which, the svn trunk of py2app should be able to analyze and write Mach-O headers of any combination of supported architectures now (32-bit of both endians, 64-bit of both endians, and the universal header that wraps them). It's not really tested yet, though. -bob From ronaldoussoren at mac.com Wed Nov 2 23:02:23 2005 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 2 Nov 2005 23:02:23 +0100 Subject: [Pythonmac-SIG] Framework build of 2.4.2 In-Reply-To: <2mveze2fh1.fsf@starship.python.net> References: <564EDA76-9E6C-4FA6-BEAA-337EEE2BB859@redivi.com> <8816571.1130690177069.JavaMail.ronaldoussoren@mac.com> <744C6C61-23F4-4095-AAB7-86495CADC888@redivi.com> <9336895.1130699331637.JavaMail.ronaldoussoren@mac.com> <2mveze2fh1.fsf@starship.python.net> Message-ID: On 31-okt-2005, at 10:38, Michael Hudson wrote: > Ronald Oussoren writes: > >> BTW. Actually building the beast sucks, the script for building the >> documentation index is not very reliable: it crashes while waiting >> for the indexer to finish. Luckily I can compensate for this in the >> build script. > > If you have changes you think should be checked in, assign a patch on > SF to me and I'll do it. I will, once I'm sure that my changes are actually correct. BTW. I finally have a working installer at http://pyobjc.sf.net/ software/MacPython-2.4.2-1.dmg. I have barely tested this as of yet. This includes documentation. Annoyingly it is still necessary to install Bob's Tiger fixes if you want to build extensions on Tiger. The pyconfig.h created on Panther is not compatible with Tiger, I'll see if I can find a good and simple solution for that. The easiest solution I can think of right now is shipping the Tiger version of pyconfig.h in the installer as well and swapping in the right pyconfig during installation. The other half of Bob's Tiger fixes is no longer relevant because the Python installer now patches Apple's python at installation time. Ronald > > Cheers, > mwh > > -- > I recompiled XFree 4.2 with gcc 3.2-beta-from-cvs with -O42 > and -march-pentium4-800Mhz and I am sure that the MOUSE > CURSOR is moving 5 % FASTER! > -- from Twisted.Quotes > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From ronaldoussoren at mac.com Wed Nov 2 23:06:06 2005 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 2 Nov 2005 23:06:06 +0100 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app In-Reply-To: References: <008501c5df5d$885f0b90$0502a8c0@giga> <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> <006401c5dfe4$f786eec0$0502a8c0@giga> <4DF3749B-EFE4-4EA0-83E4-B1B5F11280CA@mac.com> Message-ID: <80B2BF9B-C973-4A75-9E5F-58B6034DB4EA@mac.com> On 2-nov-2005, at 22:17, Bob Ippolito wrote: > > Speaking of which, the svn trunk of py2app should be able to > analyze and write Mach-O headers of any combination of supported > architectures now (32-bit of both endians, 64-bit of both endians, > and the universal header that wraps them). It's not really tested > yet, though. Cool. Does that mean that if I'd have a universal binary version of Python and addon packages I'd end up with a universal binary application bundle after running py2app? Ronald > > -bob > From bob at redivi.com Wed Nov 2 23:14:30 2005 From: bob at redivi.com (Bob Ippolito) Date: Wed, 2 Nov 2005 14:14:30 -0800 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app In-Reply-To: <80B2BF9B-C973-4A75-9E5F-58B6034DB4EA@mac.com> References: <008501c5df5d$885f0b90$0502a8c0@giga> <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> <006401c5dfe4$f786eec0$0502a8c0@giga> <4DF3749B-EFE4-4EA0-83E4-B1B5F11280CA@mac.com> <80B2BF9B-C973-4A75-9E5F-58B6034DB4EA@mac.com> Message-ID: <93ED8BD1-5225-4D37-A345-6C293E2A6A18@redivi.com> On Nov 2, 2005, at 2:06 PM, Ronald Oussoren wrote: > On 2-nov-2005, at 22:17, Bob Ippolito wrote: > >> Speaking of which, the svn trunk of py2app should be able to >> analyze and write Mach-O headers of any combination of supported >> architectures now (32-bit of both endians, 64-bit of both endians, >> and the universal header that wraps them). It's not really tested >> yet, though. > > Cool. Does that mean that if I'd have a universal binary version of > Python and addon packages I'd end up with a universal binary > application bundle after running py2app? Almost, the bootstrap is still PPC only for now. That's another issue, because if I ship a universal bootstrap and someone uses it with some subset of PPC-only modules, then the application will not work on a x86 machine since it will run the bootstrap native. There may be some kind of Info.plist flag that can toggle which is the preferred arch, that would be ideal, otherwise I will either have to make py2app smart enough to do something like lipo -thin and split off everything but the preferred arch. Needless to say, universal binary support is going to be a pain! -bob From ronaldoussoren at mac.com Wed Nov 2 23:34:41 2005 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 2 Nov 2005 23:34:41 +0100 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app In-Reply-To: <93ED8BD1-5225-4D37-A345-6C293E2A6A18@redivi.com> References: <008501c5df5d$885f0b90$0502a8c0@giga> <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> <006401c5dfe4$f786eec0$0502a8c0@giga> <4DF3749B-EFE4-4EA0-83E4-B1B5F11280CA@mac.com> <80B2BF9B-C973-4A75-9E5F-58B6034DB4EA@mac.com> <93ED8BD1-5225-4D37-A345-6C293E2A6A18@redivi.com> Message-ID: On 2-nov-2005, at 23:14, Bob Ippolito wrote: > > On Nov 2, 2005, at 2:06 PM, Ronald Oussoren wrote: > >> On 2-nov-2005, at 22:17, Bob Ippolito wrote: >> >>> Speaking of which, the svn trunk of py2app should be able to >>> analyze and write Mach-O headers of any combination of supported >>> architectures now (32-bit of both endians, 64-bit of both >>> endians, and the universal header that wraps them). It's not >>> really tested yet, though. >> >> Cool. Does that mean that if I'd have a universal binary version >> of Python and addon packages I'd end up with a universal binary >> application bundle after running py2app? > > Almost, the bootstrap is still PPC only for now. That's another > issue, because if I ship a universal bootstrap and someone uses it > with some subset of PPC-only modules, then the application will not > work on a x86 machine since it will run the bootstrap native. > > There may be some kind of Info.plist flag that can toggle which is > the preferred arch, that would be ideal, otherwise I will either > have to make py2app smart enough to do something like lipo -thin > and split off everything but the preferred arch. > > Needless to say, universal binary support is going to be a pain! And that's just py2app :-). Actually building a universal binary installer for Python and extension modules will also be a lot of "fun" :-(. Ronald > > -bob > From hunda at rhodes.edu Thu Nov 3 06:47:23 2005 From: hunda at rhodes.edu (Dylan Hunter) Date: Wed, 2 Nov 2005 23:47:23 -0600 Subject: [Pythonmac-SIG] graphics.py Message-ID: <7c583ee60429e8ac98fca3fc9ff374c7@rhodes.edu> Is anyone else forced to use graphics.py with macpython? it recognizes graphics as a module, but after running my code, it will restart using graphics, as it should. then it will restart back into the regular python module after about 3 seconds. any suggestions as to why this happens? From ronaldoussoren at mac.com Thu Nov 3 09:37:20 2005 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 3 Nov 2005 09:37:20 +0100 Subject: [Pythonmac-SIG] py2app generated app, not acting as a stand-alone app In-Reply-To: <93ED8BD1-5225-4D37-A345-6C293E2A6A18@redivi.com> References: <008501c5df5d$885f0b90$0502a8c0@giga> <94C2658B-E28E-4088-98D0-04AD558FAE1E@mac.com> <006401c5dfe4$f786eec0$0502a8c0@giga> <4DF3749B-EFE4-4EA0-83E4-B1B5F11280CA@mac.com> <80B2BF9B-C973-4A75-9E5F-58B6034DB4EA@mac.com> <93ED8BD1-5225-4D37-A345-6C293E2A6A18@redivi.com> Message-ID: <8825CB55-62FB-4255-93DB-5AFB4CF0E57B@mac.com> On 2-nov-2005, at 23:14, Bob Ippolito wrote: > > On Nov 2, 2005, at 2:06 PM, Ronald Oussoren wrote: > >> On 2-nov-2005, at 22:17, Bob Ippolito wrote: >> >>> Speaking of which, the svn trunk of py2app should be able to >>> analyze and write Mach-O headers of any combination of supported >>> architectures now (32-bit of both endians, 64-bit of both >>> endians, and the universal header that wraps them). It's not >>> really tested yet, though. >> >> Cool. Does that mean that if I'd have a universal binary version >> of Python and addon packages I'd end up with a universal binary >> application bundle after running py2app? > > Almost, the bootstrap is still PPC only for now. That's another > issue, because if I ship a universal bootstrap and someone uses it > with some subset of PPC-only modules, then the application will not > work on a x86 machine since it will run the bootstrap native. > > There may be some kind of Info.plist flag that can toggle which is > the preferred arch, that would be ideal, otherwise I will either > have to make py2app smart enough to do something like lipo -thin > and split off everything but the preferred arch. The easy way out is to ship 3 precompiled bootstrap programs and select the right one based on the architectures supported by included binaries. You might end up with unused fat binaries for parts of the program, but at least it would work. > > Needless to say, universal binary support is going to be a pain! No need to tell me that :-) > > -bob > From simonevaudrey at gmail.com Thu Nov 3 17:55:49 2005 From: simonevaudrey at gmail.com (Simone Vaudrey) Date: Thu, 3 Nov 2005 17:55:49 +0100 Subject: [Pythonmac-SIG] docutils Message-ID: I just install docutils-0.3.7-py2.4-macosx10.3 on my PowerBook running 10.4.2, after installing python 2.4.1. Where are the tools like rst2html in this distribution ? Thanks for your help. Pierre From smithsm at samuelsmith.org Thu Nov 3 18:27:42 2005 From: smithsm at samuelsmith.org (Samuel M. Smith) Date: Thu, 3 Nov 2005 10:27:42 -0700 Subject: [Pythonmac-SIG] Building Pthreads Statically (slightly off topic) Message-ID: I am building python on an embedded linux box. I tried to sign up for the comp.lang.python mailinglist but its been several hours and they haven't confirmed my membership so I can't ask it there. I hope that someone on this list can help me. I can build python 2.4.2 from source on the embedded linux box when I nfs mount and boot a full debian distribution. The embedded box has stripped down linux distribution in onboard flash. I can successfully install python to the onboard flash when booted to the nfs version by using make install with $DESTDIR set to the onboard flash mounted directory I then reboot to the onboard flash and can run python from there. This works if I build python without threading support because the onboard flash does not include the libpthread.so library I think that if I can build python with pthread linked statically then I can run python when booted from the onboard flash without problem. Problem is I am clueless about how to do this. The setup and setup.py files only deal with building modules static or shared where as threading is build into the python interpreter it seems not as a module. I read the readme in the source distribution but can't find and configure options that will let me build python with static linking of the pthread library. I have searched google and find vague references to doing something like that. I don't understand the makefile well enough to know how to do it there. So does anyone understand how include threading support statically? What I have to modify to do it? ********************************************************************** Samuel M. Smith Ph.D. 2966 Fort Hill Road Eagle Mountain, Utah 84043 801-768-2768 voice 801-768-2769 fax ********************************************************************** "The greatest source of failure and unhappiness in the world is giving up what we want most for what we want at the moment" ********************************************************************** From Chris.Barker at noaa.gov Thu Nov 3 18:54:06 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Thu, 03 Nov 2005 09:54:06 -0800 Subject: [Pythonmac-SIG] Building Pthreads Statically (slightly off topic) In-Reply-To: References: Message-ID: <436A4EBE.5080500@noaa.gov> Samuel M. Smith wrote: > I am building python on an embedded linux box. I tried to sign up for > the comp.lang.python mailinglist Just so you know, It's also a newsgroup, so you can get to it with a regular usenet client and/or other systems like google groups. -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 Chris.Barker at noaa.gov From delza at livingcode.org Fri Nov 4 00:33:10 2005 From: delza at livingcode.org (Dethe Elza) Date: Thu, 3 Nov 2005 15:33:10 -0800 Subject: [Pythonmac-SIG] Best way to grab screenshot? Message-ID: <63353831-4698-44AA-856E-40AC8A60541A@livingcode.org> Hi folks, I'm trying to put together a screencast program using PyObjC. The first step is to be able to take a screenshot, and I've figured out one way to do that, based on The Irate Scotsman's Screen Sharing code [1]. Since OS X is using OpenGL to compose the window, and since even Series 60 cellphones expose and API for taking screenshots from Python, I'm thinking there must be a better way than this. But y'know, I've been wrong before. Here is the function I'm using: def screenShot(self): rect = NSScreen.mainScreen().frame() image = NSImage.alloc().initWithSize_((rect.size.width, rect.size.height)) window = NSWindow.alloc ().initWithContentRect_styleMask_backing_defer_( rect, NSBorderlessWindowMask, NSBackingStoreNonretained, False) view = NSView.alloc().initWithFrame_(rect) window.setLevel_(NSScreenSaverWindowLevel + 100) window.setHasShadow_(False) window.setAlphaValue_(0.0) window.setContentView_(view) window.orderFront_(self) view.lockFocus() screenRep= NSBitmapImageRep.alloc().initWithFocusedViewRect_ (rect) image.addRepresentation_(screenRep) view.unlockFocus() window.orderOut_(self) window.close() return image Suggestions for improvement are welcome! Next step: Figure out how to create a Quicktime movie and insert the images. I had assumed that the QTKit would allow me to do this, ha ha ha. Fool me once, shame on you Apple, but fool me again and again and again.... --Dethe [1] http://iratescotsman.com/products/source/ There are two ways of constructing a software design. One way is to make it so simple there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies. --C.A.R. Hoare From telliott at hsc.wvu.edu Mon Nov 7 03:03:45 2005 From: telliott at hsc.wvu.edu (Tom Elliott) Date: Sun, 6 Nov 2005 21:03:45 -0500 Subject: [Pythonmac-SIG] newbie question Message-ID: <2B38C2F6-D3EE-4A9E-9147-280513C67C0F@hsc.wvu.edu> Can you point me to simple drawing example using PyObjC? I want to draw into a CustomView object (I think). I'm afraid DotView is beyond me. When I try to adapt RedSquare from Learning Cocoa...my AppDelegate can't find the custom class MyView. Thanks. Tom Elliott From bob at redivi.com Mon Nov 7 04:57:00 2005 From: bob at redivi.com (Bob Ippolito) Date: Sun, 6 Nov 2005 19:57:00 -0800 Subject: [Pythonmac-SIG] newbie question In-Reply-To: <2B38C2F6-D3EE-4A9E-9147-280513C67C0F@hsc.wvu.edu> References: <2B38C2F6-D3EE-4A9E-9147-280513C67C0F@hsc.wvu.edu> Message-ID: On Nov 6, 2005, at 6:03 PM, Tom Elliott wrote: > Can you point me to simple drawing example using PyObjC? I want to > draw into a CustomView object (I think). I'm afraid DotView is > beyond me. When I try to adapt RedSquare from Learning Cocoa...my > AppDelegate can't find the custom class MyView. You probably need to import the file that defines the class MyView. Someone would be able to tell you what's wrong pretty quickly if you posted the code. -bob From telliott at hsc.wvu.edu Mon Nov 7 18:06:45 2005 From: telliott at hsc.wvu.edu (Tom Elliott) Date: Mon, 7 Nov 2005 12:06:45 -0500 Subject: [Pythonmac-SIG] newbie question 2 Message-ID: When a button is pushed and "draw_" is called, I expect drawRect_ to be called through self.setNeedsDisplay_, but this doesn't work. Why is that? Thanks. Tom Elliott # inherits from NSView via the nib class MyView(NibClassBuilder.AutoBaseClass): def initWithFrame_(self, frame): super(MyView, self).initWithFrame_(frame) return self def drawRect_(self, rect): NSLog("drawRect_") NSColor.redColor().set() NSRectFill(self.bounds()) def draw_(self,sender): NSLog("draw_") self.setNeedsDisplay_(True) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051107/84eaa697/attachment.html From jnutting at gmail.com Thu Nov 10 11:15:54 2005 From: jnutting at gmail.com (Jack Nutting) Date: Thu, 10 Nov 2005 11:15:54 +0100 Subject: [Pythonmac-SIG] trouble with NSXMLDocument Message-ID: Hi gang, I wanted to play around with NSXMLDocument a bit, and figured PyObjC would be a good way to do it. Unfortunately, I get strange errors. >>> doc, error = Foundation.NSXMLDocument.alloc ().initWithContentsOfURL_options_error_(u"asdfkjsda.svg", 0) 2005-11-10 11:03:20.618 python[1018] *** -[OC_PythonUnicode absoluteURL]: selector not recognized [self = 0x370db0] Traceback (most recent call last): File "", line 1, in ? ValueError: NSInvalidArgumentException - *** -[OC_PythonUnicode absoluteURL]: selector not recognized [self = 0x370db0] Note that the "asdfkjsda.svg" file is in the same directory where I started python. I tried using a file URL instead, but both "file://asdfkjsda.svg" and "file:///Users/jnutting/Documents/svg/shapes/asdfkjsda.svg" give me the same result, as does wrapping the string in unicode(string, 'utf-8') instead of just prepending it with 'u'. Running framework python 2.4.1, mac os 10.4.3, PyObjC 1.3.7 (from the installer package for 2.4.1/10.3; is it odd that there's not a 1.3.7 for 2.4.1/10.4, or should the one I've got work OK?) -- // jack // http://www.nuthole.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051110/1200ccf7/attachment.html From kdurston at uoguelph.ca Thu Nov 10 01:59:40 2005 From: kdurston at uoguelph.ca (Kirk Durston) Date: Wed, 09 Nov 2005 19:59:40 -0500 Subject: [Pythonmac-SIG] inputing multi-digit numbers Message-ID: I?m having a hard time figuring out how to input a list of numbers, each one of which can be 1, 2, or 3 digits in length. First, I select a column in an Excel file, and copy and past it into a Word file. I then save it as a text file. I then open a new window in Python and copy and paste the column of numbers from the text file into the window and save it as ?Function ID? In my main program, I type input=open('Function ID', 'r') x=input.readlines() input.close() print x What I get, when x is printed out, looks like this: ['939\r936\r937\r885\r886\r887\r171\r19\r169\r149\r36\r37\r38\r1\r51\r81\r10 2\r827\r919\r14\r85\r20\r895\r88\r89\r167\r163\r111\r168\r128\r66\r880\r884\ r71\r131\r67\r419\r415\r68\r103\r82\r2\r39\r40\r41\r132\r107\r123\r150\r155\ r897\r901\r911\r949\r21\r15\r9\r883\r129\r69\r70\r130\r124\r112\r142\r164\r1 59\r881\r882\r72\r22\r23\r24\r3\r108\r133\r388\r113\r160\r165\r393\r156\r144 \r161\r25\r4\r134\r905\r907\r26\r114\r95\r96\r162\r174\r27\r125\r389\r888\r1 45\r16\r100\r126\r28\r891\r5\r115\r143\r75\r29\r73\r74\r76\r98\r83\r104\r30\ r42\r43\r44\r151\r172\r109\r135\r6\r940\r892\r912\r903\r898\r17\r10\r390\r13 6\r116\r45\r46\r47\r899\r173\r146\r117\r31\r77\r894\r893\r900\r902\r913\r7\r 941\r938\r910\r11\r78\r105\r84\r32\r48\r49\r50\r118\r110\r127\r101\r137\r152 \r79\r80\r908\r906\r33\r138\r909\r890\r153\r154\r157\r170\r106\r416\r914\r92 1\r8\r12\r13\r18\r34\r99\r139\r147\r392\r'] What I want is [?939?, ?936?, ... ,?392?] What am I doing wrong? Kirk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051109/846a91ae/attachment.html From Henning.Ramm at mediapro-gmbh.de Thu Nov 10 14:01:50 2005 From: Henning.Ramm at mediapro-gmbh.de (Henning.Ramm@mediapro-gmbh.de) Date: Thu, 10 Nov 2005 14:01:50 +0100 Subject: [Pythonmac-SIG] inputing multi-digit numbers Message-ID: -----Original Message----- From: pythonmac-sig-bounces at python.org [mailto:pythonmac-sig-bounces at python.org] On Behalf Of Kirk Durston Sent: Thursday, November 10, 2005 2:00 AM To: pythonmac-sig at python.org Subject: [Pythonmac-SIG] inputing multi-digit numbers I'm having a hard time figuring out how to input a list of numbers, each one of which can be 1, 2, or 3 digits in length. First, I select a column in an Excel file, and copy and past it into a Word file. I then save it as a text file. I then open a new window in Python and copy and paste the column of numbers from the text file into the window and save it as 'Function ID' In my main program, I type input=open('Function ID', 'r') x=input.readlines() input.close() print x Try open (or file) with mode 'rU' (universal newline support), apparently the \r is not recognized as \n Best regards, Henning Hraban Ramm S?dkurier Medienhaus / MediaPro Support/Admin/Development Dept. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051110/ed53ecb0/attachment.html From kdurston at uoguelph.ca Thu Nov 10 15:26:20 2005 From: kdurston at uoguelph.ca (Kirk Durston) Date: Thu, 10 Nov 2005 09:26:20 -0500 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: Message-ID: On 11/10/05 8:01 AM, "Henning.Ramm at mediapro-gmbh.de" wrote: >> I?m having a hard time figuring out how to input a list of numbers, each one >> of which can be 1, 2, or 3 digits in length. First, I select a column in an >> Excel file, and copy and past it into a Word file. I then save it as a text >> file. I then open a new window in Python and copy and paste the column of >> numbers from the text file into the window and save it as ?Function ID? >> >> In my main program, I type >> >> input=open('Function ID', 'r') >> x=input.readlines() >> input.close() >> print x >> > Try open (or file) with mode 'rU' (universal newline support), apparently the > \r is not recognized as \n > > Best regards, > Henning Hraban Ramm > S?dkurier Medienhaus / MediaPro > Support/Admin/Development Dept. > Thank you. That gives me something closer to a list, but the output is now: ['939\n', '936\n', '937\n', '885\n', '886\n', '887\n', '171\n', '19\n', ...] Question: how do I get rid of the \n attached to each member in my list? I still need to do a lot of work with the contents of the list. I could run each member of the list through a loop and slice off the \n, but I imagine there is a more efficient way to do the job. Is there? Thank you for your help. Kirk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051110/925fcca0/attachment.html From Henning.Ramm at mediapro-gmbh.de Thu Nov 10 15:35:37 2005 From: Henning.Ramm at mediapro-gmbh.de (Henning.Ramm@mediapro-gmbh.de) Date: Thu, 10 Nov 2005 15:35:37 +0100 Subject: [Pythonmac-SIG] inputing multi-digit numbers Message-ID: > Thank you. That gives me something closer to a list, but the output is now: ['939\n', '936\n', '937\n', '885\n', '886\n', '887\n', '171\n', '19\n', ...] > Question: how do I get rid of the \n attached to each member in my list? Choose: map(int(map(string.strip, yourlist)) (Python 2.2) [ int(x.strip()) for x in yourlist ] (Python 2.3) ( int(x.strip()) for x in yourlist ) (Python 2.4) Best regards, Henning Hraban Ramm S?dkurier Medienhaus / MediaPro Support/Admin/Development Dept. From cdamundsen at gmail.com Thu Nov 10 16:16:16 2005 From: cdamundsen at gmail.com (Craig Amundsen) Date: Thu, 10 Nov 2005 07:16:16 -0800 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: References: Message-ID: <8dc0c28f0511100716x79f8f28cm90f9bce89ab140a5@mail.gmail.com> Hi - > > Thank you. That gives me something closer to a list, but the output is now: ['939\n', '936\n', '937\n', '885\n', '886\n', '887\n', '171\n', '19\n', ...] You could do: inf = open(fileName) numbers = inf.read().splitlines() splitlines() is smarter than readlines() - Craig From bob at redivi.com Thu Nov 10 16:56:30 2005 From: bob at redivi.com (Bob Ippolito) Date: Thu, 10 Nov 2005 07:56:30 -0800 Subject: [Pythonmac-SIG] trouble with NSXMLDocument In-Reply-To: References: Message-ID: On Nov 10, 2005, at 2:15 AM, Jack Nutting wrote: > Hi gang, > > I wanted to play around with NSXMLDocument a bit, and figured > PyObjC would be a good way to do it. Unfortunately, I get strange > errors. > > >>> doc, error = Foundation.NSXMLDocument.alloc > ().initWithContentsOfURL_options_error_(u"asdfkjsda.svg", 0) > 2005-11-10 11:03:20.618 python[1018] *** -[OC_PythonUnicode > absoluteURL]: selector not recognized [self = 0x370db0] > Traceback (most recent call last): > File "", line 1, in ? > ValueError: NSInvalidArgumentException - *** -[OC_PythonUnicode > absoluteURL]: selector not recognized [self = 0x370db0] > > Note that the "asdfkjsda.svg" file is in the same directory where I > started python. I tried using a file URL instead, but both " > file://asdfkjsda.svg" and "file:///Users/jnutting/Documents/svg/ > shapes/asdfkjsda.svg" give me the same result, as does wrapping the > string in unicode(string, 'utf-8') instead of just prepending it > with 'u'. It's telling you that strings are not URLs. You need to use a NSURL instance as the first parameter. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051110/cfe2f83e/attachment.html From delza at livingcode.org Thu Nov 10 18:52:37 2005 From: delza at livingcode.org (Dethe Elza) Date: Thu, 10 Nov 2005 09:52:37 -0800 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: References: Message-ID: >> Question: how do I get rid of the \n attached to each member in my >> list? > > Choose: > > map(int(map(string.strip, yourlist)) (Python 2.2) > > [ int(x.strip()) for x in yourlist ] (Python 2.3) > > ( int(x.strip()) for x in yourlist ) (Python 2.4) > You don't need strip(), int() ignores white space. So the generator- expression version could be (others could be shortened similarly): (int(x) for x in yourlist) --Dethe A miracle, even if it's a lousy miracle, is still a miracle. --Teller From delza at livingcode.org Thu Nov 10 19:05:39 2005 From: delza at livingcode.org (Dethe Elza) Date: Thu, 10 Nov 2005 10:05:39 -0800 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: References: Message-ID: <4B9D8B45-3A98-4069-BEE9-7EF557A0245D@livingcode.org> On 10-Nov-05, at 5:01 AM, wrote: > > -----Original Message----- > From: pythonmac-sig-bounces at python.org [mailto:pythonmac-sig- > bounces at python.org] On Behalf Of Kirk Durston > Sent: Thursday, November 10, 2005 2:00 AM > To: pythonmac-sig at python.org > Subject: [Pythonmac-SIG] inputing multi-digit numbers > > I?m having a hard time figuring out how to input a list of numbers, > each one of which can be 1, 2, or 3 digits in length. First, I > select a column in an Excel file, and copy and past it into a Word > file. I then save it as a text file. Wouldn't it be simpler to use Excel to export as CSV and use python's csv module to read them in? http://python.org/doc/current/lib/module-csv.html I don't understand why Word is involved in getting numbers from Excel to Python. Another alternative would be to use the excellent pywin32 tools to extract Excel data directly from within Python, using Excel's COM interface. http://sourceforge.net/projects/pywin32/ Excel has other interfaces it exposes besides COM. Here is a recipe from the Python Cookbook to extract tabular data from an Excel file using pywin32 and the ADODB interface. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440661 I hope this is helpful. --Dethe "the city carries such a cargo of pathos and longing that daily life there vaccinates us against revelation" -- Pain Not Bread, The Rise and Fall of Human Breath From bob at redivi.com Thu Nov 10 19:18:35 2005 From: bob at redivi.com (Bob Ippolito) Date: Thu, 10 Nov 2005 10:18:35 -0800 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: <4B9D8B45-3A98-4069-BEE9-7EF557A0245D@livingcode.org> References: <4B9D8B45-3A98-4069-BEE9-7EF557A0245D@livingcode.org> Message-ID: On Nov 10, 2005, at 10:05 AM, Dethe Elza wrote: > > On 10-Nov-05, at 5:01 AM, > wrote: > >> >> -----Original Message----- >> From: pythonmac-sig-bounces at python.org [mailto:pythonmac-sig- >> bounces at python.org] On Behalf Of Kirk Durston >> Sent: Thursday, November 10, 2005 2:00 AM >> To: pythonmac-sig at python.org >> Subject: [Pythonmac-SIG] inputing multi-digit numbers >> >> I?m having a hard time figuring out how to input a list of numbers, >> each one of which can be 1, 2, or 3 digits in length. First, I >> select a column in an Excel file, and copy and past it into a Word >> file. I then save it as a text file. > > Wouldn't it be simpler to use Excel to export as CSV and use python's > csv module to read them in? > > http://python.org/doc/current/lib/module-csv.html > > I don't understand why Word is involved in getting numbers from Excel > to Python. I use this to convert excel to xml, and parse that from Python. http://www.andykhan.com/jexcelapi/ -bob From delza at livingcode.org Thu Nov 10 20:21:02 2005 From: delza at livingcode.org (Dethe Elza) Date: Thu, 10 Nov 2005 11:21:02 -0800 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: References: <4B9D8B45-3A98-4069-BEE9-7EF557A0245D@livingcode.org> Message-ID: <6C8B4CCA-3C47-4F9E-AC5A-76D4E223E9DF@livingcode.org> On 10-Nov-05, at 10:18 AM, Bob Ippolito wrote: > I use this to convert excel to xml, and parse that from Python. > http://www.andykhan.com/jexcelapi/ > > -bob Oops. Obviously I failed to note which list this question was posed on, I assumed it was edu-sig for some reason. Sorry, didn't mean to give you Windows tips on a Mac list, just forgot that Mac folks use Excel too. I don't actually have Office on any of my Macs. Does anyone know if it is AppleScript-able? Can you drive Excel directly from Python on OS X like you can on Windows? --Dethe Windows has detected the mouse has moved. Please restart your system for changes to take effect. From sw at wordtech-software.com Thu Nov 10 20:25:19 2005 From: sw at wordtech-software.com (Kevin Walzer) Date: Thu, 10 Nov 2005 14:25:19 -0500 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: <6C8B4CCA-3C47-4F9E-AC5A-76D4E223E9DF@livingcode.org> References: <4B9D8B45-3A98-4069-BEE9-7EF557A0245D@livingcode.org> <6C8B4CCA-3C47-4F9E-AC5A-76D4E223E9DF@livingcode.org> Message-ID: <43739E9F.8050605@wordtech-software.com> Dethe Elza wrote: > On 10-Nov-05, at 10:18 AM, Bob Ippolito wrote: >> I use this to convert excel to xml, and parse that from Python. >> http://www.andykhan.com/jexcelapi/ >> >> -bob > > Oops. Obviously I failed to note which list this question was posed > on, I assumed it was edu-sig for some reason. Sorry, didn't mean to > give you Windows tips on a Mac list, just forgot that Mac folks use > Excel too. > > I don't actually have Office on any of my Macs. Does anyone know if > it is AppleScript-able? Can you drive Excel directly from Python on > OS X like you can on Windows? > > --Dethe > > Windows has detected the mouse has moved. Please restart your system > for changes to take effect. > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > > Excel on Mac is AppleScriptable through a weird path: Excel exposes the VBA object model to AppleScript. So, it's not AppleScriptable in the standard sense and I am not sure how you would access it from Python. -- Cheers, Kevin Walzer, PhD WordTech Software - "Tame the Terminal" http://www.wordtech-software.com sw at wordtech-software.com From delza at livingcode.org Thu Nov 10 20:29:45 2005 From: delza at livingcode.org (Dethe Elza) Date: Thu, 10 Nov 2005 11:29:45 -0800 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: <43739E9F.8050605@wordtech-software.com> References: <4B9D8B45-3A98-4069-BEE9-7EF557A0245D@livingcode.org> <6C8B4CCA-3C47-4F9E-AC5A-76D4E223E9DF@livingcode.org> <43739E9F.8050605@wordtech-software.com> Message-ID: > Excel on Mac is AppleScriptable through a weird path: Excel exposes > the VBA object model to AppleScript. So, it's not AppleScriptable > in the standard sense and I am not sure how you would access it > from Python. Thanks for the info, Kevin. It sounds like downloading OpenOffice and using PyUNO would be fun in comparison. --Dethe ...if there's not much you can do with HTML, it does have the advantage of being easy to learn. -- Paul Graham From berkowit at silcom.com Thu Nov 10 20:54:54 2005 From: berkowit at silcom.com (Paul Berkowitz) Date: Thu, 10 Nov 2005 11:54:54 -0800 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: <43739E9F.8050605@wordtech-software.com> Message-ID: On 11/10/05 11:25 AM, "Kevin Walzer" wrote: > Excel on Mac is AppleScriptable through a weird path: Excel exposes the > VBA object model to AppleScript. So, it's not AppleScriptable in the > standard sense and I am not sure how you would access it from Python. > Actually, that's completely false - you must have been thinking of PowerPoint X and (effectively) Word X and earlier, which have 'do Visual Basic' commands in AppleScript. (Word always had a limited pure AppleScript dictionary too, but it was far too buggy and didn't work properly - until Word 2004, which works just fine.) Although Excel does also have VBA, it has always had a first-rate AppleScript object model, even in earlier versions (X and earlier), which always worked well. In the most recent recent version, Office 2004, its AppleScript dictionary was completely rewritten along with Word's and PowerPoint's - and its native AppleScript is now even better, and complete. It mirrors the VBA model, definitely, and its AppleScript syntax is thus a little, shall we say "obscure", but it's pure AppleScript. Aside from its voluminous AppleScript dictionary, there's also an AppleScript Reference Guide you can get from MacTopia - the Microsoft Mac website (http://www.microsoft.com/mac/) /Resources/Developer/AppleScript. You can access it (and earlier versions too) via has's appscript from Python. -- Paul Berkowitz From bob at redivi.com Thu Nov 10 21:02:18 2005 From: bob at redivi.com (Bob Ippolito) Date: Thu, 10 Nov 2005 12:02:18 -0800 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: References: <4B9D8B45-3A98-4069-BEE9-7EF557A0245D@livingcode.org> <6C8B4CCA-3C47-4F9E-AC5A-76D4E223E9DF@livingcode.org> <43739E9F.8050605@wordtech-software.com> Message-ID: <9F1FA3BA-E5E6-443F-9BDF-10EE15CD43B8@redivi.com> On Nov 10, 2005, at 11:29 AM, Dethe Elza wrote: >> Excel on Mac is AppleScriptable through a weird path: Excel exposes >> the VBA object model to AppleScript. So, it's not AppleScriptable >> in the standard sense and I am not sure how you would access it >> from Python. > > Thanks for the info, Kevin. It sounds like downloading OpenOffice > and using PyUNO would be fun in comparison. You can do it, it's just an awkward API.. but anyway, using a Java library to do it is much nicer, faster, cheaper, and more portable (anywhere with a JRE installed). Conveniently, the jar is also a CLI app that can just convert to CSV and XML without even having to look at any Java code, so it's really quite ideal. I haven't had any issues with it, and unlike the Perl equivalent (Spreadsheet::Excel or something), it deals with Unicode correctly. -bob From sw at wordtech-software.com Thu Nov 10 21:06:20 2005 From: sw at wordtech-software.com (Kevin Walzer) Date: Thu, 10 Nov 2005 15:06:20 -0500 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: References: Message-ID: <4373A83C.7080001@wordtech-software.com> Paul Berkowitz wrote: > It mirrors the VBA model, definitely, and its AppleScript syntax is thus a > little, shall we say "obscure", This is what I referring to. From Matt Neuburg's book, p. 331: "instead of working out an AppleScript scriptability implementation from scratch, they've simply taken the existing internal scripting implementation (Visual Basic for Applications) and exposed its entire object model, lock, stock, and barrel, to AppleScript...if you don't know how to drive Excel with Visual Basic it's really hard to figure out how to drive it with AppleScript." I cede to your knowledge about the specifics of this, as I do very little with Excel from AS, and am still using v. X. I stand corrected in particular on driving it from Python via appscript. -- Cheers, Kevin Walzer, PhD WordTech Software - "Tame the Terminal" http://www.wordtech-software.com sw at wordtech-software.com From berkowit at silcom.com Thu Nov 10 21:22:18 2005 From: berkowit at silcom.com (Paul Berkowitz) Date: Thu, 10 Nov 2005 12:22:18 -0800 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: <4373A83C.7080001@wordtech-software.com> Message-ID: On 11/10/05 12:06 PM, "Kevin Walzer" wrote: > Paul Berkowitz wrote: > >> It mirrors the VBA model, definitely, and its AppleScript syntax is thus a >> little, shall we say "obscure", > > > This is what I referring to. From Matt Neuburg's book, p. 331: > "instead of working out an AppleScript scriptability implementation from > scratch, they've simply taken the existing internal scripting > implementation (Visual Basic for Applications) and exposed its entire > object model, lock, stock, and barrel, to AppleScript...if you don't > know how to drive Excel with Visual Basic it's really hard to figure out > how to drive it with AppleScript." Well, that was before they published the AppleScript Reference, which makes it quite a bit easier. It's definitely not very "English-like", which AppleScript is meant to be, but that shouldn't be a hindrance to Python scripters. Using appscript with its dot language will actually put it back to something more like the VBA from which it was "derived". Matt doesn't have that quite right either: both VBA and AppleScript actually hook in, separately, to the underlying OLE Automation model: AppleScript does not "go through" VBA. But the model is definitely more accommodating to VBA, and to Python, for that matter, than to normal AppleScript, since it was designed for a language where you can specify the arguments of a method explicitly by naming both the arguments (keys) and values rather than just have them all run on like AppleScript does it. > > I cede to your knowledge about the specifics of this, as I do very > little with Excel from AS, and am still using v. X. I stand corrected in > particular on driving it from Python via appscript. It would certainly be "interesting" - but can be done. -- Paul Berkowitz From hengist.podd at virgin.net Thu Nov 10 23:34:45 2005 From: hengist.podd at virgin.net (has) Date: Thu, 10 Nov 2005 22:34:45 +0000 Subject: [Pythonmac-SIG] inputing multi-digit numbers In-Reply-To: References: Message-ID: Paul Berkowitz wrote: >[Excel's scripting interface is] definitely not very "English-like", which AppleScript is meant to be, The 'English-like' aspect is superficial and somewhat by-the-by; the defining characteristic of the Apple Event Object Model is that it's query-driven. Excel and Word expose conventional OO-style interfaces; everything is done via accessors and iteration and invoking methods on objects one at a time. It's the sort of lower-level API a true AEOM would abstract over, but MS - presumably for reasons of economy - just bridge it directly. >But the model is definitely more accommodating to VBA, and to >Python, for that matter, than to normal AppleScript, Python has no technical issues with the AEOM. One problem that does occur is that most Python users aren't familiar with the AEOM, so they look at some appscript code and because it uses OO-like syntax they assume it will behave according to OO rules too, which it doesn't. For the latest release I've added a couple chapters to the manual that explain all this stuff in some detail, so hopefully there'll be less of this confusion in future. >since it was designed >for a language where you can specify the arguments of a method explicitly by >naming both the arguments (keys) and values rather than just have them all >run on like AppleScript does it. Don't really follow you here, unless you mean that Excel doesn't use whitespace in its keywords. (AS-style keywords are a non-issue for Python, etc. anyway, since it's easy to transform them automatically to C-style identifiers.) > > I cede to your knowledge about the specifics of this, as I do very >> little with Excel from AS, and am still using v. X. I stand corrected in >> particular on driving it from Python via appscript. > >It would certainly be "interesting" - but can be done. Sure - errors and omissions excepted. I've done some minor tests and shaken out a couple 'issues' so far, as Excel is one of those odd corner cases that's good for flushing out subtle incompatibilities with AppleScript. It's been a bit of a PITA determining where appscript's tolerance of other parties' rank stupidity should begin and end. AppleScript's merry acceptance of all kinds of weird slop masks a whole bunch of application sins, and Apple don't set down sufficiently rigorous specifications for application and AE bridge developers to avoid creating/being caught out by them. I try to resolve these as I find them/they're reported, but you never know for sure; application developers can be awfully creative. So if you do run into any problems, let me know of them. Currently there are a couple caveats I'm aware of: 1. Excel defines 'Get' and 'Set' commands in its dictionary, but these do not work correctly. Use 'get' and 'set' instead (appscript defines these as standard since so many applications don't). 2. htmldoc re-formats direct parameters of type 'reference'; this omits some description info that might be of use and fails to indicate when a direct parameter is optional (there are bugs filed on this, but I've yet to figure out the best solution) If someone (Paul, maybe?) wants to send me some non-trivial AppleScripts and test data that will work on Excel X (I don't have 2004), I'll be happy to port them to Python and see how they fare. has -- http://freespace.virgin.net/hamish.sanderson/ From pjdavis at engineering.uiowa.edu Sat Nov 12 05:43:04 2005 From: pjdavis at engineering.uiowa.edu (Paul Davis) Date: Fri, 11 Nov 2005 22:43:04 -0600 Subject: [Pythonmac-SIG] Appscript Container Errors Message-ID: <437572D8.5010301@engineering.uiowa.edu> Before I start I'd just like to say I'm not sure if this is the most appropriate place for Appscript questions, but its been one of the more helpful places to look for answers which is why I'm shooting in this direction in the dark. A bit of background, I'm currently working on a project that interfaces with OmniGraffle. While I don't expect any application specific answers, I'm looking for a bit of info on what some specific errors mean. Any specific clues on how to use the type of error as an idea on how to debug would be most welcome. Ie. general situations which would cause the error stuff of that nature. NSContainerSpecifierError I'm getting this when attempting to use the make command. I'm under the the general assumption that this means the point at which I'm trying to insert my new object is not willing to accept the creation of that type of object. I was wondering if someone could shine any light on this. Is there a deeper meaning here that I'm missing. NSArgumentsWrongScriptError I'm assuming this means, "Hey, dummy, you gave me an apple when I asked for an orange." Or something. NSUnknownKeyScriptError errmmm.... Anyway, those are the main ones I've been seeing. Much obliged, Paul Davis From hengist.podd at virgin.net Sat Nov 12 12:39:41 2005 From: hengist.podd at virgin.net (has) Date: Sat, 12 Nov 2005 11:39:41 +0000 Subject: [Pythonmac-SIG] Appscript Container Errors Message-ID: Paul Davis wrote: >Before I start I'd just like to say I'm not sure if this is the most >appropriate place for Appscript questions, Here's fine. The MacScrpt list is also useful if you've got questions on using specific applications rather than appscript itself. >A bit of background, I'm currently working on a project that interfaces >with OmniGraffle. While I don't expect any application specific >answers, I'm looking for a bit of info on what some specific errors >mean. Cocoa apps are notorious for lousy error reporting - the Cocoa Scripting framework generates rubbish default descriptions and most developers fail to implement their own. For a basic translation of all those NSIncomprehensibleNonsense messages, see: http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSScriptObjectSpecifier.html#//apple_ref/doc/uid/20000042-12193 http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSScriptCommand.html#//apple_ref/doc/uid/20000009-36822 >NSContainerSpecifierError >I'm getting this when attempting to use the make command. I'm under the >the general assumption that this means the point at which I'm trying to >insert my new object is not willing to accept the creation of that type >of object. An invalid or incorrect reference, most likely the insertion location in this case. You'd need to post code for more specific advice. >NSArgumentsWrongScriptError >I'm assuming this means, "Hey, dummy, you gave me an apple when I asked >for an orange." Yup. Wrong type or value. Again, post code if you need more help. >NSUnknownKeyScriptError File a bug report. BTW, don't be shy about bugging the developer to improve their error reporting in general, and Apple about providing better default error reporting in the first place. HTH has -- http://freespace.virgin.net/hamish.sanderson/ From pjdavis at engineering.uiowa.edu Sat Nov 12 13:01:00 2005 From: pjdavis at engineering.uiowa.edu (Paul Davis) Date: Sat, 12 Nov 2005 06:01:00 -0600 Subject: [Pythonmac-SIG] AppScript code Message-ID: <4375D97C.7080401@engineering.uiowa.edu> First, I'd like to thank Has for the info on those errors. I kind of like to think of writing AppleScript as walking blindfolded in a pitch dark room and constantly bumping into the furniture. Anyway... I've posted a working version of a utility to import SQL schema into OmniGraffle. Just thought I'd spread around some of the love. http://www.engineering.uiowa.edu/~pjdavis/DBGraffle4/ Thanks again, Paul From hengist.podd at virgin.net Sat Nov 12 16:44:38 2005 From: hengist.podd at virgin.net (has) Date: Sat, 12 Nov 2005 15:44:38 +0000 Subject: [Pythonmac-SIG] AppScript code Message-ID: Paul Davis wrote: >First, I'd like to thank Has for the info on those errors. I kind of >like to think of writing AppleScript as walking blindfolded in a pitch >dark room and constantly bumping into the furniture. To be fair to AppleScript, these sorts of problems are the applications' fault, whether for implementing buggy or badly designed scripting support, providing inadequate user documentation, or both. Not even appscript can save you from that, I'm afraid. ;) Still, I'll see about making appscript insert more meaningful generic descriptions for the default NS...Error messages in future; should help a little. >I've posted a working version of a utility to import SQL schema into >OmniGraffle. Just thought I'd spread around some of the love. > >http://www.engineering.uiowa.edu/~pjdavis/DBGraffle4/ Sweet. One thing: the 'DBGraffle4.scpt' file seems to be scragged. I couldn't get it to open correctly in Script Editor; from the raw data it looks like it might be an applet, but it wouldn't open in SE as a .app either. Re. spreading the love, you thought of building a standalone version with py2app and posting it on VersionTracker, etc.? HTH has -- http://freespace.virgin.net/hamish.sanderson/ From pjdavis at engineering.uiowa.edu Sat Nov 12 18:58:58 2005 From: pjdavis at engineering.uiowa.edu (Paul Davis) Date: Sat, 12 Nov 2005 11:58:58 -0600 Subject: [Pythonmac-SIG] AppScript code In-Reply-To: <43762D0D.704@engineering.uiowa.edu> References: <43762D0D.704@engineering.uiowa.edu> Message-ID: <43762D62.7090504@engineering.uiowa.edu> Paul Davis wrote: > has wrote: > >> Paul Davis wrote: >> >> >> >>> First, I'd like to thank Has for the info on those errors. I kind of >>> like to think of writing AppleScript as walking blindfolded in a pitch >>> dark room and constantly bumping into the furniture. >>> >> >> >> To be fair to AppleScript, these sorts of problems are the >> applications' fault, whether for implementing buggy or badly designed >> scripting support, providing inadequate user documentation, or both. >> Not even appscript can save you from that, I'm afraid. ;) >> >> Still, I'll see about making appscript insert more meaningful generic >> descriptions for the default NS...Error messages in future; should >> help a little. >> >> >> >> >>> I've posted a working version of a utility to import SQL schema into >>> OmniGraffle. Just thought I'd spread around some of the love. >>> >>> http://www.engineering.uiowa.edu/~pjdavis/DBGraffle4/ >>> >> >> >> Sweet. One thing: the 'DBGraffle4.scpt' file seems to be scragged. I >> couldn't get it to open correctly in Script Editor; from the raw data >> it looks like it might be an applet, but it wouldn't open in SE as a >> .app either. >> >> Re. spreading the love, you thought of building a standalone version >> with py2app and posting it on VersionTracker, etc.? >> >> HTH >> >> has >> >> > Fixed the applescript on the website. It doesn't actually do anything > other than collect a couple settings and start the python script. > > I've been reading a bit about this py2app business. The first thing > I'll need to figure out is how to make some sort of GUI for it. What > is the easiest package for something like this? If it doesn't take > too long this could be a very interesting facelift. > > I'm looking for the easiest way to mimic the functionality of the > AppleScript DBGraffle4.scpt. All it does is throw up a couple dialog > boxes for user input and then runs the command. If I could get a > single window to do this in python, thats probably what I'd go for. > > Anyhow, time to work > > Cheers, > Paul > I missed the reply to all button. My bad. From sw at wordtech-software.com Mon Nov 14 19:44:14 2005 From: sw at wordtech-software.com (Kevin Walzer) Date: Mon, 14 Nov 2005 13:44:14 -0500 Subject: [Pythonmac-SIG] py2app/macho_standalone problem Message-ID: <4378DAFE.1000000@wordtech-software.com> I'm having a problem with the macho_standalone component of py2app (I'm trying to use it, as the documentation says I can, to create a standalone app bundle of a non-Python application). Here is the output: Kevin-Walzers-Computer:~ kevin$ macho_standalone ~/Desktop/AquaEthereal.app Traceback (most recent call last): File "/usr/local/bin/macho_standalone", line 20, in ? main() File "/usr/local/bin/macho_standalone", line 17, in main standaloneApp(fn) File "/usr/local/bin/macho_standalone", line 10, in standaloneApp files = MachOStandalone(path).run() File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app/macholib/MachOStandalone.py", line 92, in run mm.run_file(fn) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app/macholib/MachOGraph.py", line 59, in run_file m = self.createNode(MachO, pathname) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app/macholib/MachOStandalone.py", line 17, in createNode res = super(FilteredMachOGraph, self).createNode(cls, name) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app/altgraph/ObjectGraph.py", line 134, in createNode m = cls(name, *args, **kw) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app/macholib/MachO.py", line 60, in __init__ self.load(file(filename, 'rb')) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app/macholib/MachO.py", line 89, in load header = self.load_fat(fat, fh) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app/macholib/MachO.py", line 71, in load_fat archs = [fat_arch.from_fileobj(fh) for i in xrange(fat.nfat_arch)] File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app/macholib/ptypes.py", line 43, in from_fileobj return cls.from_str(f.read(cls._size_)) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/py2app/macholib/ptypes.py", line 46, in from_str return cls.from_tuple(struct.unpack(cls._endian_ + cls._format_, s)) struct.error: unpack str size does not match format Kevin-Walzers-Computer:~ kevin$ What happens is that a few libraries get copied over to /Frameworks in my app bundle, then the process stops (there are lot of libraries to copy). I'm not trying to create a universal binary, so I'm not sure what the error is. Is there a flag I can set so that it doesn't try to create a universal binary, i.e. macho_standalone Foo.app -arch ppc? -- Cheers, Kevin Walzer, PhD WordTech Software - "Tame the Terminal" http://www.wordtech-software.com sw at wordtech-software.com From bob at redivi.com Mon Nov 14 19:53:55 2005 From: bob at redivi.com (Bob Ippolito) Date: Mon, 14 Nov 2005 10:53:55 -0800 Subject: [Pythonmac-SIG] py2app/macho_standalone problem In-Reply-To: <4378DAFE.1000000@wordtech-software.com> References: <4378DAFE.1000000@wordtech-software.com> Message-ID: <7C907572-639D-455F-8748-F30DF746EAB2@redivi.com> On Nov 14, 2005, at 10:44 AM, Kevin Walzer wrote: > I'm having a problem with the macho_standalone component of py2app > (I'm > trying to use it, as the documentation says I can, to create a > standalone app bundle of a non-Python application). Here is the > output: -- > What happens is that a few libraries get copied over to /Frameworks in > my app bundle, then the process stops (there are lot of libraries > to copy). > > I'm not trying to create a universal binary, so I'm not sure what the > error is. Is there a flag I can set so that it doesn't try to create a > universal binary, i.e. macho_standalone Foo.app -arch ppc? Try using the latest version from svn. macholib doesn't create anything, it only makes small transforms to existing files, so there aren't any architecture options... but it does need to understand how to read and write universal binaries in order to make those transforms. The version you're using doesn't understand them very well. -bob From sw at wordtech-software.com Mon Nov 14 20:51:35 2005 From: sw at wordtech-software.com (Kevin Walzer) Date: Mon, 14 Nov 2005 14:51:35 -0500 Subject: [Pythonmac-SIG] py2app/macho_standalone problem In-Reply-To: <7C907572-639D-455F-8748-F30DF746EAB2@redivi.com> References: <4378DAFE.1000000@wordtech-software.com> <7C907572-639D-455F-8748-F30DF746EAB2@redivi.com> Message-ID: <4378EAC7.2080506@wordtech-software.com> Bob Ippolito wrote: > > > Try using the latest version from svn. macholib doesn't create > anything, it only makes small transforms to existing files, so there > aren't any architecture options... but it does need to understand how to > read and write universal binaries in order to make those transforms. > The version you're using doesn't understand them very well. > > -bob > I downloaded and installed from svn trunk, but I'm still getting the same errors. I don't know if this is significant, but it's a Gtk app I'm trying to package: I see "Gtk support" on the list of things to do (though it's not a PyGtk app: it's Ethereal). -- Cheers, Kevin Walzer, PhD WordTech Software - "Tame the Terminal" http://www.wordtech-software.com sw at wordtech-software.com From bob at redivi.com Mon Nov 14 21:10:35 2005 From: bob at redivi.com (Bob Ippolito) Date: Mon, 14 Nov 2005 12:10:35 -0800 Subject: [Pythonmac-SIG] py2app/macho_standalone problem In-Reply-To: <4378EAC7.2080506@wordtech-software.com> References: <4378DAFE.1000000@wordtech-software.com> <7C907572-639D-455F-8748-F30DF746EAB2@redivi.com> <4378EAC7.2080506@wordtech-software.com> Message-ID: <07C0A2D3-F8EB-448E-8FEA-4A5B05077A72@redivi.com> On Nov 14, 2005, at 11:51 AM, Kevin Walzer wrote: > Bob Ippolito wrote: >> > >> >> Try using the latest version from svn. macholib doesn't create >> anything, it only makes small transforms to existing files, so there >> aren't any architecture options... but it does need to understand >> how to >> read and write universal binaries in order to make those transforms. >> The version you're using doesn't understand them very well. > > I downloaded and installed from svn trunk, but I'm still getting the > same errors. Not sure then, sorry. I don't really have time to look further into it for a while. > I don't know if this is significant, but it's a Gtk app I'm trying to > package: I see "Gtk support" on the list of things to do (though it's > not a PyGtk app: it's Ethereal). Not related. That GTK support is referring to automatically including a pango data file. -bob From hengist.podd at virgin.net Mon Nov 14 21:40:20 2005 From: hengist.podd at virgin.net (has) Date: Mon, 14 Nov 2005 20:40:20 +0000 Subject: [Pythonmac-SIG] extension design question Message-ID: Hi all, I'm patching and extending copies of Carbon.AE and Carbon.OSA, and looking for advice on the best way to do the following, given that my C sucks: To allow clients to install Python functions via OSASetCreateProc(), I've defined a GenericCreateFunction() procedure similar to the GenericEventHandler() procedure used in _AEmodule.c: static pascal OSErr GenericCreateFunction(AEEventClass theAEEventClass, AEEventID theAEEventID, const AEAddressDesc *target, short returnID, long transactionID, AppleEvent *result, long refcon) // refcon holds ptr to client's Python function { PyObject *args, *res; args = Py_BuildValue("O&O&O&hl", PyMac_BuildOSType, theAEEventClass, PyMac_BuildOSType, theAEEventID, AEDesc_New, target, returnID, transactionID); if (args == NULL) { PySys_WriteStderr("Exception in UPPWrapper function.\n"); PyErr_Print(); return errOSAGeneralError; } res = PyEval_CallObject((PyObject *)refcon, args); if (res == NULL) { PySys_WriteStderr("Exception in GenericCreateFunction().\n"); PyErr_Print(); return errOSAGeneralError; } if (!AEDesc_Check(res)) { // <---- (1) Py_DECREF(res); PySys_WriteStderr("GenericCreateFunction() didn't return an AEDesc.\n"); return errOSAGeneralError; } if (AEDuplicateDesc(&((AEDescObject *)res)->ob_itself, result)) { // <---- (2) Py_DECREF(res); return -1; } Py_DECREF(res); return noErr; } The problem is that the two marked lines refer to AEDesc_Check() and AEDescObject which are defined in _AEmodule.c. For the typecheck (1), I'm thinking I could import AE.so using PyImport_AddModule() and use PyObject_IsInstance() to check against the AEDesc type defined there. For the cast (2), I can copy-n-paste the original AEDescObject struct from _AEmodule.c to _OSAmodule.c, but I'd really like to think there was a more elegant way to do this. Thanks, has -- http://freespace.virgin.net/hamish.sanderson/ From dreedmac at columbus.rr.com Tue Nov 15 02:42:30 2005 From: dreedmac at columbus.rr.com (David Reed) Date: Mon, 14 Nov 2005 20:42:30 -0500 Subject: [Pythonmac-SIG] book recommendation Message-ID: I've an experienced Python programmer on Linux - I've mainly used gtk and glade for interfaces and now I'm slowly trying to get started with Cocoa apps on X-Code. I've got the CurrencyConverter example working in Python and I did the HelloWorld example in "The Mac XCode 2 Book" by Cohen and Cohen in Objective C. I got the Python version working by guessing that I needed to use: self.helloSayer.setStringValue_("Hello world") based on the CurrencyConverter example that did: setFloatValue_ That was pretty obvious, but I think I need a Cocoa book that allows me to see what all the methods are for a given object. I've just started the above mentioned XCode 2 book, but it doesn't appear to have the details of all the Cocoa objects. Does anyone have a recommendation for another book I should get - I assume I want a Cocoa book of some sort. Thanks, Dave -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2377 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20051114/b4f8e35a/smime.bin From bob at redivi.com Tue Nov 15 03:00:52 2005 From: bob at redivi.com (Bob Ippolito) Date: Mon, 14 Nov 2005 18:00:52 -0800 Subject: [Pythonmac-SIG] book recommendation In-Reply-To: References: Message-ID: <60461BED-4024-46B6-99A4-4D0582393E5B@redivi.com> On Nov 14, 2005, at 5:42 PM, David Reed wrote: > I've an experienced Python programmer on Linux - I've mainly used > gtk and glade for interfaces and now I'm slowly trying to get > started with Cocoa apps on X-Code. > > I've got the CurrencyConverter example working in Python and I did > the HelloWorld example in "The Mac XCode 2 Book" by Cohen and Cohen > in Objective C. I got the Python version working by guessing that > I needed to use: > > self.helloSayer.setStringValue_("Hello world") > > based on the CurrencyConverter example that did: setFloatValue_ > > That was pretty obvious, but I think I need a Cocoa book that > allows me to see what all the methods are for a given object. I've > just started the above mentioned XCode 2 book, but it doesn't > appear to have the details of all the Cocoa objects. > > Does anyone have a recommendation for another book I should get - I > assume I want a Cocoa book of some sort. If you want a reference, go here (or use the documentation facility in Xcode): http://developer.apple.com/cocoa/ I doubt that you're going to find a good book that has it all and is reasonably up to date. -bob From dreed at capital.edu Tue Nov 15 02:27:31 2005 From: dreed at capital.edu (Dave Reed) Date: Mon, 14 Nov 2005 20:27:31 -0500 Subject: [Pythonmac-SIG] book recommendation Message-ID: <8B9EC68A-9D4F-4BA4-942D-649E40E4B706@capital.edu> I've an experienced Python programmer on Linux - I've mainly used gtk and glade for interfaces and now I'm slowly trying to get started with Cocoa apps on X-Code. I've got the CurrencyConverter example working in Python and I did the HelloWorld example in "The Mac XCode 2 Book" by Cohen and Cohen in Objective C. I got the Python version working by guessing that I needed to use: self.helloSayer.setStringValue_("Hello world") based on the CurrencyConverter example that did: setFloatValue_ That was pretty obvious, but I think I need a Cocoa book that allows me to see what all the methods are for a given object. I've just started the above mentioned XCode 2 book, but it doesn't appear to have the details of all the Cocoa objects. Does anyone have a recommendation for another book I should get - I assume I want a Cocoa book of some sort. Thanks, Dave -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2363 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20051114/62c98df9/smime-0001.bin From david at personconsulting.com Tue Nov 15 04:45:28 2005 From: david at personconsulting.com (David Person) Date: Mon, 14 Nov 2005 19:45:28 -0800 Subject: [Pythonmac-SIG] Calling python application from AppScript Message-ID: <6F10F45A-DCC2-4055-B0BB-20BA21F59461@personconsulting.com> Hello: I'm sure there must be a simple answer, but I'm flummoxed trying to send an AppleEvent from one python program to another. The 'server' program has this code: class avServer(AEServer, MiniApplication): def __init__(self): MiniApplication.__init__(self) AEServer.__init__(self) self.installaehandler('aevt','oapp',self.openApp) self.installaehandler('aevt','quit',self.quit) self.installaehandler('ascr','psbr',self.processEvent) self.installaehandler('aevt','rapp',self.activate) self.installaehandler('****','****',self.other) When I use this applescript, it works: tell application a set r to processEvent("system", "start") end tell ...but when I try from another python application I get an error: from appscript import * ap=app('pc-av') ap.processEvent('system','start') ...or any number of other permutations. The most common error is "RuntimeError: Unknown property, element or command: 'processEvent' Does anyone have any tips on how to do this? I'm writing both the client and server, so any method is fine. Get() and Set() will be fine if I could only get them to work... Thanks for any help you can give, -dp- David From hengist.podd at virgin.net Tue Nov 15 11:21:33 2005 From: hengist.podd at virgin.net (has) Date: Tue, 15 Nov 2005 10:21:33 +0000 Subject: [Pythonmac-SIG] Calling python application from AppScript Message-ID: David Person wrote: >When I use this applescript, it works: > > tell application a > set r to processEvent("system", "start") > end tell > >...but when I try from another python application I get an error: > >from appscript import * >ap=app('pc-av') >ap.processEvent('system','start') Two things: 1. appscript only works for applications that have an aete/sdef terminology resource, and 2. it doesn't support the special 'ascrbsbr' event, which is not something used outside of AppleScript applets. You'd need to use aem instead: from aem import * Application(a).event('ascrpsbr', {'snam':'processevent', '----':['system', 'start']}).send() Anyway, the usual approach would be to define a standard AE handler, e.g. 'PCAVProE', with named parameters, '----' (direct) and 'Par2'. That allows you to write: Application(a).event('PCAVProE', {'----':'system', 'Par2':'start'}).send() or: tell application a set r to ?event PCAVProE? "system" given ?class Par2?:"start" end tell You can then add an aete/sdef resource to provide terminology for that command if you want. HTH has -- http://freespace.virgin.net/hamish.sanderson/ From jnutting at gmail.com Tue Nov 15 12:10:39 2005 From: jnutting at gmail.com (Jack Nutting) Date: Tue, 15 Nov 2005 12:10:39 +0100 Subject: [Pythonmac-SIG] book recommendation In-Reply-To: <8B9EC68A-9D4F-4BA4-942D-649E40E4B706@capital.edu> References: <8B9EC68A-9D4F-4BA4-942D-649E40E4B706@capital.edu> Message-ID: On 11/15/05, Dave Reed wrote: > > I've an experienced Python programmer on Linux - I've mainly used gtk > and glade for interfaces and now I'm slowly trying to get started > with Cocoa apps on X-Code. > > I've got the CurrencyConverter example working in Python and I did > the HelloWorld example in "The Mac XCode 2 Book" by Cohen and Cohen > in Objective C. I got the Python version working by guessing that I > needed to use: > > self.helloSayer.setStringValue_("Hello world") > > based on the CurrencyConverter example that did: setFloatValue_ > > That was pretty obvious, but I think I need a Cocoa book that allows > me to see what all the methods are for a given object. I've just > started the above mentioned XCode 2 book, but it doesn't appear to > have the details of all the Cocoa objects. > > Does anyone have a recommendation for another book I should get - I > assume I want a Cocoa book of some sort. I don't know if any of the available Cocoa books really cover the entire Foundation and AppKit APIs, but I kind of doubt it since the class libraries are so huge. However, the API documentation is all installed along with XCode, ready for there to use. You can browse the docs within XCode, but instead I'd recommend AppKiDo: http://homepage.mac.com/aglee/downloads/appkido.html It looks through the installed API documentation, and provides a slick, quick interface to search browse the class libraries, more quickly and effectively than a print book could ever provide (IMHO). -- // jack // http://www.nuthole.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051115/e04428d7/attachment.html From jnutting at gmail.com Tue Nov 15 13:02:06 2005 From: jnutting at gmail.com (Jack Nutting) Date: Tue, 15 Nov 2005 13:02:06 +0100 Subject: [Pythonmac-SIG] book recommendation In-Reply-To: <4379C40A.3010004@engineering.uiowa.edu> References: <8B9EC68A-9D4F-4BA4-942D-649E40E4B706@capital.edu> <4379C40A.3010004@engineering.uiowa.edu> Message-ID: On 11/15/05, Paul Davis wrote: > > Not that my opinion has much weight on this matter, but I also recently > started playing with PyObjC and Cocoa. I really noticed that the API > documentation that apple provides is extremely hard to navigate. My > buddy told me that there are programs to read the documentation. Of all > the programing languages and all the API's I have learned, this is the > first time I've heard of such a thing. I'm not sure what exactly this > says about the API, but I'm thinking its not good. I don't really have > a point to make here. And with that... > > I think it's a very good point. It would be really nice if Apple had all the documentation in the header files, so that documentation in different formats (like Apple's current docs, or like Java html docs, or whatever) could be autogenerated, in particular so that people could generate whatever kind of docs they wanted. If that were the case, it should even be easy to even generate PyObjC-syntax docs for the frameworks. What the heck, I'll post it as a bug on http://bugreport.apple.com just for fun. -- // jack // http://www.nuthole.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051115/4983413e/attachment.htm From telliott at hsc.wvu.edu Tue Nov 15 19:06:53 2005 From: telliott at hsc.wvu.edu (Tom Elliott) Date: Tue, 15 Nov 2005 13:06:53 -0500 Subject: [Pythonmac-SIG] simple pyobjc question Message-ID: I have 2 classes, one which responds to user input, calculates stuff and displays the result in a series of NSTextFields, and a second class that is a subclass of NSView called MyView, which can display the same type of information graphically. What I'd like is for the first class to be able to use MyView to display its results, but I don't know how to get them to talk to each other. If I had an instance of MyView I could pass in data and call setNeedsDisplay(True) via a button in the interface. How should I do this? Tom Elliott From delza at livingcode.org Tue Nov 15 22:50:18 2005 From: delza at livingcode.org (Dethe Elza) Date: Tue, 15 Nov 2005 13:50:18 -0800 Subject: [Pythonmac-SIG] book recommendation In-Reply-To: References: Message-ID: <7CB229BC-A272-42C1-B51D-5B9F9685A1A9@livingcode.org> Hi David, While no one book covers all of Cocoa, going through a book can help give you a "feel" for how Cocoa programs come together. I've often caught myself making things *way* more difficult than they need to be before I discovered the Coccoa Way To Do It. I'm still learning the Cocoa Way, but it is worth the effort. I've found that both the Hillegass[1] and Garfinkel[2] books were worth reading, as have quite different approaches and cover different parts of Cocoa to some degree. I've heard good things about the Anguish[3] book, and while I haven't read it, I have read his earlier book and have high expectations of this one. Finally, keeping something like AppKiDo[4] around can help you navigate the Apple documentation more readily. I hope that helps. --Dethe [1] Aaron Hillegass, Cocoa Programming for OS X, ISBN: 0321213149 [2] Garfinkel and Mahoney, Building Cocoa Applications: A Step by Step Guide, ISBN: 0596002351 [3] Scott Anguish, et al., Cocoa Programming, ISBN: 0672322307 [4] http://homepage.mac.com/aglee/downloads/appkido.html From dreedmac at columbus.rr.com Wed Nov 16 01:16:43 2005 From: dreedmac at columbus.rr.com (David Reed) Date: Tue, 15 Nov 2005 19:16:43 -0500 Subject: [Pythonmac-SIG] book recommendation In-Reply-To: <7CB229BC-A272-42C1-B51D-5B9F9685A1A9@livingcode.org> References: <7CB229BC-A272-42C1-B51D-5B9F9685A1A9@livingcode.org> Message-ID: <90026986-EB5B-4AB0-AE22-57BC71AD1774@columbus.rr.com> On Nov 15, 2005, at 4:50 PM, Dethe Elza wrote: > Hi David, > > While no one book covers all of Cocoa, going through a book can > help give you a "feel" for how Cocoa programs come together. I've > often caught myself making things *way* more difficult than they > need to be before I discovered the Coccoa Way To Do It. I'm still > learning the Cocoa Way, but it is worth the effort. > > I've found that both the Hillegass[1] and Garfinkel[2] books were > worth reading, as have quite different approaches and cover > different parts of Cocoa to some degree. I've heard good things > about the Anguish[3] book, and while I haven't read it, I have read > his earlier book and have high expectations of this one. > > Finally, keeping something like AppKiDo[4] around can help you > navigate the Apple documentation more readily. > > I hope that helps. > > --Dethe > > [1] Aaron Hillegass, Cocoa Programming for OS X, ISBN: 0321213149 > [2] Garfinkel and Mahoney, Building Cocoa Applications: A Step by > Step Guide, ISBN: 0596002351 > [3] Scott Anguish, et al., Cocoa Programming, ISBN: 0672322307 > [4] http://homepage.mac.com/aglee/downloads/appkido.html Thanks to everyone who replied. The [4] program looks excellent for a reference. I still need a book to help me "learn the Cocoa way" as Dethe puts it. I'll probably take a look at the above mentioned books and buy at least one of them. The Mac XCode 2 book I have also appears that it will be useful for learning to use XCode but not for really understanding Cocoa (as I would expect based on the title). Dave -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2377 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20051115/52cd120a/smime.bin From TrentM at ActiveState.com Wed Nov 16 01:25:29 2005 From: TrentM at ActiveState.com (TrentM@ActiveState.com) Date: Tue, 15 Nov 2005 16:25:29 -0800 Subject: [Pythonmac-SIG] ANN: ActivePython 2.4.2 is now available Message-ID: <200511160025.jAG0PTWh005401@smtp3.ActiveState.com> I'm happy to announce that ActivePython 2.4.2 is now available for free download from: http://www.ActiveState.com/Products/ActivePython/ This release updates ActivePython to version 2.4.2, that was finalized a few weeks ago. My apologies for the tardiness. If you'll believe it, I've been busy implementing *Ruby* AutoComplete in Komodo. One thing you may not have noticed is that ActivePython has added support for a number of platforms in the past months. Installers are available for the following operating systems and architectures: - Windows/x86 - Mac OS X/powerpc (new) - Linux/x86 - Solaris/SPARC - Solaris/x86 (new) - AIX/powerpc (new) - HP-UX/PA-RISC (new) We would welcome any and all feedback to: ActivePython-feedback at ActiveState.com Please file bugs against ActivePython at: http://bugs.ActiveState.com/ActivePython What is ActivePython? --------------------- ActivePython is ActiveState's quality-assured binary distribution of Python. Builds for AIX, HP-UX, Linux, Mac OS X, Solaris, and Windows are made freely available. ActivePython includes the Python core and core extensions (zlib 1.2.3, bzip2 1.0.2, bsddb 4.2.52, Tk 8.4.9, and Tix 8.1.4) and is fully compatible with other Python distributions of the same version. ActivePython also includes a wealth of Python documentation, including: - the core Python docs; - Andrew Kuchling's "What's New in Python" series; - the Non-Programmer's Tutorial for Python; - Mark Pilgrim's excellent "Dive into Python"; and - a snapshot of the Python FAQs, HOWTOs, and PEPs. An online version of the docs can be found here: http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/welcome.html Extra Bits ---------- ActivePython releases also include the following packages: - Windows "debug" package: Debug-built binaries for ActivePython users building debug versions of their binary Python extensions. - ActivePython24.chm: An MS compiled help collection of the full ActivePython documentation set. Linux users of applications such as xCHM might find this useful. This package is installed by default on Windows. These packages are available from: ftp://ftp.activestate.com/ActivePython/etc/ Thanks, and enjoy! Trent, Python Tech Lead -- Trent Mick TrentM at ActiveState.com From berkowit at silcom.com Wed Nov 16 05:38:18 2005 From: berkowit at silcom.com (Paul Berkowitz) Date: Tue, 15 Nov 2005 20:38:18 -0800 Subject: [Pythonmac-SIG] book recommendation In-Reply-To: <90026986-EB5B-4AB0-AE22-57BC71AD1774@columbus.rr.com> Message-ID: On 11/15/05 4:16 PM, "David Reed" wrote: >> [1] Aaron Hillegass, Cocoa Programming for OS X, ISBN: 0321213149 >> [2] Garfinkel and Mahoney, Building Cocoa Applications: A Step by >> Step Guide, ISBN: 0596002351 >> [3] Scott Anguish, et al., Cocoa Programming, ISBN: 0672322307 >> [4] http://homepage.mac.com/aglee/downloads/appkido.html > > > Thanks to everyone who replied. The [4] program looks excellent for a > reference. I still need a book to help me "learn the Cocoa way" as > Dethe puts it. I'll probably take a look at the above mentioned books > and buy at least one of them. The Mac XCode 2 book I have also > appears that it will be useful for learning to use XCode but not for > really understanding Cocoa (as I would expect based on the title). The Hillegass book is the best book on any programming language I have read. Get it (2nd edition). -- Paul Berkowitz From ronaldoussoren at mac.com Wed Nov 16 07:48:02 2005 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Wed, 16 Nov 2005 07:48:02 +0100 Subject: [Pythonmac-SIG] simple pyobjc question In-Reply-To: References: Message-ID: <03A02E26-FBCA-41AC-BDC0-661C0DD2D4EC@mac.com> On 15-nov-2005, at 19:06, Tom Elliott wrote: > I have 2 classes, one which responds to user input, calculates stuff > and displays the result in a series of NSTextFields, and a second > class that is a subclass of NSView called MyView, which can display > the same type of information graphically. > > What I'd like is for the first class to be able to use MyView to > display its results, but I don't know how to get them to talk to each > other. If I had an instance of MyView I could pass in data and call > setNeedsDisplay(True) via a button in the interface. How should I do > this? One way to do this is giving the first class a number of outlets that can be connected to NSTextFields or MyViews. If you then implement 'setFloatValue_' in MyView you can connect your outlets to MyView to show the results. BTW. This is a very basic Cocoa question. May I suggest looking for a Cocoa tutorial? Ronald > > Tom Elliott > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From glassfordm at hotmail.com Tue Nov 15 23:20:29 2005 From: glassfordm at hotmail.com (Michael Glassford) Date: Tue, 15 Nov 2005 17:20:29 -0500 Subject: [Pythonmac-SIG] "PyObjCPointer created" messages and crash from tooltip handlers Message-ID: I recently added outlineView_toolTipForCell_rect_tableColumn_item_mouseLocation_() and tableView_toolTipForCell_rect_tableColumn_row_mouseLocation_() handlers to a Py2App-based application and started seeing errors like the following being written to the console log: 2005-11-10 11:08:53.891 Goombah[990] PyObjCPointer created: at 0xbfffb570 of type {_NSRect={_NSPoint=ff}{_NSSize=ff}}@i{_NSPoint=ff} That's the only effect I see on my Tiger machine, but on another machine that's running either Jaguar or Panther (I'd have to check), the application also crashes unless these handlers are removed. Can anyone suggest how to fix or work around these issues? Thanks, Mike From jerdonek at gmail.com Wed Nov 16 20:24:29 2005 From: jerdonek at gmail.com (Chris Jerdonek) Date: Wed, 16 Nov 2005 11:24:29 -0800 Subject: [Pythonmac-SIG] py2app and PIL question Message-ID: <338bcfdef8797be5362468ce29ed8497@gmail.com> I have a python program that uses some commands from the PIL module (and also wxPython). I have PIL installed on my Mac, and the python program works fine when I run the program from the command line. The application I get from py2app also works fine -- until I get to a point in the program that requires PIL. Does anyone have any idea why I'm getting this error message? I can see the ImageFont.pyc in a subdirectory of the build directory that py2app created. Thanks for any help anybody can provide, Chris Traceback (most recent call last): File "/Users/chris/Desktop/ER/StoveTop/Old/dist/stovetop.app/Contents/ Resources/Python/stovetop.py", line 205, in Click item.Activate(frame, event) File "reports.pyc", line 326, in GenerateReport File "reports.pyc", line 154, in makePie File "graph.pyc", line 202, in __init__ File "PIL/ImageFont.pyc", line 202, in truetype File "PIL/ImageFont.pyc", line 121, in __init__ IOError: cannot open resource From bob at redivi.com Wed Nov 16 21:18:53 2005 From: bob at redivi.com (Bob Ippolito) Date: Wed, 16 Nov 2005 12:18:53 -0800 Subject: [Pythonmac-SIG] py2app and PIL question In-Reply-To: <338bcfdef8797be5362468ce29ed8497@gmail.com> References: <338bcfdef8797be5362468ce29ed8497@gmail.com> Message-ID: <8036CDD2-970F-4A66-9F4E-0EE6C8209E8A@redivi.com> On Nov 16, 2005, at 11:24 AM, Chris Jerdonek wrote: > I have a python program that uses some commands from the PIL module > (and also wxPython). > > I have PIL installed on my Mac, and the python program works fine when > I run the program from the command line. The application I get from > py2app also works fine -- until I get to a point in the program that > requires PIL. > > Does anyone have any idea why I'm getting this error message? > > I can see the ImageFont.pyc in a subdirectory of the build directory > that py2app created. Code helps... -bob From jerdonek at gmail.com Wed Nov 16 22:24:27 2005 From: jerdonek at gmail.com (Chris Jerdonek) Date: Wed, 16 Nov 2005 13:24:27 -0800 Subject: [Pythonmac-SIG] py2app and PIL question In-Reply-To: <8036CDD2-970F-4A66-9F4E-0EE6C8209E8A@redivi.com> References: <338bcfdef8797be5362468ce29ed8497@gmail.com> <8036CDD2-970F-4A66-9F4E-0EE6C8209E8A@redivi.com> Message-ID: <33beb2b9969b93dc96523677704cbe7d@gmail.com> On Nov 16, 2005, at 12:18 PM, Bob Ippolito wrote: > Code helps... > > -bob Not sure which code is most important. I'll go through the Traceback and intersperse the code. I also inserted line numbers in parentheses: Traceback (most recent call last): File "/Users/chris/Desktop/ER/StoveTop/Old/dist/stovetop.app/Contents/ Resources/Python/stovetop.py", line 205, in Click item.Activate(frame, event) File "reports.pyc", line 333, in GenerateReport (333) text += '

The number of #1 choices received by each slate:

' + makePie(pielist, "SlateRepresentation") + '
' File "reports.pyc", line 158, in makePie (157) import graph (158) mygraph = graph.PieChart(points, colors=mycolors, size=(600, 600), title=' ') File "graph.pyc", line 201, in __init__ (198) self._checkPoints(points) self.image=PIL.Image.new("RGB", self.size, bgColor) self.draw=PIL.ImageDraw.Draw(self.image) (201) self.font = PIL.ImageFont.truetype(font,48) File "PIL/ImageFont.pyc", line 202, in truetype [Part of the PIL code. First line is line 199.] def truetype(filename, size, index=0, encoding=""): "Load a truetype font file." try: (202) return FreeTypeFont(filename, size, index, encoding) except IOError: if sys.platform == "win32": # check the windows font repository # NOTE: must use uppercase WINDIR, to work around bugs in # 1.5.2's os.environ.get() windir = os.environ.get("WINDIR") if windir: filename = os.path.join(windir, "fonts", filename) return FreeTypeFont(filename, size, index, encoding) raise File "PIL/ImageFont.pyc", line 121, in __init__ IOError: cannot open resource # Wrapper for FreeType fonts. Application code should use the # truetype factory function to create font objects. class FreeTypeFont: "FreeType font wrapper (requires _imagingft service)" def __init__(self, file, size, index=0, encoding=""): # FIXME: use service provider instead import _imagingft (121) self.font = _imagingft.getfont(file, size, index, encoding) On Nov 16, 2005, at 12:18 PM, Bob Ippolito wrote: > > On Nov 16, 2005, at 11:24 AM, Chris Jerdonek wrote: > >> I have a python program that uses some commands from the PIL module >> (and also wxPython). >> >> I have PIL installed on my Mac, and the python program works fine when >> I run the program from the command line. The application I get from >> py2app also works fine -- until I get to a point in the program that >> requires PIL. >> >> Does anyone have any idea why I'm getting this error message? >> >> I can see the ImageFont.pyc in a subdirectory of the build directory >> that py2app created. > > Code helps... > > -bob > From bob at redivi.com Wed Nov 16 22:38:29 2005 From: bob at redivi.com (Bob Ippolito) Date: Wed, 16 Nov 2005 13:38:29 -0800 Subject: [Pythonmac-SIG] py2app and PIL question In-Reply-To: <33beb2b9969b93dc96523677704cbe7d@gmail.com> References: <338bcfdef8797be5362468ce29ed8497@gmail.com> <8036CDD2-970F-4A66-9F4E-0EE6C8209E8A@redivi.com> <33beb2b9969b93dc96523677704cbe7d@gmail.com> Message-ID: <9EFB4C11-F253-48EB-BD45-34F497982A54@redivi.com> On Nov 16, 2005, at 1:24 PM, Chris Jerdonek wrote: > On Nov 16, 2005, at 12:18 PM, Bob Ippolito wrote: > >> Code helps... > > Not sure which code is most important. I'll go through the Traceback > and intersperse the code. I also inserted line numbers in > parentheses: > > def truetype(filename, size, index=0, encoding=""): > "Load a truetype font file." > try: > (202) return FreeTypeFont(filename, size, index, encoding) > except IOError: > if sys.platform == "win32": > # check the windows font repository > # NOTE: must use uppercase WINDIR, to work around bugs in > # 1.5.2's os.environ.get() > windir = os.environ.get("WINDIR") > if windir: > filename = os.path.join(windir, "fonts", filename) > return FreeTypeFont(filename, size, index, encoding) > raise > > File "PIL/ImageFont.pyc", line 121, in __init__ > IOError: cannot open resource > > # Wrapper for FreeType fonts. Application code should use the > # truetype factory function to create font objects. > > class FreeTypeFont: > "FreeType font wrapper (requires _imagingft service)" > > def __init__(self, file, size, index=0, encoding=""): > # FIXME: use service provider instead > import _imagingft > (121) self.font = _imagingft.getfont(file, size, index, encoding) Looks like it's trying to find a font or something that isn't where PIL expects it to be... you sure you added all the data files that you're using? -bob From jerdonek at gmail.com Wed Nov 16 23:03:14 2005 From: jerdonek at gmail.com (Chris Jerdonek) Date: Wed, 16 Nov 2005 14:03:14 -0800 Subject: [Pythonmac-SIG] py2app and PIL question In-Reply-To: <9EFB4C11-F253-48EB-BD45-34F497982A54@redivi.com> References: <338bcfdef8797be5362468ce29ed8497@gmail.com> <8036CDD2-970F-4A66-9F4E-0EE6C8209E8A@redivi.com> <33beb2b9969b93dc96523677704cbe7d@gmail.com> <9EFB4C11-F253-48EB-BD45-34F497982A54@redivi.com> Message-ID: On Nov 16, 2005, at 1:38 PM, Bob Ippolito wrote: >> File "PIL/ImageFont.pyc", line 121, in __init__ >> IOError: cannot open resource >> >> # Wrapper for FreeType fonts. Application code should use the >> # truetype factory function to create font objects. >> >> class FreeTypeFont: >> "FreeType font wrapper (requires _imagingft service)" >> >> def __init__(self, file, size, index=0, encoding=""): >> # FIXME: use service provider instead >> import _imagingft >> (121) self.font = _imagingft.getfont(file, size, index, encoding) > > Looks like it's trying to find a font or something that isn't where > PIL expects it to be... you sure you added all the data files that > you're using? > > -bob Is there a way for me to find out what data files I'm using? Apparently the font normally gets loaded through PIL's _imagingft module, but the _imagingft module seems weird. Take a look at it below (it even mentions py2app). Any idea what this means -- how to work around it? def __load(): import imp, os, sys ext = 'PIL/_imagingft.so' for path in sys.path: if not path.endswith('lib-dynload'): continue ext = os.path.join(path, ext) if os.path.exists(ext): #print "py2app extension module", __name__, "->", ext mod = imp.load_dynamic(__name__, ext) #mod.frozen = 1 break else: raise ImportError, repr(ext) + " not found" else: raise ImportError, "lib-dynload not found" __load() del __load From bob at redivi.com Wed Nov 16 23:14:19 2005 From: bob at redivi.com (Bob Ippolito) Date: Wed, 16 Nov 2005 14:14:19 -0800 Subject: [Pythonmac-SIG] py2app and PIL question In-Reply-To: References: <338bcfdef8797be5362468ce29ed8497@gmail.com> <8036CDD2-970F-4A66-9F4E-0EE6C8209E8A@redivi.com> <33beb2b9969b93dc96523677704cbe7d@gmail.com> <9EFB4C11-F253-48EB-BD45-34F497982A54@redivi.com> Message-ID: <1B9A2D89-ACEB-4F13-8620-F3EE1E7F3D56@redivi.com> On Nov 16, 2005, at 2:03 PM, Chris Jerdonek wrote: > On Nov 16, 2005, at 1:38 PM, Bob Ippolito wrote: > >>> File "PIL/ImageFont.pyc", line 121, in __init__ >>> IOError: cannot open resource >>> >>> # Wrapper for FreeType fonts. Application code should use the >>> # truetype factory function to create font objects. >>> >>> class FreeTypeFont: >>> "FreeType font wrapper (requires _imagingft service)" >>> >>> def __init__(self, file, size, index=0, encoding=""): >>> # FIXME: use service provider instead >>> import _imagingft >>> (121) self.font = _imagingft.getfont(file, size, index, encoding) >> >> Looks like it's trying to find a font or something that isn't >> where PIL expects it to be... you sure you added all the data >> files that you're using? > > > Is there a way for me to find out what data files I'm using? > Apparently the font normally gets loaded through PIL's _imagingft > module, but the _imagingft module seems weird. Take a look at it > below (it even mentions py2app). Any idea what this means -- how > to work around it? no, there isn't really a way to find out what data files you're using other than to look hard at the source code.. unless you ktrace the process and look at all the NAMI or something. The code you're looking at isn't _imagingft, it's a stub to load it. _imagingft is an extension, written in C. -bob From jerdonek at gmail.com Thu Nov 17 01:50:58 2005 From: jerdonek at gmail.com (Chris Jerdonek) Date: Wed, 16 Nov 2005 16:50:58 -0800 Subject: [Pythonmac-SIG] py2app and PIL question In-Reply-To: <1B9A2D89-ACEB-4F13-8620-F3EE1E7F3D56@redivi.com> References: <338bcfdef8797be5362468ce29ed8497@gmail.com> <8036CDD2-970F-4A66-9F4E-0EE6C8209E8A@redivi.com> <33beb2b9969b93dc96523677704cbe7d@gmail.com> <9EFB4C11-F253-48EB-BD45-34F497982A54@redivi.com> <1B9A2D89-ACEB-4F13-8620-F3EE1E7F3D56@redivi.com> Message-ID: <3c2f9d6ef423ff2445bfde7e82c67bdc@gmail.com> On Nov 16, 2005, at 2:14 PM, Bob Ippolito wrote: >>>> class FreeTypeFont: >>>> "FreeType font wrapper (requires _imagingft service)" >>>> >>>> def __init__(self, file, size, index=0, encoding=""): >>>> # FIXME: use service provider instead >>>> import _imagingft >>>> (121) self.font = _imagingft.getfont(file, size, index, encoding) >>> >>> Looks like it's trying to find a font or something that isn't where >>> PIL expects it to be... you sure you added all the data files that >>> you're using? >> >> >> Is there a way for me to find out what data files I'm using? >> Apparently the font normally gets loaded through PIL's _imagingft >> module, but the _imagingft module seems weird. Take a look at it >> below (it even mentions py2app). Any idea what this means -- how to >> work around it? > > no, there isn't really a way to find out what data files you're using > other than to look hard at the source code.. unless you ktrace the > process and look at all the NAMI or something. > > The code you're looking at isn't _imagingft, it's a stub to load it. > _imagingft is an extension, written in C. Is there a way I could modify the code to write these font objects to a file? (The same font is needed every time the program is run.) Then, before running py2app, I could change the code to load these font objects directly -- instead of going through the usual _imagingft binary extension module. Also, is my understanding correct that py2app can't detect these dependencies because they appear in a binary extension as opposed to a python module? Chris From bob at redivi.com Thu Nov 17 01:57:25 2005 From: bob at redivi.com (Bob Ippolito) Date: Wed, 16 Nov 2005 16:57:25 -0800 Subject: [Pythonmac-SIG] py2app and PIL question In-Reply-To: <3c2f9d6ef423ff2445bfde7e82c67bdc@gmail.com> References: <338bcfdef8797be5362468ce29ed8497@gmail.com> <8036CDD2-970F-4A66-9F4E-0EE6C8209E8A@redivi.com> <33beb2b9969b93dc96523677704cbe7d@gmail.com> <9EFB4C11-F253-48EB-BD45-34F497982A54@redivi.com> <1B9A2D89-ACEB-4F13-8620-F3EE1E7F3D56@redivi.com> <3c2f9d6ef423ff2445bfde7e82c67bdc@gmail.com> Message-ID: On Nov 16, 2005, at 4:50 PM, Chris Jerdonek wrote: > On Nov 16, 2005, at 2:14 PM, Bob Ippolito wrote: > >>>>> class FreeTypeFont: >>>>> "FreeType font wrapper (requires _imagingft service)" >>>>> >>>>> def __init__(self, file, size, index=0, encoding=""): >>>>> # FIXME: use service provider instead >>>>> import _imagingft >>>>> (121) self.font = _imagingft.getfont(file, size, index, >>>>> encoding) >>>> >>>> Looks like it's trying to find a font or something that isn't where >>>> PIL expects it to be... you sure you added all the data files that >>>> you're using? >>> >>> >>> Is there a way for me to find out what data files I'm using? >>> Apparently the font normally gets loaded through PIL's _imagingft >>> module, but the _imagingft module seems weird. Take a look at it >>> below (it even mentions py2app). Any idea what this means -- how to >>> work around it? >> >> no, there isn't really a way to find out what data files you're using >> other than to look hard at the source code.. unless you ktrace the >> process and look at all the NAMI or something. >> >> The code you're looking at isn't _imagingft, it's a stub to load it. >> _imagingft is an extension, written in C. > > Is there a way I could modify the code to write these font objects > to a > file? (The same font is needed every time the program is run.) Then, > before running py2app, I could change the code to load these font > objects directly -- instead of going through the usual _imagingft > binary extension module. > > Also, is my understanding correct that py2app can't detect these > dependencies because they appear in a binary extension as opposed to a > python module? py2app can't detect data dependencies, period. You need to figure out what data files you need, and explicitly specify them. The referenced code sure looks like it was looking for a data file, and I don't recall PIL having any data files in its distribution. As far as I can tell, this font is your data file and you need to specify it in your setup.py... nothing I could do to py2app would be able to find it for you automatically. -bob From jerdonek at gmail.com Thu Nov 17 04:56:39 2005 From: jerdonek at gmail.com (Chris Jerdonek) Date: Wed, 16 Nov 2005 19:56:39 -0800 Subject: [Pythonmac-SIG] py2app and PIL question In-Reply-To: References: <338bcfdef8797be5362468ce29ed8497@gmail.com> <8036CDD2-970F-4A66-9F4E-0EE6C8209E8A@redivi.com> <33beb2b9969b93dc96523677704cbe7d@gmail.com> <9EFB4C11-F253-48EB-BD45-34F497982A54@redivi.com> <1B9A2D89-ACEB-4F13-8620-F3EE1E7F3D56@redivi.com> <3c2f9d6ef423ff2445bfde7e82c67bdc@gmail.com> Message-ID: <38d2852ac85554abc86cf111bfafa12a@gmail.com> On Nov 16, 2005, at 4:57 PM, Bob Ippolito wrote: > py2app can't detect data dependencies, period. You need to figure out > what data files you need, and explicitly specify them. The referenced > code sure looks like it was looking for a data file, and I don't > recall PIL having any data files in its distribution. As far as I can > tell, this font is your data file and you need to specify it in your > setup.py... nothing I could do to py2app would be able to find it for > you automatically. Bob, thanks a lot for your help. You're right. There was a data file I was missing -- in this case "Vera.tff". Thanks so much for your help! Chris From dreedmac at columbus.rr.com Thu Nov 17 16:56:12 2005 From: dreedmac at columbus.rr.com (David Reed) Date: Thu, 17 Nov 2005 10:56:12 -0500 Subject: [Pythonmac-SIG] xcode/pyobjc Message-ID: <6E202702-5707-45A2-8B48-716C3FCD2C22@columbus.rr.com> I'm getting ready to attempt my first real Cocoa app. I notice XCode has an option for creating pyobjc apps (when it asks you what type of app you want to create). I tried this but am not certain I'm using it correctly - build and go is not active. I did go into the directory and type "python setup.py py2app" and .app in the build directory seemed to open ok. Is the preferred way to create the Cocoa pyobjc app directly using XCode (if so, any ideas on why build and go isn't active for me) or is the best way to follow the tutorial example where you just create a normal Cocoa Objective-C app, design the interface, and then run nibclassbuilder and create the setup.py file by hand? Thanks, Dave From Chris.Barker at noaa.gov Thu Nov 17 19:02:35 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Thu, 17 Nov 2005 10:02:35 -0800 Subject: [Pythonmac-SIG] py2app and PIL question In-Reply-To: <3c2f9d6ef423ff2445bfde7e82c67bdc@gmail.com> References: <338bcfdef8797be5362468ce29ed8497@gmail.com> <8036CDD2-970F-4A66-9F4E-0EE6C8209E8A@redivi.com> <33beb2b9969b93dc96523677704cbe7d@gmail.com> <9EFB4C11-F253-48EB-BD45-34F497982A54@redivi.com> <1B9A2D89-ACEB-4F13-8620-F3EE1E7F3D56@redivi.com> <3c2f9d6ef423ff2445bfde7e82c67bdc@gmail.com> Message-ID: <437CC5BB.3040906@noaa.gov> Chris, You might want to send a bug report to the PIL folks, it would have been really helpful for you to get a message like: "can't find file: vera.ttf", rather than the generic "Resource not found" error, or whatever you got. -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 Chris.Barker at noaa.gov From charles.hartman at conncoll.edu Thu Nov 17 19:34:42 2005 From: charles.hartman at conncoll.edu (Charles Hartman) Date: Thu, 17 Nov 2005 13:34:42 -0500 Subject: [Pythonmac-SIG] elementary puzzle Message-ID: --and off-topic too: I never work in Windows except to build distros, which I haven't done for a while. I have an app that works find in OSX and that works fine from inside the WingIDE, but when I use setup.py py2exe to build it and InnoSetup to make an installer, and then try to run the result, I get this: Traceback (most recent call last): File "c:\python24\lib\site-packages\py2exe\boot_common.py", line 69, in ? import linecache zipimport.ZipImportError: can't find module 'linecache' Traceback (most recent call last): File "pyprose.py", line 6, in ? File "os.pyc", line 62, in ? zipimport.ZipImportError: can't find module 'ntpath' Both linecache and ntpath are available in the Build directory parallel to the Dist one. What really, really simple step am I forgetting about?? Charles Hartman -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051117/4329ee61/attachment.htm From charles.hartman at conncoll.edu Thu Nov 17 20:48:24 2005 From: charles.hartman at conncoll.edu (Charles Hartman) Date: Thu, 17 Nov 2005 14:48:24 -0500 Subject: [Pythonmac-SIG] elementary puzzle In-Reply-To: References: Message-ID: One step more mysterious (?): Those modules are in library.zip, and in the installation library.zip is getting copied correctly into the app's directory, under Program Files, as InnoSetup specifies. This all worked with the last app for which (a few months ago) I built a Windows dist. On Nov 17, 2005, at 1:34 PM, Charles Hartman wrote: > --and off-topic too: > > I never work in Windows except to build distros, which I haven't > done for a while. I have an app that works find in OSX and that > works fine from inside the WingIDE, but when I use setup.py py2exe > to build it and InnoSetup to make an installer, and then try to run > the result, I get this: > > Traceback (most recent call last): > File "c:\python24\lib\site-packages\py2exe\boot_common.py", line > 69, in ? > import linecache > zipimport.ZipImportError: can't find module 'linecache' > Traceback (most recent call last): > File "pyprose.py", line 6, in ? > File "os.pyc", line 62, in ? > zipimport.ZipImportError: can't find module 'ntpath' > > Both linecache and ntpath are available in the Build directory > parallel to the Dist one. What really, really simple step am I > forgetting about?? > > Charles Hartman > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051117/9c48ecbe/attachment.html From mbagai at arslegal.com Fri Nov 18 19:44:19 2005 From: mbagai at arslegal.com (Morten Bagai) Date: Fri, 18 Nov 2005 10:44:19 -0800 Subject: [Pythonmac-SIG] Los Angeles Python Users' Group, anyone? Message-ID: Posted this to comp.lang.python as well, but since I use Python on OS X myself, I thought I'd give it a go here as well... Hi, I was rifling through python.org to see if there was an existing Python user's group for the Los Angeles area. Doesn't seem like it, so maybe we should start one? I'm interested in helping with the coordination of activities etc. Since everybody living in greater L.A. area is likely to have superhuman tolerance for traffic and commuting times, I see no reason why an L.A users' group couldn't cover the whole LA/Valley/Burbank/Glendale/Pasadena/Long Beach/etc sprawl. Anyone interested, please email me at: m AT bagai DOT com Thanks! /Morten -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 186 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20051118/c5fe184d/PGP.pgp From telliott at hsc.wvu.edu Sat Nov 19 22:55:12 2005 From: telliott at hsc.wvu.edu (Tom Elliott) Date: Sat, 19 Nov 2005 16:55:12 -0500 Subject: [Pythonmac-SIG] (no subject) Message-ID: I have a working project using Apple's python 2.3 and the PyObjC bridge. I would like to build a standalone application for my co- workers. As I understand it, this requires using a different python. So I installed python 2.4.1 using Bob Ippolito's installer. Since the PyObjC installer is set up for Apple's python, I built from source, following what I guess are old instructions I used: python setup.py bdist_mpkg --open not.. /usr/local/bin/python setup.py install (sym link to python2.4 sym link to binary) I went back and did the latter, don't know if that screws things up. I thought py2app was supposed to be there but it wasn't, python 2.4 can't import py2app. I finally got py2app as an installer from pythonmac.org/packages (for py2.4). Now I get this error trying to build my program: TE-G4-PB:~/PyGeneFinder.EC telliott$ sudo /usr/local/bin/python setup.py install Password: running install running build running install_data error: mkpath: 'name' must be a string (got u'/Library/Frameworks/ Python.framework/Versions/2.4/English.lproj') What am I doing wrong? Thanks. Tom Elliott From bob at redivi.com Sat Nov 19 23:14:31 2005 From: bob at redivi.com (Bob Ippolito) Date: Sat, 19 Nov 2005 14:14:31 -0800 Subject: [Pythonmac-SIG] (no subject) In-Reply-To: References: Message-ID: On Nov 19, 2005, at 1:55 PM, Tom Elliott wrote: > I have a working project using Apple's python 2.3 and the PyObjC > bridge. I would like to build a standalone application for my co- > workers. As I understand it, this requires using a different > python. So I installed python 2.4.1 using Bob Ippolito's installer. > Since the PyObjC installer is set up for Apple's python, I built from > source, following what I guess are old instructions > > I used: > python setup.py bdist_mpkg --open > not.. > /usr/local/bin/python setup.py install (sym link to python2.4 sym > link to binary) > > I went back and did the latter, don't know if that screws things up. > I thought py2app was supposed to be there but it wasn't, python 2.4 > can't import py2app. The docs assume that "python" is the target python interpreter. If you had done /usr/local/bin/python setup.py bdist_mpkg --open then everything would've worked. > Now I get this error trying to build my program: > > TE-G4-PB:~/PyGeneFinder.EC telliott$ sudo /usr/local/bin/python > setup.py install > Password: > > running install > running build > running install_data > error: mkpath: 'name' must be a string (got u'/Library/Frameworks/ > Python.framework/Versions/2.4/English.lproj') > > What am I doing wrong? install is for installing Python extensions, that's not what you're doing so it's not the right command to use. /usr/local/bin/python setup.py py2app -bob From david.warde.farley at utoronto.ca Sun Nov 20 01:46:46 2005 From: david.warde.farley at utoronto.ca (David Warde-Farley) Date: Sat, 19 Nov 2005 19:46:46 -0500 Subject: [Pythonmac-SIG] PyOXIDE and Python 2.4 Message-ID: <57C0B797-74BB-4ACB-A4C3-A0C69E0ED382@utoronto.ca> I've installed PyObjC from source on Python 2.4 / 10.4, using the bdist --open method. Unfortunately PyOXIDE still doesn't want to launch, complaining of a lack of PyObjC. Is PyOXIDE using Apple's Python? Is there a way to tell it not to? Can I still develop for Python 2.4 with PyOXIDE even if it's running in Python 2.3? Thanks, - Dave From barrywark at gmail.com Sun Nov 20 08:27:24 2005 From: barrywark at gmail.com (Barry Wark) Date: Sat, 19 Nov 2005 23:27:24 -0800 Subject: [Pythonmac-SIG] Embedding MacPython in Matlab via mex file Message-ID: Hello all, I realize that this question cuts across quite a few areas. I hope folks around here can help me, but would be happy for direction to a better forum if one exists... I'm trying to embed the MacPython (Python.framework in OS X 10.4) in Matlab via a Matlab mex file (essentially a dylib that Matlab loads). The python code that I want to execute uses PyObjC. In my Xcode project for the mex file, I link only against the Python.framework. When Matlab tries to load the module that contains my code, I get the following error: Unable to load module: dlopen(/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/PyObjC/objc/_objc.so, 2): Symbol not found: __cg_TIFFWriteDirectory Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO Expected in: /Applications/MATLAB/bin/mac/libTIFF.dylib Importing my module in the python interpreter is no problem. My interpretation is that there's a conflict between the OS X frameworks and Matlab's libTIFF over who implements what. Can anyone suggest a solution? Again, I'd be happy for a pointer towards a more appropriate forum if this isn't it. Thanks! Barry From chairos at gmail.com Sun Nov 20 22:06:11 2005 From: chairos at gmail.com (Jon Rosebaugh) Date: Sun, 20 Nov 2005 15:06:11 -0600 Subject: [Pythonmac-SIG] tkinter, py2app, and the console Message-ID: When I build a .app version of my program, it runs just fine, but there's one little concern. When run, the .app version produces two windows: both the normal window it's supposed to produce, and a window labeled "Console", in which nothing ever seems to happen. How can I keep this Console window from showing up? I'm using Python2.4 and tkinter. I can provide source or the compiled .app if needed. From brian_l at mac.com Sun Nov 20 23:34:22 2005 From: brian_l at mac.com (Brian Lenihan) Date: Sun, 20 Nov 2005 14:34:22 -0800 Subject: [Pythonmac-SIG] tkinter, py2app, and the console In-Reply-To: References: Message-ID: On Nov 20, 2005, at 1:06 PM, Jon Rosebaugh wrote: > When I build a .app version of my program, it runs just fine, but > there's one little concern. When run, the .app version produces two > windows: both the normal window it's supposed to produce, and a window > labeled "Console", in which nothing ever seems to happen. How can I > keep this Console window from showing up? I'm using Python2.4 and > tkinter. I can provide source or the compiled .app if needed. I'm not sure really why this happens. I work around it using something like this in the initialization code: if hasattr(sys, 'frozen'): app.top.tk.call('console', 'hide') From chairos at gmail.com Sun Nov 20 23:47:16 2005 From: chairos at gmail.com (Jon Rosebaugh) Date: Sun, 20 Nov 2005 16:47:16 -0600 Subject: [Pythonmac-SIG] tkinter, py2app, and the console In-Reply-To: References: Message-ID: On 11/20/05, Brian Lenihan wrote: > I'm not sure really why this happens. I work around it using something > like this in the initialization code: > > if hasattr(sys, 'frozen'): > app.top.tk.call('console', 'hide') Thanks, that worked wonderfully. From bob at redivi.com Mon Nov 21 00:27:37 2005 From: bob at redivi.com (Bob Ippolito) Date: Sun, 20 Nov 2005 15:27:37 -0800 Subject: [Pythonmac-SIG] tkinter, py2app, and the console In-Reply-To: References: Message-ID: <090CE62D-9924-4B07-91E8-2D04CB73B7FD@redivi.com> On Nov 20, 2005, at 2:47 PM, Jon Rosebaugh wrote: > On 11/20/05, Brian Lenihan wrote: >> I'm not sure really why this happens. I work around it using >> something >> like this in the initialization code: >> >> if hasattr(sys, 'frozen'): >> app.top.tk.call('console', 'hide') > > Thanks, that worked wonderfully. I think this functionality lives in AquaTclTk itself in order to facilitate Wish. There's probably an environment variable or plist setting to turn it off somewhere, but you'd have to ask the Tk folks or read the source. Definitely not anywhere near Python land, either way. -bob From Andreas_Kahl at gmx.net Mon Nov 21 13:42:08 2005 From: Andreas_Kahl at gmx.net (Andreas Kahl) Date: Mon, 21 Nov 2005 13:42:08 +0100 Subject: [Pythonmac-SIG] IDLE broken: Where are the IDLE user-preferences? Message-ID: <4381C0A0.5020505@gmx.net> Hello everybody, can anyone please tell me where IDLE stores its user preferences? I have the same problem as Brad R. described a year ago, but there was no reply to that: http://mail.python.org/pipermail/pythonmac-sig/2004-December/012321.html I changed my Keybindings, too, and now I cannot launch IDLE any more. The icon bounces several times and then disappears. My Console says the following: Traceback (most recent call last): File "/Applications/MacPython-2.4/IDLE.app/Contents/Resources/__argvemulator_idle", line 4, in ? execfile(os.path.join(os.path.split(__file__)[0], "idle")) File "/Applications/MacPython-2.4/IDLE.app/Contents/Resources/idle", line 5, in ? main() File "/Applications/MacPython-2.4/IDLE.app/Contents/Resources/idlelib/PyShell.py", line 1361, in main if not flist.open_shell(): File "/Applications/MacPython-2.4/IDLE.app/Contents/Resources/idlelib/PyShell.py", line 275, in open_shell self.pyshell = PyShell(self) File "/Applications/MacPython-2.4/IDLE.app/Contents/Resources/idlelib/PyShell.py", line 793, in __init__ OutputWindow.__init__(self, flist, None, None) File "/Applications/MacPython-2.4/IDLE.app/Contents/Resources/idlelib/OutputWindow.py", line 16, in __init__ EditorWindow.__init__(self, *args) File "/Applications/MacPython-2.4/IDLE.app/Contents/Resources/idlelib/EditorWindow.py", line 108, in __init__ self.apply_bindings() File "/Applications/MacPython-2.4/IDLE.app/Contents/Resources/idlelib/EditorWindow.py", line 778, in apply_bindings text.event_add(event, *keylist) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-tk/Tkinter.py", line 1299, in event_add self.tk.call(args) _tkinter.TclError: bad event type or keysym "tab" I suppose I shouldn't have used the 'tab'-Key as a shortcut. Perhaps you should deactivate that option in IDLE to prevent users from crashing their IDLEs too. Reinstalling does not help in any way. I hope, somebody can tell me the name of the file, so I can fix this. Thanks. Andreas P.S. My System-Info: PowerBook 15'', 1,67Ghz, MacOS Tiger 10.4.3, MacPython 2.4.1 From pierre.vaudrey at gmail.com Mon Nov 21 14:10:11 2005 From: pierre.vaudrey at gmail.com (Pierre Vaudrey) Date: Mon, 21 Nov 2005 14:10:11 +0100 Subject: [Pythonmac-SIG] PythonCAD on OS X 10.4.3 Message-ID: <22E5047E-1282-4CCB-89A4-42C12BBA9B31@gmail.com> I'm trying to run PythonCAD from subversion on OS X 10.4.3 with python 2.4.1 and PyObjC 1.3.7. After installing : powerbook-g4-de-pierre-vaudrey:~/Documents/pythonCAD pierreva$ sudo python setup.py install and building : powerbook-g4-de-pierre-vaudrey:~/Documents/pythonCAD pierreva$ python buildapp.py --semi-standalone build Finding module dependencies Building 'build/PythonCad.app' Copying files Adding Python modules Warning: couldn't find the following submodules: (Note that these could be false alarms -- it's not always possible to distinguish between "from package import submodule" and "from package import name") ? AppKit.NSApplication ? AppKit.NSCancelButton ? AppKit.NSChangeDone ? AppKit.NSDocumentController ? AppKit.NSFontManager ? AppKit.NSItalicFontMask ? AppKit.NSMenu ? AppKit.NSMenuItem ? AppKit.NSOKButton ? AppKit.NSOutlineView ? AppKit.NSPanel ? AppKit.NSSavePanel ? AppKit.NSShiftKeyMask ? AppKit.NSTextView ? AppKit.NSWindowController ? ExceptionHandling.NSExceptionHandler ? ExceptionHandling.NSLogUncaughtExceptionMask ? ExceptionHandling.NSStackTraceKey ? Foundation.NSBundle ? Foundation.NSDictionary ? Foundation.NSLog ? Foundation.NSMakePoint ? Foundation.NSMakeRect ? Foundation.NSMakeSize ? Foundation.NSNotFound ? Foundation.NSNotification ? Foundation.NSNotificationCenter ? Foundation.NSNotificationNoCoalescing ? Foundation.NSNotificationQueue ? Foundation.NSObject ? Foundation.NSPostASAP ? Foundation.NSPostWhenIdle ? Foundation.NSString ? objc.setSignatureForSelector Warning: couldn't find the following modules: ? OverrideFrom23._Res ? SOCKS ? _dummy_threading ? _emx_link ? _xmlplus ? java.lang ? msvcrt ? os.path ? rourl2path Done. and running the application : Traceback (most recent call last): File "/Applications/PythonCad.app/Contents/Resources/ PythonCad.py", line 45, in ? import PythonCAD.Interface.Cocoa.ImageDocument File "/Users/pierreva/Documents/pythonCAD/build/PythonCad.app/ Contents/Resources/PythonCAD/Interface/Cocoa/ImageDocument.py", line 38, in ? File "/Users/pierreva/Documents/pythonCAD/build/PythonCad.app/ Contents/Resources/PythonCAD/Interface/Cocoa/ ImageWindowController.py", line 31, in ? File "/Users/pierreva/Documents/pythonCAD/build/PythonCad.app/ Contents/Resources/PythonCAD/Interface/Cocoa/AppController.py", line 28, in ? File "/Users/pierreva/Documents/pythonCAD/build/PythonCad.app/ Contents/Resources/PythonCAD/Interface/Cocoa/CocoaConobjs.py", line 26, in ? File "/Users/pierreva/Documents/pythonCAD/build/PythonCad.app/ Contents/Resources/PythonCAD/Interface/Cocoa/CocoaEntities.py", line 29, in ? ImportError: cannot import name ImageDocument I cannot understand what I'm doing wrong ? Thanks for your help. Pierre From jeremit0 at gmail.com Tue Nov 22 16:23:59 2005 From: jeremit0 at gmail.com (Jeremy Conlin) Date: Tue, 22 Nov 2005 10:23:59 -0500 Subject: [Pythonmac-SIG] Interactive shell Message-ID: <3db594f70511220723w2b52865bw4d05fee01dfb841c@mail.gmail.com> I just installed/upgraded python by using the package from http://undefined.org/python/MacPython-OSX-2.4.1-1.dmg. I just want the latest version of python so I can use matplotlib (among other things). However, it doesn't seem that the python I use from the terminal is version 2.4.x. What must I do so that when I type "python" on the command line of the terminal I get version 2.4.x? Thanks, Jeremy From a7e at y12.doe.gov Tue Nov 22 17:56:56 2005 From: a7e at y12.doe.gov (Abe Mathews) Date: Tue, 22 Nov 2005 11:56:56 -0500 Subject: [Pythonmac-SIG] Interactive shell In-Reply-To: <3db594f70511220723w2b52865bw4d05fee01dfb841c@mail.gmail.com> Message-ID: You need to create a link in /usr/bin to python2.4. If at the prompt you do a $ ls -lai /usr/bin/python* You should see files for python, python2.3, and python2.4. All of these are links - python2.3 and python2.4 should link back to their respective framework directories (on my machine, 2.3 is in /System, 2.4 is in /Library). What I would do next is to cd to /usr/bin and remove the old python link: $ cd /usr/bin $ sudo rm python Then create a new link to the 2.4 python: $ sudo ln -s python2.4 python Now when you type python at the prompt it should bring you to 2.4. Abe Mathews On 11/22/05 10:23 AM, "Jeremy Conlin" wrote: > I just installed/upgraded python by using the package from > > http://undefined.org/python/MacPython-OSX-2.4.1-1.dmg. > > I just want the latest version of python so I can use matplotlib > (among other things). However, it doesn't seem that the python I use > from the terminal is version 2.4.x. What must I do so that when I > type "python" on the command line of the terminal I get version 2.4.x? > Thanks, > Jeremy > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From Chris.Barker at noaa.gov Tue Nov 22 18:19:37 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Tue, 22 Nov 2005 09:19:37 -0800 Subject: [Pythonmac-SIG] Interactive shell In-Reply-To: References: Message-ID: <43835329.1020002@noaa.gov> Abe Mathews wrote: > You need to create a link in /usr/bin to python2.4. Sorry Abe, but: DON'T DO THAT There are standard ways to do things that will prevent you from messing up your system. Rule of thumb: don't mess with anything in /usr or /system. That's Apple's job. When you add things, if they are are "unixy" then you'll put them in /usr/local (that's what "local" means, more of less). So, the Python you installed probably already put python and python2.4 in /usr/local/bin. What you need to do is put /usr/local/bin on your path. There are are a lot docs on the web about how to do this, and more than one way, but I think the most common is to create a file called .profile, and put it in your home directory. Put in this line: export PATH=$PATH:/usr/local/bin If .profile already existed, then just add this line to it restart terminal, and, to see if you did it right, type: echo $PATH And you should get a colon separated list of directories in which the shell will look for executables. Now when you type: python on the command line, you'll get the old, Apple supplied python. when you type: python2.4 you'll get the new one. In addition, I like to put: #!/usr/bin/env python2.4 at the top of scripts to make sure I get the right python. If you are quite sure that you want your own stuff to take precedence of system stuff, you can change that line to: export PATH=/usr/local/bin:$PATH That will put /usr/local/bin in the front of the search path, so the shell will find the python in there before the system one. IN this case, python will get you 2.4, and to get the old one, you'll need to type: python2.3 or /usr/bin/python (by the way, this has been discussed ad nausium on this list in the past) -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 Chris.Barker at noaa.gov From a7e at y12.doe.gov Tue Nov 22 18:35:45 2005 From: a7e at y12.doe.gov (Abe Mathews) Date: Tue, 22 Nov 2005 12:35:45 -0500 Subject: [Pythonmac-SIG] Interactive shell In-Reply-To: <43835329.1020002@noaa.gov> Message-ID: On 11/22/05 12:19 PM, "Chris Barker" wrote: > Abe Mathews wrote: >> You need to create a link in /usr/bin to python2.4. > > Sorry Abe, but: > > DON'T DO THAT My apologies for error propagation, then. Abe Mathews From jeremit0 at gmail.com Tue Nov 22 19:09:04 2005 From: jeremit0 at gmail.com (Jeremy Conlin) Date: Tue, 22 Nov 2005 13:09:04 -0500 Subject: [Pythonmac-SIG] Interactive shell In-Reply-To: <43835329.1020002@noaa.gov> References: <43835329.1020002@noaa.gov> Message-ID: <3db594f70511221009h3acf1274wa41659c54952d5e0@mail.gmail.com> This is a much better solution. Sorry I didn't read the archives first. Jeremy On 11/22/05, Chris Barker wrote: > Abe Mathews wrote: > > You need to create a link in /usr/bin to python2.4. > > Sorry Abe, but: > > DON'T DO THAT > > There are standard ways to do things that will prevent you from messing > up your system. > > Rule of thumb: don't mess with anything in /usr or /system. That's > Apple's job. > > When you add things, if they are are "unixy" then you'll put them in > /usr/local (that's what "local" means, more of less). > > So, the Python you installed probably already put python and python2.4 > in /usr/local/bin. What you need to do is put /usr/local/bin on your > path. There are are a lot docs on the web about how to do this, and more > than one way, but I think the most common is to create a file called > .profile, and put it in your home directory. Put in this line: > > export PATH=$PATH:/usr/local/bin > > If .profile already existed, then just add this line to it > > restart terminal, and, to see if you did it right, type: > > echo $PATH > > And you should get a colon separated list of directories in which the > shell will look for executables. > > Now when you type: > > python > > on the command line, you'll get the old, Apple supplied python. > > when you type: > > python2.4 > > you'll get the new one. > > In addition, I like to put: > > #!/usr/bin/env python2.4 > > at the top of scripts to make sure I get the right python. > > If you are quite sure that you want your own stuff to take precedence of > system stuff, you can change that line to: > > export PATH=/usr/local/bin:$PATH > > That will put /usr/local/bin in the front of the search path, so the > shell will find the python in there before the system one. IN this case, > > python > > will get you 2.4, and to get the old one, you'll need to type: > > python2.3 > > or > > /usr/bin/python > > (by the way, this has been discussed ad nausium on this list in the past) > > -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 > > Chris.Barker at noaa.gov > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From ronaldoussoren at mac.com Tue Nov 22 19:38:22 2005 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Tue, 22 Nov 2005 19:38:22 +0100 Subject: [Pythonmac-SIG] Interactive shell In-Reply-To: References: Message-ID: <76A49E5C-5B38-483F-86DE-E2252BF851E1@mac.com> On 22-nov-2005, at 17:56, Abe Mathews wrote: > You need to create a link in /usr/bin to python2.4. > > If at the prompt you do a > $ ls -lai /usr/bin/python* > > You should see files for python, python2.3, and python2.4. Not if you installed the official installer DMG, it installs the interpreter in /usr/local/bin. > ll of these are > links - python2.3 and python2.4 should link back to their respective > framework directories (on my machine, 2.3 is in /System, 2.4 is in > /Library). > > What I would do next is to cd to /usr/bin and remove the old python > link: > $ cd /usr/bin > $ sudo rm python > > Then create a new link to the 2.4 python: > $ sudo ln -s python2.4 python Don't do this, you're replacing a system component. This might break OS functionality (Apple uses Python in the PDF workflow). You should add /usr/local/bin to the front of your PATH instead. > > Now when you type python at the prompt it should bring you to 2.4. > > Abe Mathews > > > On 11/22/05 10:23 AM, "Jeremy Conlin" wrote: > >> I just installed/upgraded python by using the package from >> >> http://undefined.org/python/MacPython-OSX-2.4.1-1.dmg. >> >> I just want the latest version of python so I can use matplotlib >> (among other things). However, it doesn't seem that the python I use >> from the terminal is version 2.4.x. What must I do so that when I >> type "python" on the command line of the terminal I get version >> 2.4.x? >> Thanks, >> Jeremy >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG at python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From Henning.Ramm at mediapro-gmbh.de Wed Nov 23 09:48:16 2005 From: Henning.Ramm at mediapro-gmbh.de (Henning.Ramm@mediapro-gmbh.de) Date: Wed, 23 Nov 2005 09:48:16 +0100 Subject: [Pythonmac-SIG] Interactive shell Message-ID: >than one way, but I think the most common is to create a file called >.profile, and put it in your home directory. Put in this line: > >export PATH=$PATH:/usr/local/bin I'd use '.bashrc' or '.bash_profile', because 'export' is bash syntax -- '.profile' should be read by any shell, and tcsh (e.g. default in OSX 10.2) doesn't understand that. BTW this file lives in you home folder (~ = /Users/yourname). If you don't know how to edit 'invisible' files (file name starting with a dot): You can see them with 'ls -al' and rename them with 'mv .dotname othername' (then open with TextEdit and rename again afterwards). If you want to check which python you're using, try 'which python'. Best regards, Henning Hraban Ramm S?dkurier Medienhaus / MediaPro Support/Admin/Development Dept. From brian_l at mac.com Wed Nov 23 10:45:12 2005 From: brian_l at mac.com (Brian Lenihan) Date: Wed, 23 Nov 2005 01:45:12 -0800 Subject: [Pythonmac-SIG] tkinter, py2app, and the console In-Reply-To: <090CE62D-9924-4B07-91E8-2D04CB73B7FD@redivi.com> References: <090CE62D-9924-4B07-91E8-2D04CB73B7FD@redivi.com> Message-ID: <3E9E1FA3-9FF3-4441-9F34-4BAAFF7784B4@mac.com> On Nov 20, 2005, at 3:27 PM, Bob Ippolito wrote: > > On Nov 20, 2005, at 2:47 PM, Jon Rosebaugh wrote: > >> On 11/20/05, Brian Lenihan wrote: >>> I'm not sure really why this happens. I work around it using >>> something >>> like this in the initialization code: >>> >>> if hasattr(sys, 'frozen'): >>> app.top.tk.call('console', 'hide') >> >> Thanks, that worked wonderfully. > > I think this functionality lives in AquaTclTk itself in order to > facilitate Wish. There's probably an environment variable or plist > setting to turn it off somewhere, but you'd have to ask the Tk > folks or read the source. Definitely not anywhere near Python > land, either way. On Nov 20, 2005, at 3:27 PM, Bob Ippolito wrote: > > On Nov 20, 2005, at 2:47 PM, Jon Rosebaugh wrote: > >> On 11/20/05, Brian Lenihan wrote: >>> I'm not sure really why this happens. I work around it using >>> something >>> like this in the initialization code: >>> >>> if hasattr(sys, 'frozen'): >>> app.top.tk.call('console', 'hide') >> >> Thanks, that worked wonderfully. > > I think this functionality lives in AquaTclTk itself in order to > facilitate Wish. There's probably an environment variable or plist > setting to turn it off somewhere, but you'd have to ask the Tk > folks or read the source. Definitely not anywhere near Python > land, either way. On Nov 20, 2005, at 3:27 PM, Bob Ippolito wrote: On Nov 20, 2005, at 2:47 PM, Jon Rosebaugh wrote: On 11/20/05, Brian Lenihan wrote: I'm not sure really why this happens. I work around it using something like this in the initialization code: if hasattr(sys, 'frozen'): app.top.tk.call('console', 'hide') Thanks, that worked wonderfully. I think this functionality lives in AquaTclTk itself in order to facilitate Wish. There's probably an environment variable or plist setting to turn it off somewhere, but you'd have to ask the Tk folks or read the source. Definitely not anywhere near Python land, either way. Well, the easiest way(tm) to sidestep the problem actually does live in Python land. Consider the following tk code fragments found in tkMacOSXInit.c: * If we don't have a TTY and stdin is a special character file of length 0, * (e.g. /dev/null, which is what Finder sets when double clicking Wish) * then use the Tk based console interpreter. .... /* Only show the console if we don't have a startup script */ if (Tcl_GetStartupScript(NULL) == NULL) { Tcl_SetVar(interp, "tcl_interactive", "1", TCL_GLOBAL_ONLY); Ouch. Even if a non-python solution was found in an environment variable or a plist, I still dislike editing plists or setting environment variables when the changes I need are local, but the scope of the changes is global, unless I have no other obvious choices. How much of my life am I willing to waste looking for the "correct" solution, when a working solution has made itself obvious? (The obvious answer is that it depends on who is asking). The normal result is that I will most likely forget the global changes I made and then have to wonder why something completely unrelated to my changes fails to work as expected. A not-very-pythonic-result. From davbrow at gmail.com Wed Nov 23 11:27:13 2005 From: davbrow at gmail.com (Dave) Date: Wed, 23 Nov 2005 02:27:13 -0800 Subject: [Pythonmac-SIG] readline support in ActivePython 2.4.2? Message-ID: <588f52020511230227q643c0561s7ceaf7634cf728e8@mail.gmail.com> I installed the ActivePython 2.4.2 binary on a clean 10.4 system. I also installed ipython 0.6.15. ipython complains there is no readline support. I did find a readline.so file in /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-dynload/ and ipython seems to be using the 2.4.2 python version. How can I get readline to work, especially in ipython? Is there an obvious fix or should I perhaps uninstall the ActivePython version and use the 2.4.1 installer and related patches at http://undefined.org/python/ -- David From Chris.Barker at noaa.gov Wed Nov 23 17:37:00 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Wed, 23 Nov 2005 08:37:00 -0800 Subject: [Pythonmac-SIG] Interactive shell In-Reply-To: References: Message-ID: <43849AAC.30806@noaa.gov> I've never been able to figure out when to use .profile vs .bashrc, but I thought it had to do with only one of them being run when a subshell was started, or something like that. I do note that on both my OS-X and Linux boxes, /etc/profile sources bashrc, and uses bash syntax, so it sure looks like a bash-specific config file to me. -Chris Henning.Ramm at mediapro-gmbh.de wrote: > I'd use '.bashrc' or '.bash_profile', because 'export' is bash syntax -- '.profile' should be read by any shell, and tcsh (e.g. default in OSX 10.2) doesn't understand that. > BTW this file lives in you home folder (~ = /Users/yourname). -- 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 Chris.Barker at noaa.gov From altern2 at gmail.com Wed Nov 23 17:18:36 2005 From: altern2 at gmail.com (altern) Date: Wed, 23 Nov 2005 17:18:36 +0100 Subject: [Pythonmac-SIG] pyserial Message-ID: <4384965C.3000208@gmail.com> hi i am trying to use pyserial to program some hardware via serial. It compiled easily without errors. But the scan.py doesnt actually recognise any serial devices. However I tried using Processing (java) and it detects several devices like mouse, modem, etc ... i was wondering if anyone has tried to use this library on OSX, i am not sure that it actually supports it. thanks -- enrike From telliott at hsc.wvu.edu Wed Nov 23 19:31:07 2005 From: telliott at hsc.wvu.edu (Tom Elliott) Date: Wed, 23 Nov 2005 13:31:07 -0500 Subject: [Pythonmac-SIG] newbie: PIL fonts Message-ID: <063EF018-9947-4A8C-84A5-CC9E3126F89D@hsc.wvu.edu> Can someone point me to instructions for getting fonts to use with PIL? ( http://pythonmac.org/packages/PIL-1.1.5-py2.4-macosx10.3.zip from http://pythonmac.org/packages/ ) Thanks. Tom Elliott From mjb at uma.pt Thu Nov 24 15:17:23 2005 From: mjb at uma.pt (Michael J. Barber) Date: Thu, 24 Nov 2005 14:17:23 +0000 Subject: [Pythonmac-SIG] Interactive shell In-Reply-To: <43849AAC.30806@noaa.gov> References: <43849AAC.30806@noaa.gov> Message-ID: <6e5e7b8a8cb0976d34e86fe09bd8baee@uma.pt> On Nov 23, 2005, at 4:37 PM, Chris Barker wrote: > I've never been able to figure out when to use .profile vs .bashrc, but > I thought it had to do with only one of them being run when a subshell > was started, or something like that. > That's basically it. For a login shell, .profile is run; you can use .bash_profile or .bash_login instead, if you prefer. For an interactive nonlogin shell, .bashrc is run. So, .bashrc will be run for a subshell. > I do note that on both my OS-X and Linux boxes, /etc/profile sources > bashrc, and uses bash syntax, so it sure looks like a bash-specific > config file to me. > At least on 10.3.9 (which I'm using at the moment), the contents of /etc/bashrc and /etc/profile work fine in sh as well as bash. For sh (and ksh), /etc/profile and .profile should both be run, so you can think of .bash_profile as a way to get distinct profiles for bash and sh (or ksh). It could well make sense to source .profile inside .bash_profile. None of that should conflict with csh, tcsh, or zsh, as I understand it. To address the original point of where to set the path, I would put export PATH=/usr/local/bin:$PATH in one of .profile, .bash_profile, or .bashrc, depending on exactly what you want. Focusing on bash only, a reasonable approach would be to put the path and other things for all interactive shells in .bashrc and add source .bashrc to .bash_profile. If you also use sh or ksh interactively, some further thought might be in order. For tcsh, I'd put set path = ( /usr/local/bin $path) in .cshrc or .tcshrc. Zsh users already know what they're doing, I'm sure. Michael From rogerb at rogerbinns.com Fri Nov 25 05:48:43 2005 From: rogerb at rogerbinns.com (Roger Binns) Date: Thu, 24 Nov 2005 20:48:43 -0800 Subject: [Pythonmac-SIG] pyserial References: <4384965C.3000208@gmail.com> Message-ID: <000c01c5f17b$83891e00$3501a8c0@rogersqyvr14d3> > i was wondering if anyone has tried to use this library on OSX, i am not > sure that it actually supports it. pyserial works fine on Mac. I've been using it for years in BitPim. Roger From abridge at mac.com Fri Nov 25 07:49:06 2005 From: abridge at mac.com (Adam Bridge) Date: Thu, 24 Nov 2005 22:49:06 -0800 Subject: [Pythonmac-SIG] pyserial In-Reply-To: <000c01c5f17b$83891e00$3501a8c0@rogersqyvr14d3> Message-ID: On Thursday, November 24, 2005 Roger Binns thoughtfully wrote: >> i was wondering if anyone has tried to use this library on OSX, i am not >> sure that it actually supports it. > >pyserial works fine on Mac. I've been using it for years in BitPim. > >Roger Is this helpful for a USB to Serial converter? I need to talk to a weather station and I'm looking for some information about how to open an i/o stream across the kensington usb/serial converter. Thanks for any pointers. Adam Bridge From abridge at mac.com Fri Nov 25 08:20:55 2005 From: abridge at mac.com (Adam Bridge) Date: Thu, 24 Nov 2005 23:20:55 -0800 Subject: [Pythonmac-SIG] pyserial In-Reply-To: Message-ID: On Thursday, November 24, 2005 Adam Bridge thoughtfully wrote: >On Thursday, November 24, 2005 Roger Binns thoughtfully wrote: > >>> i was wondering if anyone has tried to use this library on OSX, i am not >>> sure that it actually supports it. >> >>pyserial works fine on Mac. I've been using it for years in BitPim. >> >>Roger > >Is this helpful for a USB to Serial converter? I need to talk to a weather >station and I'm looking for some information about how to open an i/o stream >across the kensington usb/serial converter. > >Thanks for any pointers. > That's keyspan not kensington. Too much turkey.... ab From rogerb at rogerbinns.com Fri Nov 25 08:54:13 2005 From: rogerb at rogerbinns.com (Roger Binns) Date: Thu, 24 Nov 2005 23:54:13 -0800 Subject: [Pythonmac-SIG] pyserial References: Message-ID: <003201c5f195$6d1f5c00$3501a8c0@rogersqyvr14d3> > Is this helpful for a USB to Serial converter? Yes. That is actually what many cell phone cables are. > I need to talk to a weather > station and I'm looking for some information about how to open an i/o stream > across the kensington usb/serial converter. There is no standard for talking to a USB to serial converter which means each implements their own 'protocol'. Consequently you have to have a device driver for the converter. It should then show up as /dev/cua.XXX where XXX varies. (By contrast there are standards for USB modems, keyboards, mice etc which is why you don't have to have a driver for them.) If you cannot find a device driver then I recommend returning the device and getting one based on the Prolific PL2303. This chip is very popular and used in most converters. There are Mac drivers at www.prolific.com.tw. You won't be able to tell by examination which chip is used, but can once it is plugged in. The system profiler lists the vendor and product ids for each USB device. Look for vendor Prolific and product $2303. The last Aten and IOGear USB to serial cables I bought had the Prolific chip. Roger From p.oberndoerfer at urheberrecht.org Fri Nov 25 23:48:44 2005 From: p.oberndoerfer at urheberrecht.org (Pascal Oberndoerfer) Date: Fri, 25 Nov 2005 23:48:44 +0100 Subject: [Pythonmac-SIG] pyserial In-Reply-To: <4385AD30.4020608@gmail.com> Message-ID: altern at altern2 at gmail.com: > Pascal Obernd?rfer(e)k dio: >>> hi >>> >>> i am trying to use pyserial to program some hardware via serial. It >>> compiled easily without errors. But the scan.py doesnt actually >>> recognise any serial devices. However I tried using Processing (java) >>> and it detects several devices like mouse, modem, etc ... >>> i was wondering if anyone has tried to use this library on OSX, i am not >>> sure that it actually supports it. >>> >>> thanks >>> >>> -- >>> enrike >> >> >> >> Enrike, >> >> the last time I used it only one problem occurred: I could not use tty[n] >> to address a serial port. Instead I had to use the 'name' of the serial >> port. >> >> See: >> >> - >> - >> >> for some hints and explanation. The link given in the postings above is >> unfortunately broken. If you would like to try 'osxserialports' mail me >> directly. >> >> Pascal > > > sorry i should have checked the list archives of course. I googled > without luck so assumed nobody had the problem before or it was > somerthing to do with my python instalation. > > it would be nice to be able to use the osxserialports, do you have the > extension source code? It would be nice to have it online available for > people to download. > > thanks! The current URL is: HTH. Pascal -- Dr. Pascal Obernd?rfer Institut f?r Urheber- und Medienrecht Rechtsanwalt Salvatorplatz 1 Leiter Referat Urheberrecht D - 80333 M?nchen Tel. +49 89 291954-70 mailto:pob at urheberrecht.org Fax: +49 89 291954-80 http://www.urheberrecht.org From andrea_gavana at tin.it Sat Nov 26 15:14:02 2005 From: andrea_gavana at tin.it (Andrea Gavana) Date: Sat, 26 Nov 2005 15:14:02 +0100 Subject: [Pythonmac-SIG] New Widget Problem On Mac (wxPython) Message-ID: <005f01c5f293$a74ec9c0$1ea00057@Gavana> Hello NG, first of all, I am not a Mac user. I have built a widget called NotebookCtrl, that somewhat enhances the capabilities of wx.Notebook with a lot of more options regarding tabs "appearance". I think that most of you know Stani, the SPE editor author; well, he decided to try to replace in SPE interface the instances of wx.Notebook with NotebookCtrl. After some testing, I am sure that NotebookCtrl works on Windows 2000/XP, Linux and Unix port of wxPython. However, it does not work on Mac (the tabs are not shown at all). Apparently, there is no reason why it should not work on Mac, but that is. Noting that I don't know a word about Mac, is there anyone that could try to help me in making it working also on Mac? It is a free tool, under wxWidgets/wxPython license, and I think that all the community could get advantage if this widget run on all platforms where wxPython is supported. If anyone wants to help me, you can find the source code and some screenshot here: http://xoomer.virgilio.it/infinity77/eng/freeware.html#notebookctrl Or, if you prefer in italian ;-) : http://xoomer.virgilio.it/infinity77/ita/freeware.html#notebookctrl You could judge by yourself if it is worth the effort ;-) As a first suggestion, if anyone is interested, the problematic part should be the TabCtrl class: either the OnPaint() event is not properly handled on Mac, or some initialization default parameter are not correctly recognized by Mac (such as wx.DefaultSize or similar). Thanks a lot for every hint/pointer/suggestion/support. Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.virgilio.it/infinity77 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051126/d18d3c08/attachment.html From markhill72 at yahoo.com Mon Nov 28 11:08:55 2005 From: markhill72 at yahoo.com (mark hill) Date: Mon, 28 Nov 2005 02:08:55 -0800 (PST) Subject: [Pythonmac-SIG] Preferred IDE Message-ID: <20051128100855.31741.qmail@web50201.mail.yahoo.com> I would appreciate any recommendations as to which IDE to use on OS X. I understand that the MacPythonIDE has ceased development, and was advised to ask which IDE people are now using. I'm after something fairly lite. A module browser, basic file management etc. are all that are required, plus any other must have features that I don't know about, as I'm just getting into Python. Many thanks, Mark Hill. __________________________________ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ From Henning.Ramm at mediapro-gmbh.de Mon Nov 28 11:51:02 2005 From: Henning.Ramm at mediapro-gmbh.de (Henning.Ramm@mediapro-gmbh.de) Date: Mon, 28 Nov 2005 11:51:02 +0100 Subject: [Pythonmac-SIG] Preferred IDE Message-ID: >I would appreciate any recommendations as to which IDE >to use on OS X. I understand that the MacPythonIDE has >ceased development, and was advised to ask which IDE >people are now using. > >I'm after something fairly lite. A module browser, >basic file management etc. are all that are required, >plus any other must have features that I don't know >about, as I'm just getting into Python. You've a choice, and the *just right* Editor/IDE is something different for anyone: As we just sponsored him a Mac, Stani is working on SPE's Mac abilities, so SPE is probably your best choice: http://pythonide.stani.be/ (No real Mac app yet, but works; see Mac instructions) SPE includes some other helpful tools (wxGlade and XRC GUI designer, Kiki regex checker, Debugger) There's also DrPython (nice lightweight and extendable, but in some undefined state, esp. the important plugins): http://drpython.sourceforge.net/ (No real Mac app) A real Mac app (but I don't really like it) is PyOXIDE: http://www.gandreas.com/products_developer.html I never tried ActiveGrid IDE: http://sourceforge.net/projects/activegrid/ (Mac binary only for full "Application Builder") Eric (I don't like it, but others do...): http://www.die-offenbachs.de/detlev/eric3.html Commercial IDE Komodo by ActiveState (based on Mozilla XUL): http://www.activestate.com/Products/Komodo/ Also commercial, but loved by some is Wing: http://wingware.com/ It should be possible to use Xcode also for Python, but I never tried it. There are also some general Editors out there (not written in Python) that support Python (and a lot more): - TextWrangler (little brother of BBEdit) http://www.barebones.com/products/textwrangler/index.shtml - jEdit http://www.jedit.org/ Indefinite overkill: Eclipse IDE (originally for Java, but with PyDev plugin for Python): http://www.eclipse.org http://www.pydev.sourceforge.net (I found Eclipse to big & slow on my Mac.) HTH Greetlings, HR From jforcier at strozllc.com Mon Nov 28 17:02:05 2005 From: jforcier at strozllc.com (Jeffrey E. Forcier) Date: Mon, 28 Nov 2005 11:02:05 -0500 Subject: [Pythonmac-SIG] Preferred IDE In-Reply-To: References: Message-ID: On Nov 28, 2005, at 5:51 AM, wrote: > [stuff about Mac Python IDEs] I and a fair number of other Mac-using Pythonistas use an excellent, but non-free editor called TextMate (http://www.macromates.com). It handles Python quite well and has a lot of nifty features, although I personally just use it as your standard text editor w/ syntax highlighting and auto-indent. Overall it's well worth the price. XCode also works fairly well, but it does not do proper Python auto- indenting although it does do the syntax highlighting. It will preserve indents but will not give you an extra indent after if statements and so forth. I only use it when I'm doing PyObjC/Cocoa programming. Regards, Jeff -- Jeffrey E. Forcier Junior Developer, Research and Development Stroz Friedberg, LLC 15 Maiden Lane, 12th Floor New York, NY 10038 [main]212-981-6540 [direct]212-981-6546 http://www.strozllc.com This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No right to confidential or privileged treatment of this message is waived or lost by any error in transmission. If you have received this message in error, please immediately notify the sender by e-mail or by telephone at 212.981.6540, delete the message and all copies from your system and destroy any hard copies. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. From chairos at gmail.com Mon Nov 28 17:27:32 2005 From: chairos at gmail.com (Jon Rosebaugh) Date: Mon, 28 Nov 2005 10:27:32 -0600 Subject: [Pythonmac-SIG] Preferred IDE In-Reply-To: <20051128100855.31741.qmail@web50201.mail.yahoo.com> References: <20051128100855.31741.qmail@web50201.mail.yahoo.com> Message-ID: On 11/28/05, mark hill wrote: > > I would appreciate any recommendations as to which IDE > to use on OS X. I understand that the MacPythonIDE has > ceased development, and was advised to ask which IDE > people are now using. > > I'm after something fairly lite. A module browser, > basic file management etc. are all that are required, > plus any other must have features that I don't know > about, as I'm just getting into Python. My favored IDE when I'm doing PyObjC work is XCode, for obvious reasons. But when I'm not, my favored IDE is SubEthaEdit, with a couple of python interpreters open in Terminal. Part of this is due to the fact that I don't really trust IDEs to manage things properly. I've never yet found a non brain-dead GUI tool for Subversion, for instance. From lists at mostrom.pp.se Mon Nov 28 18:17:34 2005 From: lists at mostrom.pp.se (Jan Erik =?UTF-8?Q?Mostr=C3=B6m?=) Date: Mon, 28 Nov 2005 18:17:34 +0100 Subject: [Pythonmac-SIG] Preferred IDE In-Reply-To: Message-ID: A somewhat similar question: is there a good debugger for python? Personally I prefer BBEdit as my editor but the thing I'm looking for is a debugger. I played around a little bit with Komodo but are there any other alternatives? jem -- Jan Erik Mostr?m, www.mostrom.pp.se From charles.hartman at conncoll.edu Mon Nov 28 19:04:01 2005 From: charles.hartman at conncoll.edu (Charles Hartman) Date: Mon, 28 Nov 2005 13:04:01 -0500 Subject: [Pythonmac-SIG] Preferred IDE In-Reply-To: References: Message-ID: WingIDE is a good tabbed editor, and its debugger is really first- rate. It's cross-platform. It isn't free, but it isn't exorbitant. (It *is* free for Open Source use; check out their licensing.) The *only* disadvantage, from my point of view, is that on OSX it runs under X11; but that's a fairly minor annoyance. (It's got a Mac- compatability-interface mode that works pretty well to help you ignore the X11 undergirding.) A few months ago, at least, when I was last developing with Python on Mac, it was the only full-featured IDE (including debugging) that I could find that worked consistently and well. Charles Hartman On Nov 28, 2005, at 12:17 PM, Jan Erik Mostr?m wrote: > A somewhat similar question: is there a good debugger for python? > > Personally I prefer BBEdit as my editor but the thing I'm looking > for is a > debugger. I played around a little bit with Komodo but are there > any other > alternatives? > jem > -- > Jan Erik Mostr?m, www.mostrom.pp.se > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From altern2 at gmail.com Mon Nov 28 17:41:54 2005 From: altern2 at gmail.com (altern) Date: Mon, 28 Nov 2005 17:41:54 +0100 Subject: [Pythonmac-SIG] Preferred IDE In-Reply-To: <20051128100855.31741.qmail@web50201.mail.yahoo.com> References: <20051128100855.31741.qmail@web50201.mail.yahoo.com> Message-ID: <438B3352.8060301@gmail.com> hi mark I use pyOxide and find it quite useful althougt it is not perfect Try Smultron, it is very cool text editor, i use it for java and ruby but not for python. http://smultron.sourceforge.net It is free sofware and runs pretty well. mark hill(e)k dio: > I would appreciate any recommendations as to which IDE > to use on OS X. I understand that the MacPythonIDE has > ceased development, and was advised to ask which IDE > people are now using. > > I'm after something fairly lite. A module browser, > basic file management etc. are all that are required, > plus any other must have features that I don't know > about, as I'm just getting into Python. > > Many thanks, > > Mark Hill. > > > > __________________________________ > Yahoo! Music Unlimited > Access over 1 million songs. Try it free. > http://music.yahoo.com/unlimited/ > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From markhill72 at yahoo.com Mon Nov 28 09:45:35 2005 From: markhill72 at yahoo.com (mark hill) Date: Mon, 28 Nov 2005 00:45:35 -0800 (PST) Subject: [Pythonmac-SIG] Mac Python IDE Message-ID: <20051128084535.13225.qmail@web50206.mail.yahoo.com> Hi, Does anyone have any suggestions as to the best IDE for Python on OS X. I've been informed that PythonIDE has ceased development and that the cold is pretty old. I don't want too many bells and whistles, something pretty lite, but a module browser etc., would be pretty useful. Many thanks, Mark Hill __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com From Henning.Ramm at mediapro-gmbh.de Tue Nov 29 09:15:09 2005 From: Henning.Ramm at mediapro-gmbh.de (Henning.Ramm@mediapro-gmbh.de) Date: Tue, 29 Nov 2005 09:15:09 +0100 Subject: [Pythonmac-SIG] Debugger (was: Preferred IDE) Message-ID: >A somewhat similar question: is there a good debugger for python? SPE comes with WinPdb, but I never used it. http://www.digitalpeers.com/pythondebugger/ There's also HAP (seems to be Win-only at the moment): https://sourceforge.net/projects/hapdebugger/ Best regards, Henning Hraban Ramm S?dkurier Medienhaus / MediaPro Support/Admin/Development Dept. From Henning.Ramm at mediapro-gmbh.de Tue Nov 29 09:25:20 2005 From: Henning.Ramm at mediapro-gmbh.de (Henning.Ramm@mediapro-gmbh.de) Date: Tue, 29 Nov 2005 09:25:20 +0100 Subject: [Pythonmac-SIG] Mac Python IDE Message-ID: >Does anyone have any suggestions as to the best IDE >for Python on OS X. I've been informed that PythonIDE >has ceased development and that the cold is pretty >old. Would you please read the ongoing thread "Preferred IDE". Greetlings, HR From jforcier at strozllc.com Tue Nov 29 16:49:46 2005 From: jforcier at strozllc.com (Jeffrey E. Forcier) Date: Tue, 29 Nov 2005 10:49:46 -0500 Subject: [Pythonmac-SIG] Fwd: Preferred IDE References: <0F2BBC0D-0DD4-4773-9036-A0E0196640B4@strozllc.com> Message-ID: Oops, Jerry forgot to send his original email to the list, and thus my Reply-All didn't really do anything :) Forwarding. Begin forwarded message: > From: "Jeffrey E. Forcier" > Date: November 29, 2005 10:48:32 AM EST > To: lanceboyle at bluebottle.com > Subject: Re: [Pythonmac-SIG] Preferred IDE > > I don't have it installed anymore, but I tried TextWrangler a while > ago; if memory serves it had the same lack of auto-indent that > XCode has. Certainly it was something along those lines, something > preventing me from "properly" using it for Python, which is why I'm > not using it now. I also seem to remember BBEdit not having that > issue for some reason, but it wasn't worth the price tag for that > one tweak. > > Other than whatever that issue was, though, TextWrangler/BBEdit is > an *excellent* editor, so be sure to try it out yourself (this > directed at Jerry and the OP) before dismissing it. > > Regards, > Jeff > > On Nov 28, 2005, at 10:23 PM, lanceboyle at bluebottle.com wrote: > >> Can someone compare TextMate with BBEdit and/or the free version >> of BBEdit, Text Wrangler? Either as a Python editor or otherwise? >> >> Jerry > From Henning.Ramm at mediapro-gmbh.de Tue Nov 29 16:57:39 2005 From: Henning.Ramm at mediapro-gmbh.de (Henning.Ramm@mediapro-gmbh.de) Date: Tue, 29 Nov 2005 16:57:39 +0100 Subject: [Pythonmac-SIG] Fwd: Preferred IDE Message-ID: >> Other than whatever that issue was, though, TextWrangler/BBEdit is >> an *excellent* editor, so be sure to try it out yourself (this >> directed at Jerry and the OP) before dismissing it. I love TextWrangler for its "open in another encoding" feature, but hate it for some inconveniences (blocking eternally while it seems to suck even huge files completely into memory and parse them instead doing something in smaller chunks); never really tried to use it for Python. Greetlings, HR From charles.hartman at conncoll.edu Tue Nov 29 17:54:04 2005 From: charles.hartman at conncoll.edu (Charles Hartman) Date: Tue, 29 Nov 2005 11:54:04 -0500 Subject: [Pythonmac-SIG] Mac Python IDE In-Reply-To: <20051128084535.13225.qmail@web50206.mail.yahoo.com> References: <20051128084535.13225.qmail@web50206.mail.yahoo.com> Message-ID: <72CF92C7-52D7-437A-9FA5-57D99CDFF201@conncoll.edu> This same message keeps reappearing - ? On Nov 28, 2005, at 3:45 AM, mark hill wrote: > Hi, > > Does anyone have any suggestions as to the best IDE > for Python on OS X. I've been informed that PythonIDE > has ceased development and that the cold is pretty > old. > > I don't want too many bells and whistles, something > pretty lite, but a module browser etc., would be > pretty useful. > > Many thanks, > > Mark Hill > > > > > __________________________________ > Yahoo! Mail - PC Magazine Editors' Choice 2005 > http://mail.yahoo.com > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From Chris.Barker at noaa.gov Tue Nov 29 18:15:01 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Tue, 29 Nov 2005 09:15:01 -0800 Subject: [Pythonmac-SIG] Fwd: Preferred IDE In-Reply-To: References: <0F2BBC0D-0DD4-4773-9036-A0E0196640B4@strozllc.com> Message-ID: <438C8C95.3080208@noaa.gov> Jeffrey E. Forcier wrote: >> I also seem to remember BBEdit not having that >>issue for some reason, but it wasn't worth the price tag for that >>one tweak. >> TextWrangler/BBEdit is an *excellent* editor, so be sure to try it out yourself Yes, it is, but it really doesn't do python indenting quite right. These days, all python code really should be indented with 4 spaces, and while you can set BBedit to put in 4 spaces when you hit the tab key, it doesn't recognize those four spaces as a single level of indentation when you want to delete them, requiring four hits of the backspace key. One would think that this is a minor annoyance, and perhaps it is, but being used to the excellent [X]emacs python mode, I find it very frustrating. A few years ago, there was a thread in this mailing list about his, and someone had even discussed the issue with BB's tech support. Their response was something along the lines of "you shouldn't want to do that", and they therefor will not try to support it. Granted, I'm sure Python coders are a pretty small part of their market, and indentation based languages are few and far between, but at the core was an attitude that they know better than we do what we should want, and even more of an issue, they are in total control of what will and won't be added to BBedit. One reason I don't like closed source software. However, besides being closed source, BBedit does not provide a powerful way for users to customize the editor's behavior themselves. If they did we'd have an excellent python mode by now. Side note: does anyone know how to do selection, cut and paste by columns in BBEdit? The only reason I like [X]emacs is that it has a full-featured mode for every kind of text file I've ever needed to edit, and it has all those modes because users could write them. There is no way the core development team could ever support everything, and everything well for that matter. I'm still looking for a nice modern, platform independent, general purpose, fully customizable (preferably in Python) text editor. SPE is heading that way, and Pepper (http://digitalwandering.com/) still has promise. Does anyone know how customizable jedit is .. in Jython maybe? Sorry for the rant.... -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 Chris.Barker at noaa.gov From pecora at anvil.nrl.navy.mil Tue Nov 29 18:33:39 2005 From: pecora at anvil.nrl.navy.mil (Louis Pecora) Date: Tue, 29 Nov 2005 12:33:39 -0500 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style (spaces) Message-ID: <438C90F3.2020906@anvil.nrl.navy.mil> Chris Barker asked: >Side note: does anyone know how to do selection, cut and paste by columns in BBEdit? -------------------------------- You hold down the option key while selecting, but you cannot do this in the soft wrap mode. You have to set the window to hard wrap at some column number. If you have the BBEdit manual, you can find more info around page 52 or just look in the index. -------------------------------- Now that I answered your question, you can answer mine. :-) Or others can chime in as I suspect they will (which is good). You state about the incompatibility of the Python indenting scheme and some editors (E.g BBEdit): >Yes, it is, but it really doesn't do python indenting quite right. These >days, all python code really should be indented with 4 spaces, and while >you can set BBedit to put in 4 spaces when you hit the tab key, it >doesn't recognize those four spaces as a single level of indentation >when you want to delete them, requiring four hits of the backspace key. >One would think that this is a minor annoyance, and perhaps it is, but >being used to the excellent [X]emacs python mode, I find it very >frustrating. I gotta ask (I am not a Python expert or Pythonista): What the heck were they (Guido?) thinking when they used 4 spaces as the one true mode of indentation for Python? I would think that TAB would be infinitely better and avoid the problems you point out that probably plague a lot of editors when doing Python code. And many editors allow you to set the size of the TAB (e.g. 2 spaces in size if you think 4 looks too large -- I do). Then one delete and remove the indent no matter what the TAB size. The four spaces approach sounds like an accident waiting to happen. Not to mention completely baffling to newbies or even those of us who have hung around it for a while. -- Cheers, Lou Pecora Code 6362 Naval Research Lab Washington, DC 20375 USA Ph: +202-767-6002 email: pecora at anvil.nrl.navy.mil From trentm at ActiveState.com Tue Nov 29 18:37:55 2005 From: trentm at ActiveState.com (Trent Mick) Date: Tue, 29 Nov 2005 09:37:55 -0800 Subject: [Pythonmac-SIG] Preferred IDE In-Reply-To: References: Message-ID: <20051129173755.GB1796@ActiveState.com> [Jan Erik Mostr??m wrote] > A somewhat similar question: is there a good debugger for python? > > Personally I prefer BBEdit as my editor but the thing I'm looking for is a > debugger. I played around a little bit with Komodo but are there any other > alternatives? I'd be interested in any comments you have about Komodo's Python debugging (or anything else about it). Cheers, Trent -- Trent Mick TrentM at ActiveState.com From trentm at ActiveState.com Tue Nov 29 18:41:39 2005 From: trentm at ActiveState.com (Trent Mick) Date: Tue, 29 Nov 2005 09:41:39 -0800 Subject: [Pythonmac-SIG] readline support in ActivePython 2.4.2? In-Reply-To: <588f52020511230227q643c0561s7ceaf7634cf728e8@mail.gmail.com> References: <588f52020511230227q643c0561s7ceaf7634cf728e8@mail.gmail.com> Message-ID: <20051129174139.GC1796@ActiveState.com> [Dave wrote] > I installed the ActivePython 2.4.2 binary on a clean 10.4 system. I > also installed ipython 0.6.15. ipython complains there is no readline > support. I did find a readline.so file in > > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-dynload/ > > and ipython seems to be using the 2.4.2 python version. > > How can I get readline to work, especially in ipython? Is there an > obvious fix or should I perhaps uninstall the ActivePython version and > use the 2.4.1 installer and related patches at > http://undefined.org/python/ Currently the readline module is not in ActivePython builds. Mainly this is due to licensing issues: readline is GPL, ActivePython is free as in beer. I *do* want to make it a simple separate download to be able to plop in readline support, but haven't yet had the chance. You could either build the readline module to any Python 2.4 and plop that in. Dropping in the readline.so from the Mac Python build should work to. Sincerely, Trent -- Trent Mick TrentM at ActiveState.com From Chris.Barker at noaa.gov Tue Nov 29 20:40:33 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Tue, 29 Nov 2005 11:40:33 -0800 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style (spaces) In-Reply-To: <438C90F3.2020906@anvil.nrl.navy.mil> References: <438C90F3.2020906@anvil.nrl.navy.mil> Message-ID: <438CAEB1.3010505@noaa.gov> Louis Pecora wrote: > You hold down the option key while selecting, but you cannot do this > in the soft wrap mode. You have to set the window to hard wrap at > some column number. If you have the BBEdit manual, you can find more > info around page 52 or just look in the index. thanks. > What the heck were they (Guido?) thinking when they used 4 spaces as > the one true mode of indentation for Python? I have no clue. It was a bad idea, from the beginning, to allow mixed tabs+spaces. (I still don't understand why that hasn't been completely deprecated). > I would think that TAB would be infinitely better and avoid the > problems you point out that probably plague a lot of editors when > doing Python code. I agree. Tabs would be easier in most cases, but: > And many editors allow you to set the size of the > TAB (e.g. 2 spaces in size if you think 4 looks too large -- I do). Well, that is an issue. I think there is a trade off between people making their own choice about what things should look like and consistency. Also, aside form changing the size of tabs, various places people use text, like in email messages, html, etc, tabs get mangled, so that may be why spaces were selected as the standard. Or maybe there is no logic, and it's just what Guido likes. As it happens, the Mac is the only place I've ever had a problem, both in the old macPython IDE and BBedit. All other editors I've used (at least mildly competent ones) have been fine. -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 Chris.Barker at noaa.gov From cookedm at physics.mcmaster.ca Tue Nov 29 21:03:49 2005 From: cookedm at physics.mcmaster.ca (David M. Cooke) Date: Tue, 29 Nov 2005 15:03:49 -0500 Subject: [Pythonmac-SIG] Fwd: Preferred IDE In-Reply-To: <438C8C95.3080208@noaa.gov> (Chris Barker's message of "Tue, 29 Nov 2005 09:15:01 -0800") References: <0F2BBC0D-0DD4-4773-9036-A0E0196640B4@strozllc.com> <438C8C95.3080208@noaa.gov> Message-ID: "Chris Barker" writes: > Jeffrey E. Forcier wrote: >>> I also seem to remember BBEdit not having that >>>issue for some reason, but it wasn't worth the price tag for that >>>one tweak. > >>> TextWrangler/BBEdit is an *excellent* editor, so be sure to try it out yourself > > Yes, it is, but it really doesn't do python indenting quite right. These > days, all python code really should be indented with 4 spaces, and while > you can set BBedit to put in 4 spaces when you hit the tab key, it > doesn't recognize those four spaces as a single level of indentation > when you want to delete them, requiring four hits of the backspace key. > > One would think that this is a minor annoyance, and perhaps it is, but > being used to the excellent [X]emacs python mode, I find it very > frustrating. > > A few years ago, there was a thread in this mailing list about his, and > someone had even discussed the issue with BB's tech support. Their > response was something along the lines of "you shouldn't want to do > that", and they therefor will not try to support it. Granted, I'm sure > Python coders are a pretty small part of their market, and indentation > based languages are few and far between, but at the core was an attitude > that they know better than we do what we should want, and even more of > an issue, they are in total control of what will and won't be added to > BBedit. One reason I don't like closed source software. However, besides > being closed source, BBedit does not provide a powerful way for users to > customize the editor's behavior themselves. If they did we'd have an > excellent python mode by now. This annoyed me too, which why I'm not using TextWrangler :-) I've submitted a patch for Smultron that does this when "indent with spaces" is turned on: http://sourceforge.net/tracker/index.php?func=detail&aid=1356887&group_id=110857&atid=657594 -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |cookedm at physics.mcmaster.ca From lists at mostrom.pp.se Tue Nov 29 22:18:16 2005 From: lists at mostrom.pp.se (Jan Erik =?UTF-8?Q?Mostr=C3=B6m?=) Date: Tue, 29 Nov 2005 22:18:16 +0100 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style (spaces) In-Reply-To: <438CAEB1.3010505@noaa.gov> Message-ID: Chris Barker 2005-11-29 20:40: > > I would think that TAB would be infinitely better and avoid the > > problems you point out that probably plague a lot of editors when > > doing Python code. > > I agree. Tabs would be easier in most cases, but: Thank you, while I really like Python I've never figured this one out. But I have other style things also that isn't "true" python ;-) jem -- Jan Erik Mostr?m, www.mostrom.pp.se From kquirk at solidworks.com Tue Nov 29 22:35:27 2005 From: kquirk at solidworks.com (Kent Quirk) Date: Tue, 29 Nov 2005 16:35:27 -0500 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style(spaces) Message-ID: Just because there seems to be an orgy of people agreeing that Tabs are the One True Way, I feel a need to point out that there are those of us who fervently believe that Tabs Are Evil. The reason is that tabs are interpreted differently in different places, and they're indistinguishable from spaces upon casual inspection. So the visual appearance of mixed spaces and tabs can be highly misleading and confusing, especially in an environment with multiple developers, each of whom may have a different tab setting. Spaces are unambiguous. As it's the meaning of the source that matters, and editors can be tuned to personal taste, I'm in favor of leaving the source clean of tabs and letting people tweak their editors to their own liking. In my view, Python should consider leading tabs to be a syntax error (and yes, I know about the -tt switch). Kent -----Original Message----- From: pythonmac-sig-bounces at python.org [mailto:pythonmac-sig-bounces at python.org] On Behalf Of Jan Erik Mostr?m Sent: Tuesday, November 29, 2005 4:18 PM To: Chris Barker Cc: Louis Pecora; pythonmac-sig at python.org Subject: Re: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style(spaces) Chris Barker 2005-11-29 20:40: > > I would think that TAB would be infinitely better and avoid the > > problems you point out that probably plague a lot of editors when > > doing Python code. > > I agree. Tabs would be easier in most cases, but: Thank you, while I really like Python I've never figured this one out. But I have other style things also that isn't "true" python ;-) jem -- Jan Erik Mostr?m, www.mostrom.pp.se _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG at python.org http://mail.python.org/mailman/listinfo/pythonmac-sig From pecora at anvil.nrl.navy.mil Tue Nov 29 22:54:13 2005 From: pecora at anvil.nrl.navy.mil (Louis Pecora) Date: Tue, 29 Nov 2005 16:54:13 -0500 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style(spaces) In-Reply-To: References: Message-ID: <438CCE05.4080905@anvil.nrl.navy.mil> Kent Quirk wrote: >Just because there seems to be an orgy of people agreeing that Tabs are the One True Way, I feel a need to point out that there are those of us who fervently believe that Tabs Are Evil. The reason is that tabs are interpreted differently in different places, and they're indistinguishable from spaces upon casual inspection. So the visual appearance of mixed spaces and tabs can be highly misleading and confusing, especially in an environment with multiple developers, each of whom may have a different tab setting. > >Spaces are unambiguous. As it's the meaning of the source that matters, and editors can be tuned to personal taste, I'm in favor of leaving the source clean of tabs and letting people tweak their editors to their own liking. > >In my view, Python should consider leading tabs to be a syntax error (and yes, I know about the -tt switch). > > Kent > > I'm not sure what you are talking about, but I meant that Tabs can be set in an editor (e.g. BBEdit) to _display_ at any number of spaces, but the editor does not put in real spaces. It just displays the Tabs as indentations whose width you choose. There's still only one character (a tab) there in the file. Delete works properly. That's pretty unambiguous to me. So if someone else on your project likes to display using 8-space tabs and you like 2-space tabs it doesn't matter. You can look at his files and edit them back and forth and nothing gets confused. Why is that so bad? -- Cheers, Lou Pecora Code 6362 Naval Research Lab Washington, DC 20375 USA Ph: +202-767-6002 email: pecora at anvil.nrl.navy.mil From bob at redivi.com Tue Nov 29 23:59:07 2005 From: bob at redivi.com (Bob Ippolito) Date: Tue, 29 Nov 2005 17:59:07 -0500 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style(spaces) In-Reply-To: <438CCE05.4080905@anvil.nrl.navy.mil> References: <438CCE05.4080905@anvil.nrl.navy.mil> Message-ID: On Nov 29, 2005, at 4:54 PM, Louis Pecora wrote: > Kent Quirk wrote: > >> Just because there seems to be an orgy of people agreeing that >> Tabs are the One True Way, I feel a need to point out that there >> are those of us who fervently believe that Tabs Are Evil. The >> reason is that tabs are interpreted differently in different >> places, and they're indistinguishable from spaces upon casual >> inspection. So the visual appearance of mixed spaces and tabs can >> be highly misleading and confusing, especially in an environment >> with multiple developers, each of whom may have a different tab >> setting. >> >> Spaces are unambiguous. As it's the meaning of the source that >> matters, and editors can be tuned to personal taste, I'm in favor >> of leaving the source clean of tabs and letting people tweak their >> editors to their own liking. >> >> In my view, Python should consider leading tabs to be a syntax >> error (and yes, I know about the -tt switch). > > I'm not sure what you are talking about, but I meant that Tabs can be > set in an editor (e.g. BBEdit) to _display_ at any number of spaces, > but the editor does not put in real spaces. It just displays the Tabs > as indentations whose width you choose. There's still only one > character (a tab) there in the file. Delete works properly. That's > pretty unambiguous to me. So if someone else on your project likes to > display using 8-space tabs and you like 2-space tabs it doesn't > matter. > You can look at his files and edit them back and forth and nothing > gets > confused. Why is that so bad? Why does it matter? In any reasonable text editor, you hit tab or backspace when changing indentation levels regardless of whether your document uses spaces or tabs. If variable display really was important, surely it would be a supported feature in at least one Python IDE to expand/collapse 4- space to the desired width. As far as I know, it's not. Anyway, this discussion is pointless. 4-space indentation is the way to write Python code, and that's not going to change. Ever. -bob From managan at llnl.gov Wed Nov 30 02:02:12 2005 From: managan at llnl.gov (Rob Managan) Date: Tue, 29 Nov 2005 17:02:12 -0800 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style(spaces) In-Reply-To: References: <438CCE05.4080905@anvil.nrl.navy.mil> Message-ID: >On Nov 29, 2005, at 4:54 PM, Louis Pecora wrote: > >> Kent Quirk wrote: >> >>> Just because there seems to be an orgy of people agreeing that >>> Tabs are the One True Way, I feel a need to point out that there >>> are those of us who fervently believe that Tabs Are Evil. The >>> reason is that tabs are interpreted differently in different >>> places, and they're indistinguishable from spaces upon casual >>> inspection. So the visual appearance of mixed spaces and tabs can >>> be highly misleading and confusing, especially in an environment >>> with multiple developers, each of whom may have a different tab >>> setting. >>> >>> Spaces are unambiguous. As it's the meaning of the source that >>> matters, and editors can be tuned to personal taste, I'm in favor >>> of leaving the source clean of tabs and letting people tweak their >>> editors to their own liking. >>> >>> In my view, Python should consider leading tabs to be a syntax >>> error (and yes, I know about the -tt switch). >> >> I'm not sure what you are talking about, but I meant that Tabs can be >> set in an editor (e.g. BBEdit) to _display_ at any number of spaces, >> but the editor does not put in real spaces. It just displays the Tabs >> as indentations whose width you choose. There's still only one >> character (a tab) there in the file. Delete works properly. That's >> pretty unambiguous to me. So if someone else on your project likes to >> display using 8-space tabs and you like 2-space tabs it doesn't >> matter. >> You can look at his files and edit them back and forth and nothing >> gets > > confused. Why is that so bad? > Because in a mixed environment some one will take a file that has tabs and add spaces or vice versa. As soon as lines have a mixture of tabs and spaces then the display does ugly things when you change editors. I run into this all the time in C with those I develop with. We try to keep it to spaces but some people forget that their editor puts in a tab automatically for 8 spaces and then spaces after that to column 12 for example. Then my editor which sets tabs to 4 spaces has indentation all messed up. -- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Rob Managan email managan at llnl.gov LLNL phone: 925-423-0903 P.O. Box 808, L-095 FAX: 925-422-3389 Livermore, CA 94551-0808 From davbrow at gmail.com Wed Nov 30 08:01:06 2005 From: davbrow at gmail.com (Dave) Date: Tue, 29 Nov 2005 23:01:06 -0800 Subject: [Pythonmac-SIG] readline support in ActivePython 2.4.2? Message-ID: <588f52020511292301k3725f797p7949a9f3f5ec9dd2@mail.gmail.com> [Trent Mick said] >[Dave wrote] >> I installed the ActivePython 2.4.2 binary on a clean 10.4 system. I >> also installed ipython 0.6.15. ipython complains there is no readline >> support. I did find a readline.so file in >> >> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-dynload/ >> >> and ipython seems to be using the 2.4.2 python version. >> >> How can I get readline to work, especially in ipython? Is there an >> obvious fix or should I perhaps uninstall the ActivePython version and >> use the 2.4.1 installer and related patches at >> http://undefined.org/python/ > >Currently the readline module is not in ActivePython builds. Mainly this >is due to licensing issues: readline is GPL, ActivePython is free as in >beer. I *do* want to make it a simple separate download to be able to >plop in readline support, but haven't yet had the chance. >You could either build the readline module to any Python 2.4 and plop >that in. Dropping in the readline.so from the Mac Python build should >work to. > >Sincerely, >Trent Thanks for the info Trent. When using ipython it's very much necessary to have readline support. In my case I really only use the arrow keys and tab but I suspect ipython would break if the full module was not provided. I was desperate and, lacking clues or documentation (even Google failed me), I uninstalled the ActiveState version and used the 2.4.1 installer. Frankly I really appreciated the uninstaller script and clear instructions that were part of the ActiveState distribution! Very few packages I've seen are so carefull. I'll probably try it again for a future update. Also, I and I'm sure many others would appreciate a separate download or a few README comments on how to get readline installed if it's needed. For future reference and for the benefit of other readers, I'm still unclear on how to actually get readline working. I had tried to build readline (twice, once standalone using make and once using darwinports) and it seemed to work but I don't know where to place it. This is for OS X but, in general for unix systems how can you tell where a library is supposed to be located? Is there any standard or convention? I tried a few places including /lib-dynload but ipython still complained and I got those telltale '[]^' codes when I tried to use arrow keys. I'm not done with installs. I tried to install matplotlib from source to get a current version. That went equally as well (i.e., bad), possibly for similar reasons, but that's another story. Meanwhile the old machine with rock-solid 10.3.9 and all the python 2.3 toys is quietly enjoying the show. -- Dave From Henning.Ramm at mediapro-gmbh.de Wed Nov 30 09:34:24 2005 From: Henning.Ramm at mediapro-gmbh.de (Henning.Ramm@mediapro-gmbh.de) Date: Wed, 30 Nov 2005 09:34:24 +0100 Subject: [Pythonmac-SIG] Fwd: Preferred IDE Message-ID: >Does anyone know how customizable jedit is .. in Jython maybe? Alle jEdit plugins are written in Java, never used Jython, so I don't know if that would be a way. But at least on my Mac (Tiger) jEdit behaves rather clumsy and tends to crash; there are some GUI problems; some plugins won't load or work. Greetlings, HR From ryanwilcox at mac.com Wed Nov 30 15:57:07 2005 From: ryanwilcox at mac.com (Ryan Wilcox) Date: Wed, 30 Nov 2005 09:57:07 -0500 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting In-Reply-To: Message-ID: On 11/29/05, at 9:03 PM, pythonmac-sig-request at python.org said: >Yes, it is, but it really doesn't do python indenting quite right. >These days, all python code really should be indented with 4 spaces, >and while you can set BBedit to put in 4 spaces when you hit the tab >key, it doesn't recognize those four spaces as a single level of >indentation when you want to delete them, requiring four hits of the >backspace key. There's always the Shift Left and Shift Right command (under the Text menu). Yes, I know it's not a real solution, but it's better than hitting delete four times. Hmm... another idea would be to write a script and attach it to BBEdit's Save item so that it automatically performs Detab on your source code. Write in tabs, have it automagically convert to spaces. Such a script is below: --name this "File?Save" and put it in the --~/Library/BBEdit/Menu Scripts on MenuSelect(menuName, menuItem) tell application "BBEdit" set myName to name of document 1 if myName contains ".py" then --python file!!!! detab text document 1 tab width 4 end if end tell return false --do the save operation end MenuSelect HTH, _Ryan Wilcox -- Wilcox Development Solutions: Toolsmiths for the Internet Age PGP: 0x2F4E9C31 From pecora at anvil.nrl.navy.mil Wed Nov 30 16:11:58 2005 From: pecora at anvil.nrl.navy.mil (Louis Pecora) Date: Wed, 30 Nov 2005 10:11:58 -0500 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style(spaces) In-Reply-To: References: <438CCE05.4080905@anvil.nrl.navy.mil> Message-ID: <438DC13E.2040407@anvil.nrl.navy.mil> Rob Managan wrote: > Because in a mixed environment some one will take a file that has > >tabs and add spaces or vice versa. As soon as lines have a mixture of >tabs and spaces then the display does ugly things when you change >editors. > >I run into this all the time in C with those I develop with. We try >to keep it to spaces but some people forget that their editor puts in >a tab automatically for 8 spaces and then spaces after that to column >12 for example. Then my editor which sets tabs to 4 spaces has >indentation all messed up. > > But in C it doesn't matter for the code to compile and run. C has block delimiters. Python does not and there's the rub. I guess this is an old topic. Frankly, I like Python's approach much better, but it is like, the good news is there are no block delimiters, the bad news is there are no block delimiters. I can live with that because the good news is better than the bad news is worse (does that make sense? :-) ). My original question was just a version of, could Guido (blessed be the prophet's name) have done it better? That's all. I didn't want a flame war or the Spanish Inquisition. Thanks. -- Cheers, Lou Pecora Code 6362 Naval Research Lab Washington, DC 20375 USA Ph: +202-767-6002 email: pecora at anvil.nrl.navy.mil From Chris.Barker at noaa.gov Wed Nov 30 18:32:34 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Wed, 30 Nov 2005 09:32:34 -0800 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting In-Reply-To: References: Message-ID: <438DE232.7060506@noaa.gov> Ryan Wilcox wrote: > Hmm... another idea would be to write a script and attach it to BBEdit's Save item so that it automatically performs Detab on your source code. Write in tabs, have it automagically convert to spaces. Such a script is below: > > --name this "File?Save" and put it in the > --~/Library/BBEdit/Menu Scripts > on MenuSelect(menuName, menuItem) > tell application "BBEdit" > set myName to name of document 1 > > if myName contains ".py" then --python file!!!! > detab text document 1 tab width 4 > end if > end tell > return false --do the save operation > end MenuSelect This looks dangerous. In Python, tabs are hard coded to equal 8 spaces. Any other setting is asking for trouble. If you have only tabs it's not a problem, but if they get mixed.... Could you also write a script then entabed all python files on load? It would have to use 8 spaces per tab when it did it, but that would mean that it wouldn't put tabs in when there were four spaces. It would be better to write it in python, then you could use the python parser to figure out the indentation, an re-write the file with all tabs. There have been scripts to do this floating around for years. I used to use them all the time, but now, thank goodness, most people just use spaces. All this because Bare Bones has decided for us that no one would ever want to map the delete key to mean "remove one level of indentation" when you're at the beginning of a line. -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 Chris.Barker at noaa.gov From zhiyong_peng2003 at yahoo.com Wed Nov 30 18:38:45 2005 From: zhiyong_peng2003 at yahoo.com (Zhi Peng) Date: Wed, 30 Nov 2005 09:38:45 -0800 (PST) Subject: [Pythonmac-SIG] min library Message-ID: <20051130173845.30652.qmail@web35309.mail.mud.yahoo.com> Hi! All Recently I am back to window platform and try the same as I had in MAc. But win does not have python installed as default. I call python function from my C code, but I would like to have min python library installed on win platform. Is there tool that I can use to strip extra python code , libraries, etc on window platform? Thanks Zhi --------------------------------- Yahoo! Music Unlimited - Access over 1 million songs. Try it free. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051130/6a6fd2c9/attachment.html From Chris.Barker at noaa.gov Wed Nov 30 18:53:43 2005 From: Chris.Barker at noaa.gov (Chris Barker) Date: Wed, 30 Nov 2005 09:53:43 -0800 Subject: [Pythonmac-SIG] readline support in ActivePython 2.4.2? In-Reply-To: <588f52020511292301k3725f797p7949a9f3f5ec9dd2@mail.gmail.com> References: <588f52020511292301k3725f797p7949a9f3f5ec9dd2@mail.gmail.com> Message-ID: <438DE727.6070804@noaa.gov> Dave wrote: > I'm not done with installs. I tried to install matplotlib from source > to get a current version. That went equally as well (i.e., bad), > possibly for similar reasons, but that's another story. Did you follow the process I used for the older MPL package at pythonmac.org? The instructions should be in the package. If so, what happened? I'm sorry I don't have the need for it right now, so it's hard to make the time. By the way, if you get it working, please do contribute it back to pythonmac.org. -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 Chris.Barker at noaa.gov From gary at modernsongs.com Wed Nov 30 19:13:19 2005 From: gary at modernsongs.com (Gary Poster) Date: Wed, 30 Nov 2005 13:13:19 -0500 Subject: [Pythonmac-SIG] readline support in ActivePython 2.4.2? In-Reply-To: <20051129174139.GC1796@ActiveState.com> References: <588f52020511230227q643c0561s7ceaf7634cf728e8@mail.gmail.com> <20051129174139.GC1796@ActiveState.com> Message-ID: <2DD30621-DEF1-466B-A704-A7302D263F6B@modernsongs.com> On Nov 29, 2005, at 12:41 PM, Trent Mick wrote: > You could either build the readline module to any Python 2.4 and plop > that in. Dropping in the readline.so from the Mac Python build should > work to. Thanks for the hint, Trent! I guess I should have done that already. :-) More precisely, to maybe save some other not-entirely-Mac-clueful folks like me time, if you have installed MacPython and then ActivePython, that's $ cd /Library/Frameworks/Python.framework/Versions $ sudo cp MacPython2.4/lib/python2.4/lib-dynload/readline.so 2.4/lib/ python2.4/lib-dynload/ Works great so far. Gary From spe.stani.be at gmail.com Wed Nov 30 21:15:31 2005 From: spe.stani.be at gmail.com (SPE Stani's Python Editor) Date: Wed, 30 Nov 2005 21:15:31 +0100 Subject: [Pythonmac-SIG] NotebookCtrl Widget Problem On Mac FIXED!! Message-ID: <2078a7ad0511301215j398c0bf6k8f7b78dfd997ff35@mail.gmail.com> Hi Andrea, Thanks to SPE Mac users who sponsered SPE with a Mini Mac, I was able to debug your control with winpdb debugger. So now the light is green to get your control into SPE. After plunging in the code, I managed to get the control working. The problem is that wxMac doesn't seem to support the wx.DefaultSize (-1,-1) which is always transformed in (0,0). So setting the size to like wx.Size(28,28) solves the issue. I'll email you privately with the patch. I'm not sure if it is 100% stable. I found some bugs, which I also will send to you. For those who like to see the screenshot: http://pythonide.stani.be/images/NotebookCtrl.png Best regards, Stani -- http://pythonide.stani.be http://pythonide.stani.be/manual/html/manual.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051130/241b3a97/attachment.html From Jack.Jansen at cwi.nl Wed Nov 30 23:57:29 2005 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Wed, 30 Nov 2005 23:57:29 +0100 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style (spaces) In-Reply-To: <438C90F3.2020906@anvil.nrl.navy.mil> References: <438C90F3.2020906@anvil.nrl.navy.mil> Message-ID: <13491A73-FD83-4391-90E2-701553B4E23D@cwi.nl> On 29-nov-2005, at 18:33, Louis Pecora wrote: > What the heck were they (Guido?) thinking when they used 4 spaces > as the one true mode of indentation for Python? Initially Python was unix-only, and there (at that time) a tab was 8 spaces and that is that, no problem with mixing tab/spaces. Then the Mac (and later dos/windows) joined the scene, which had 4-space tabs. Then it was deemed mixing tab/space was bad (because code got ugly or even didn't work when ported between 4- and 8-space tabs. Because at that time most editors (both on Unix and Windows) still did not have the feature to set how many spaces a tabstop was it was decided to go with spaces for indenting: going with tabs would have meant unix- heads would be stuck with unusable 8-space indents. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From david at personconsulting.com Tue Nov 29 21:12:39 2005 From: david at personconsulting.com (David Person) Date: Tue, 29 Nov 2005 12:12:39 -0800 Subject: [Pythonmac-SIG] Selecting in BBEdit & Python Indenting style (spaces) In-Reply-To: <438CAEB1.3010505@noaa.gov> References: <438C90F3.2020906@anvil.nrl.navy.mil> <438CAEB1.3010505@noaa.gov> Message-ID: <798734B9-89F9-4CC6-9757-31F6E1F9A233@personconsulting.com> Odd, I always use 2 spaces, and haven't really heard 4 was standard. I don't keep up much with those things, though :) Tabs are certainly allowed. There is a potential difficulty in mixing tabs and spaces in the same file, since it is unclear how many spaces go into a tab, so there is potential for ambiguity. The WingIDE notices the file's indentation style and helps keep it straight. When debugging, I sometimes get a warning because the standard python libraries sometimes use different standards, and I have Wing setup to warn me in those cases. The WingIDE lets you choose which style to use. If you press tab, it tabs to the next potential spot, semi-intelligently - not just the next tab marker. Similar with backspace. I think Wing has done a great job in simplifying the tab/spaces difficulties, but they have quite a sophisticated algorithm for it - more complicated than ideally would be necessary, but it does eliminate the problem. -dp- On Nov 29, 2005, at 11:40 AM, Chris Barker wrote: > Louis Pecora wrote: > >> You hold down the option key while selecting, but you cannot do this >> in the soft wrap mode. You have to set the window to hard wrap at >> some column number. If you have the BBEdit manual, you can find more >> info around page 52 or just look in the index. > > thanks. > > >> What the heck were they (Guido?) thinking when they used 4 spaces as >> the one true mode of indentation for Python? > > I have no clue. It was a bad idea, from the beginning, to allow mixed > tabs+spaces. (I still don't understand why that hasn't been completely > deprecated). > >> I would think that TAB would be infinitely better and avoid the >> problems you point out that probably plague a lot of editors when >> doing Python code. > > I agree. Tabs would be easier in most cases, but: > >> And many editors allow you to set the size of the >> TAB (e.g. 2 spaces in size if you think 4 looks too large -- I do). > > Well, that is an issue. I think there is a trade off between people > making their own choice about what things should look like and > consistency. Also, aside form changing the size of tabs, various > places > people use text, like in email messages, html, etc, tabs get > mangled, so > that may be why spaces were selected as the standard. Or maybe > there is > no logic, and it's just what Guido likes. > > As it happens, the Mac is the only place I've ever had a problem, both > in the old macPython IDE and BBedit. All other editors I've used (at > least mildly competent ones) have been fine. > > -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 > > Chris.Barker at noaa.gov > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From kay.fricke at merz-akademie.de Wed Nov 30 12:39:23 2005 From: kay.fricke at merz-akademie.de (Kay Fricke) Date: Wed, 30 Nov 2005 12:39:23 +0100 Subject: [Pythonmac-SIG] Preferred IDE In-Reply-To: <20051128100855.31741.qmail@web50201.mail.yahoo.com> References: <20051128100855.31741.qmail@web50201.mail.yahoo.com> Message-ID: <438D8F6B.4010306@merz-akademie.de> Hi Mark, my preferred Python IDE is SPE: http://www.stani.be/python/spe/ This is currently getting polished up for the mac, but is already fairly usable. It Includes a Module Browser, A shell, tools like the PythonDebugger, or Kiki for Regex testing. Have a look, i just can warmly recommend it. greetz kay