From fear@technologist.com Tue Feb 1 01:57:29 2000 From: fear@technologist.com (Chris Jacobson) Date: Mon, 31 Jan 2000 19:57:29 -0600 Subject: [Pythonmac-SIG] select.select bugs Message-ID: <200002010157.UAA27741@pop05.iname.net> This may or may not be known, but on MacOS, 'select.select' does not work properly. The script that follows works perfectly on UNIX, but not on MacOS - the listening socket will not be marked as readable even tho the connection is opened (thus it never gets accept'd) - Chris Jacobson import asyncore, socket, time, select sockets = [] class mysock(asyncore.dispatcher): def __init__(self): self.outbuffer = '' self.inbuffer = '' print 'New socket created' asyncore.dispatcher.__init__(self) def handle_connect(self): self.send('Welcome.\n') def handle_accept(self): sock, addr = self.accept() newDisp = mysock() newDisp.set_socket(sock) sockets.append(newDisp) print 'New connection from ', addr def handle_write(self): sent = self.send(self.outbuffer) self.outbuffer = self.outbuffer[sent:] def handle_read(self): data = self.recv(1024) if (len(data) > 0): print 'Received: ', data self.outbuffer = self.outbuffer + 'You entered: ' + data + '\n' else: self.close() def writeable(self): return (len(self.outbuffer) > 0) listener = mysock() listener.create_socket(socket.AF_INET, socket.SOCK_STREAM) listener.bind( ('', 5000) ) listener.listen(5) asyncore.loop() From chriss@dnastar.com Tue Feb 1 04:33:12 2000 From: chriss@dnastar.com (chriss@dnastar.com) Date: Mon, 31 Jan 2000 22:33:12 -0600 Subject: [Pythonmac-SIG] select.select bugs In-Reply-To: <200002010157.UAA27741@pop05.iname.net> Message-ID: <20000131223312.016550@artemis.dnastar.com> On Mon, Jan 31, 2000, Chris Jacobson wrote: >This may or may not be known, but on MacOS, 'select.select' does not work >properly. Well the mac dosn't acualy have a select call - so MacPython uses GUSI - the Grand Unified Socket Libary - to emulate Socket calls (such as select() ) on to of MacTCP (which these days is an emulation lib on top of OpenTransport.) Anyway, the point is, a new socket libaray - a successor to GUSI has come out which offers some more modern features (such as mult-threading), and both Jack Jansen and I have been working on adapting Python152 to it. So if you would be so kind, download and put this file (after unstuffing) into your ':Python 1.5.2c1:' folder along with 'PythonInterpreter' and 'Python IDE' and all that. This is a version of PythonInterpreter with all the shared libararies cramed into it, so you'll just need this one file. (apart from all the .py files in allread in ':Python 1.5.2c1:Lib', etc. of course.) This app has not been very throughly tested, it runs test.regrtest without commiting any invalid operations (under Spolight) that is no bad pointer accesses, no goofy arguments to system calls (that Spotlight notices). But some of the mac- specific modules have not been tested all. Anyway if you do try it, please let me know how this works. If your an iTools member, you can also find it at: afp://idisk.mac.com/christopherstern/public Christopher Stern DNAStar,1228 South Park Madison, WI 53715-2102, USA ph: 608.258.7420 ext. 25 From chriss@dnastar.com Wed Feb 2 20:16:40 2000 From: chriss@dnastar.com (chriss@dnastar.com) Date: Wed, 2 Feb 2000 14:16:40 -0600 Subject: [Pythonmac-SIG] PythonStandalone Message-ID: <20000202141640.018932@artemis.dnastar.com> The PythonStandalone project (& PythonStandSmall ) has an error that leads to a crash on quit when linked with GUSI2 (or any C++ for that matter). In the xxx Setings... : LINKER : PCC Linker _ENTRY POINTS____________________________________ | | Initailaization: | __init | | | Main: | __start | | | Termination: | | | Of the three MSL runtime libary calls __init(), __start(), __terminate() , Shared libs should ask CFM to call __init() & __terminate(), applications must register __start() *ONLY*. Both __init() & __start() call __sinit() which calls the initialisers of global objects, and puts the objects on the __global_destructor_chain - causing each global to be destoyed twice. New CodeWarrior sets up new application projects correctly, but perhaps, PythonStandalone descends from the PythonCore slb. Christopher Stern DNAStar,1228 South Park Madison, WI 53715-2102, USA ph: 608.258.7420 ext. 25 From jack@oratrix.nl Wed Feb 2 22:51:44 2000 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 02 Feb 2000 23:51:44 +0100 Subject: [Pythonmac-SIG] PythonStandalone In-Reply-To: Message by chriss@dnastar.com , Wed, 2 Feb 2000 14:16:40 -0600 , <20000202141640.018932@artemis.dnastar.com> Message-ID: <20000202225149.8E895CF32A@oratrix.oratrix.nl> Recently, chriss@dnastar.com said: > Of the three MSL runtime libary calls __init(), __start(), __terminate() , > Shared libs should ask CFM to call __init() & __terminate(), > applications must register __start() *ONLY*. Ah, thanks! That is something that must have been changed somewhere in the history of CW, I guess. Or indeed I stupidly added the __initialize/__terminate calls to the static interpreter when I did them for the shared-lib version. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From pf@artcom-gmbh.de Fri Feb 4 00:13:37 2000 From: pf@artcom-gmbh.de (Peter Funk) Date: Fri, 4 Feb 2000 01:13:37 +0100 (MET) Subject: [Pythonmac-SIG] i18n - How to find out MacOS language from Python? Message-ID: How can I find out the particular foreign language (English, German, etc...) of a Mac from a Python program running on MacOS 8.x. The builtin module 'locale' is unfortunately not included in my latest version of Mac-Python (1.5.2c1). So I'm looking for a way to mimic the effect of >>> import locale >>> locale.setlocale(locale.LC_CTYPE) de_DE Regards from Germany, Peter P.S: This might belong into the newly created i18n-sig, but I ask here because of the knowlegdable audience here! ;-) -- Peter Funk, Oldenburger Str.86, 27777 Ganderkesee, Tel: 04222 9502 70, Fax: -60 From PClaerhout@CREO.BE Tue Feb 8 10:48:33 2000 From: PClaerhout@CREO.BE (Pieter Claerhout) Date: Tue, 8 Feb 2000 11:48:33 +0100 Subject: [Pythonmac-SIG] an import library was too new for a client Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA70D2@MSGEURO1> Hello, I installed Python 1.5.2c1 recently, and neow I have problems importing compiled modules. Whenever I try to import one, I get the following error: Traceback (innermost last): file "", line 1, in ? ImportError: PythonCore: an import library was too new for a client I have it when I import OSAm.ppc.slb, also when importing Mk4py.ppc.slb. I'm running MacOS 8.6. Any ideas? Pieter Pieter Claerhout - PClaerhout@creo.be Response Center - Applications Support Creo Europe - Excelsiorlaan 21 - 1930 Zaventem - Belgium Tel: +32 (2) 711 14 00 - Fax: +32 (2) 720 96 71 From PClaerhout@CREO.BE Tue Feb 8 10:50:02 2000 From: PClaerhout@CREO.BE (Pieter Claerhout) Date: Tue, 8 Feb 2000 11:50:02 +0100 Subject: [Pythonmac-SIG] MacOS 8.5 style dialogs boxes Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA70D3@MSGEURO1> Hello, are the MacOS navigation service style dialog boxes for opening and saving files already available for Python? If yes, where can I get them? Pieter Pieter Claerhout - PClaerhout@creo.be Response Center - Applications Support Creo Europe - Excelsiorlaan 21 - 1930 Zaventem - Belgium Tel: +32 (2) 711 14 00 - Fax: +32 (2) 720 96 71 From PClaerhout@CREO.BE Tue Feb 8 10:51:28 2000 From: PClaerhout@CREO.BE (Pieter Claerhout) Date: Tue, 8 Feb 2000 11:51:28 +0100 Subject: [Pythonmac-SIG] Getting the default browser Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA70D4@MSGEURO1> Hello, what is the easiest way to get the creator of the user's default browser, and how do I open an URL with this default browser. Pieter Pieter Claerhout - PClaerhout@creo.be Response Center - Applications Support Creo Europe - Excelsiorlaan 21 - 1930 Zaventem - Belgium Tel: +32 (2) 711 14 00 - Fax: +32 (2) 720 96 71 From PClaerhout@CREO.BE Tue Feb 8 10:53:50 2000 From: PClaerhout@CREO.BE (Pieter Claerhout) Date: Tue, 8 Feb 2000 11:53:50 +0100 Subject: [Pythonmac-SIG] How to change values in the resource fork Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA70D5@MSGEURO1> Hello, can anyone tell me how I can change values in a #STR resource of my script, for example to store preferences in? Is there a tutorial or a place in the docs where I can find more info? Thankx. Pieter Pieter Claerhout - PClaerhout@creo.be Response Center - Applications Support Creo Europe - Excelsiorlaan 21 - 1930 Zaventem - Belgium Tel: +32 (2) 711 14 00 - Fax: +32 (2) 720 96 71 From PClaerhout@CREO.BE Tue Feb 8 10:55:30 2000 From: PClaerhout@CREO.BE (Pieter Claerhout) Date: Tue, 8 Feb 2000 11:55:30 +0100 Subject: [Pythonmac-SIG] Launching an app and bringing it to the front Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA70D6@MSGEURO1> Hello, what's the easiest way to launch an app from a Python script and to bring it to the front? Pieter Pieter Claerhout - PClaerhout@creo.be Response Center - Applications Support Creo Europe - Excelsiorlaan 21 - 1930 Zaventem - Belgium Tel: +32 (2) 711 14 00 - Fax: +32 (2) 720 96 71 From tmk@skynet.be Tue Feb 8 11:13:02 2000 From: tmk@skynet.be (tmk) Date: Tue, 8 Feb 2000 12:13:02 +0100 Subject: [Pythonmac-SIG] an import library was too new for a client In-Reply-To: <2B1262E83448D211AE4B00A0C9D61B03BA70D2@MSGEURO1> References: <2B1262E83448D211AE4B00A0C9D61B03BA70D2@MSGEURO1> Message-ID: At 11:48 +0100 08/02/2000, Pieter Claerhout wrote: >Hello, > >I installed Python 1.5.2c1 recently, and neow I have problems >importing compiled modules. Whenever I try to import one, >I get the following error: > >Traceback (innermost last): > file "", line 1, in ? >ImportError: PythonCore: an import library was too new for a client > >I have it when I import OSAm.ppc.slb, also when importing >Mk4py.ppc.slb. I'm running MacOS 8.6. You'll need to re-compile these modules using the 1.5.2c1 source. I've done it for MetaKit (that's a killer!) . = tmk = PS: Nice to see MacPython users in Belgium btw :-). > >Any ideas? > > >Pieter > >Pieter Claerhout - PClaerhout@creo.be >Response Center - Applications Support > >Creo Europe - Excelsiorlaan 21 - 1930 Zaventem - Belgium >Tel: +32 (2) 711 14 00 - Fax: +32 (2) 720 96 71 > > >_______________________________________________ >Pythonmac-SIG maillist - Pythonmac-SIG@python.org >http://www.python.org/mailman/listinfo/pythonmac-sig From tmk@skynet.be Tue Feb 8 11:13:58 2000 From: tmk@skynet.be (tmk) Date: Tue, 8 Feb 2000 12:13:58 +0100 Subject: [Pythonmac-SIG] Getting the default browser In-Reply-To: <2B1262E83448D211AE4B00A0C9D61B03BA70D4@MSGEURO1> References: <2B1262E83448D211AE4B00A0C9D61B03BA70D4@MSGEURO1> Message-ID: At 11:51 +0100 08/02/2000, Pieter Claerhout wrote: >Hello, > >what is the easiest way to get the creator of the user's >default browser, and how do I open an URL with this >default browser. IC a.k.a internet Config = tmk = > >Pieter > >Pieter Claerhout - PClaerhout@creo.be >Response Center - Applications Support > >Creo Europe - Excelsiorlaan 21 - 1930 Zaventem - Belgium >Tel: +32 (2) 711 14 00 - Fax: +32 (2) 720 96 71 > > >_______________________________________________ >Pythonmac-SIG maillist - Pythonmac-SIG@python.org >http://www.python.org/mailman/listinfo/pythonmac-sig From joanca@typerware.com Tue Feb 8 11:44:33 2000 From: joanca@typerware.com (JoanCarles p Casas=?ISO-8859-1?Q?=edn?=) Date: Tue, 8 Feb 2000 12:44:33 +0100 Subject: [Pythonmac-SIG] Launching an app and bringing it to the front Message-ID: <200002081135.GAA24894@python.org> Pieter Claerhout wrote: >Hello, > >what's the easiest way to launch an app from a Python >script and to bring it to the front? Don't know if it's the easiest or better, but seems to work... -------------------- import macfs, findertools #creator should of course, the app's creator string f = macfs.FindApplication(creator) findertools.launch(f) -------------------- hope this helps, JoanCarles :::!!!::: joanca@typerware.com http://www.typerware.com From just@letterror.com Tue Feb 8 13:31:49 2000 From: just@letterror.com (Just van Rossum) Date: Tue, 8 Feb 2000 14:31:49 +0100 Subject: [Pythonmac-SIG] How to change values in the resource fork In-Reply-To: <2B1262E83448D211AE4B00A0C9D61B03BA70D5@MSGEURO1> Message-ID: """ At 11:53 AM +0100 08-02-2000, Pieter Claerhout wrote: >Hello, > >can anyone tell me how I can change values in >a #STR resource of my script, for example to >store preferences in? Is there a tutorial or a >place in the docs where I can find more info? """ #(untested) import Res, struct resRef = Res.OpenResFile(myResFile) resType = '????' resID = 126 myStrRes = Res.Get1Resource(resType, resID) print myStrRes.data myStrRes.data = "new data" myStrRes.ChangedResource() myStrRes.WriteResource() Res.CloseResFile(resRef) #just From just@letterror.com Tue Feb 8 13:32:51 2000 From: just@letterror.com (Just van Rossum) Date: Tue, 8 Feb 2000 14:32:51 +0100 Subject: [Pythonmac-SIG] MacOS 8.5 style dialogs boxes In-Reply-To: <2B1262E83448D211AE4B00A0C9D61B03BA70D3@MSGEURO1> Message-ID: At 11:50 AM +0100 08-02-2000, Pieter Claerhout wrote: >Hello, > >are the MacOS navigation service style dialog boxes for opening >and saving files already available for Python? If yes, where can I >get them? They're in the CVS version... So not in any mainstream release yet. Just From just@letterror.com Tue Feb 8 13:26:48 2000 From: just@letterror.com (Just van Rossum) Date: Tue, 8 Feb 2000 14:26:48 +0100 Subject: [Pythonmac-SIG] Getting the default browser In-Reply-To: References: <2B1262E83448D211AE4B00A0C9D61B03BA70D4@MSGEURO1> <2B1262E83448D211AE4B00A0C9D61B03BA70D4@MSGEURO1> Message-ID: At 12:13 PM +0100 08-02-2000, tmk wrote: >At 11:51 +0100 08/02/2000, Pieter Claerhout wrote: >>Hello, >> >>what is the easiest way to get the creator of the user's >>default browser, and how do I open an URL with this >>default browser. > >IC a.k.a internet Config To be more specific, the easiest way is: import ic ic.launchurl("http://www/filibuster.org") Just From jack@oratrix.nl Tue Feb 8 14:46:05 2000 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 08 Feb 2000 15:46:05 +0100 Subject: [Pythonmac-SIG] an import library was too new for a client In-Reply-To: Message by Pieter Claerhout , Tue, 8 Feb 2000 11:48:33 +0100 , <2B1262E83448D211AE4B00A0C9D61B03BA70D2@MSGEURO1> Message-ID: <20000208144610.7F8DCD8D4B@oratrix.oratrix.nl> Recently, Pieter Claerhout said: > Hello, > > I installed Python 1.5.2c1 recently, and neow I have problems > importing compiled modules. Whenever I try to import one, > I get the following error: > > Traceback (innermost last): > file "", line 1, in ? > ImportError: PythonCore: an import library was too new for a client > This means that the dynamic module was created for an older version of MacPython. I've just submitted a patch to Guido (for historic reasons this code is in the machine-independent part of Python) that gives a beter error message in this case. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From jack@oratrix.nl Tue Feb 8 16:21:10 2000 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 08 Feb 2000 17:21:10 +0100 Subject: [Pythonmac-SIG] How to change values in the resource fork In-Reply-To: Message by Pieter Claerhout , Tue, 8 Feb 2000 11:53:50 +0100 , <2B1262E83448D211AE4B00A0C9D61B03BA70D5@MSGEURO1> Message-ID: <20000208162115.C316CD8D4B@oratrix.oratrix.nl> Recently, Pieter Claerhout said: > Hello, > > can anyone tell me how I can change values in > a #STR resource of my script, for example to > store preferences in? Is there a tutorial or a > place in the docs where I can find more info? Aside from the comment Just posted you could also have a look at the preferences.py module, which is a set of generalized preference handling classes that allow global prefs, per-file overrides, etc. Unfortunately the module isn't documented, but the pythonprefs.py module shows how to use it to implement even the rather convoluted preference scheme MacPython has. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From bobcrosley@provide.net Wed Feb 9 04:53:25 2000 From: bobcrosley@provide.net (Bob & Sue Crosley) Date: Tue, 08 Feb 2000 23:53:25 -0500 Subject: [Pythonmac-SIG] What does Python/Mac need to run a program? Message-ID: We're developing a cross-platform Python app that will run on Mac, Windows and Linux. We've isolated the minimal DLL's that need to be used in the Windows environment, but are wondering what files are necessary to run a Python application in the Mac environment. Is it simply the Python Core 1.5.2 system extension? If so, does the system need to be restarted after the extension is installed? Thanks, Bob Crosley From giorgio@dimi.uniud.it Wed Feb 9 08:25:32 2000 From: giorgio@dimi.uniud.it (Giorgio Brajnik) Date: Wed, 9 Feb 2000 09:25:32 +0100 Subject: [Pythonmac-SIG] carbon compliance of python 1.5.2 Message-ID: <200002090825.JAA00522@du010119.cc.uniud.it> I was wondering if python 152 is carbon compliant, and if not, what are the main reasons. And how does it run on Mac X? Thanks a lot, Giorgio Brajnik ______________________________________________________________________ Dip. di Matematica e Informatica | voice: +39 0432-55.8445 Universita` di Udine | fax: +39 0432-55.8499 Via delle Scienze, 206 | email: giorgio@dimi.uniud.it Loc. Rizzi -- 33100 Udine -- ITALY | http://www.dimi.uniud.it/~giorgio From jack@oratrix.nl Wed Feb 9 10:32:42 2000 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 09 Feb 2000 11:32:42 +0100 Subject: [Pythonmac-SIG] What does Python/Mac need to run a program? In-Reply-To: Message by Bob & Sue Crosley , Tue, 08 Feb 2000 23:53:25 -0500 , Message-ID: <20000209103242.DB9EB36E440@snelboot.oratrix.nl> > We're developing a cross-platform Python app that will run on Mac, Windows > and Linux. We've isolated the minimal DLL's that need to be used in the > Windows environment, but are wondering what files are necessary to run a > Python application in the Mac environment. > > Is it simply the Python Core 1.5.2 system extension? If so, does the system > need to be restarted after the extension is installed? Yes, that's the only extension you need, and you don't need to restart. If you want you can use BuildApplication (on the mac only) on your app to bundle your app, PythonCore and all extension modules neded into a single mac executable. That way you also don't have to distribute the Python tree, the application will be completely self-contained. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From jack@oratrix.nl Wed Feb 9 10:35:17 2000 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 09 Feb 2000 11:35:17 +0100 Subject: [Pythonmac-SIG] carbon compliance of python 1.5.2 In-Reply-To: Message by giorgio@dimi.uniud.it (Giorgio Brajnik) , Wed, 9 Feb 2000 09:25:32 +0100 , <200002090825.JAA00522@du010119.cc.uniud.it> Message-ID: <20000209103518.02A6E36E440@snelboot.oratrix.nl> > I was wondering if python 152 is carbon compliant, and if not, what > are the main reasons. If I remember correctly the main carbon non-compliancies are StandardFile use for dialogs and a little bit of code in the interpreter inner loop that looks for command-period. But it's been a while since I ran the carbon tester, so I may have forgotten things. > And how does it run on Mac X? I never tried it. I would be very interested in any reports on this, if someone has done so. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From craig@osa.att.ne.jp Wed Feb 9 11:30:31 2000 From: craig@osa.att.ne.jp (Craig Hagerman) Date: Wed, 9 Feb 2000 20:30:31 +0900 Subject: [Pythonmac-SIG] (no subject) Message-ID: I have written a small python script to do some automated downloading at night while I am asleep (and the phone charges are low). I am using the urllib module. A connection is initiated and then the files are downloaded to my hard drive. But then everything just waits for the PPP timeout from Apple's Remote Access in order to disconnect. Is there a way to script this part of the process as well from Python - an automatic disconnect? I haven't found any way so far. Craig Hagerman From erik@letterror.com Wed Feb 9 11:34:45 2000 From: erik@letterror.com (Erik van Blokland) Date: Wed, 9 Feb 2000 12:34:45 +0100 Subject: [Pythonmac-SIG] (no subject) Message-ID: <200002091138.MAA22443@leidschenveen.denhaag.dataweb.net> -- Craig Hagerman [2/9/00 12:30 PM]: > Is there a way to script this >part of the process as well from Python - an automatic disconnect? I >haven't found any way so far. I guess you could make the finder open an applescript applet that quits the connection for you. I've seen PPP versions that come with neat little applescript applets that connect and disconnect. From python you can tell the finder to open such an applet, it should execute all by itself: findertools.launch(path_to_applet) Hope this works, I don't have the PPP stuff to test it. Erik van BLokland -- letterror From billpy@mousa.demon.co.uk Wed Feb 9 12:50:41 2000 From: billpy@mousa.demon.co.uk (Bill Bedford) Date: Wed, 9 Feb 2000 12:50:41 +0000 Subject: [Pythonmac-SIG] (no subject) In-Reply-To: References: Message-ID: At 8:30 pm +0900 09/02/00, Craig Hagerman wrote: >I have written a small python script to do some automated downloading at >night while I am asleep (and the phone charges are low). I am using the >urllib module. A connection is initiated and then the files are downloaded >to my hard drive. But then everything just waits for the PPP timeout from >Apple's Remote Access in order to disconnect. Is there a way to script this >part of the process as well from Python - an automatic disconnect? I >haven't found any way so far. > Run gensuitemodule.py on the Remote Access Commands scripting addition. This will give you access to the PPP appleevent commands. It would though tell you when your download has finished. -- Bill Bedford mailto:billb@mousa.demon.co.uk The Tigers of wrath are wiser than the horses of instruction. From billpy@mousa.demon.co.uk Wed Feb 9 14:39:49 2000 From: billpy@mousa.demon.co.uk (Bill Bedford) Date: Wed, 9 Feb 2000 14:39:49 +0000 Subject: [Pythonmac-SIG] (no subject) In-Reply-To: References: Message-ID: At 12:50 pm +0000 09/02/00, Bill Bedford wrote: >At 8:30 pm +0900 09/02/00, Craig Hagerman wrote: > >>I have written a small python script to do some automated downloading at >>night while I am asleep (and the phone charges are low). I am using the >>urllib module. A connection is initiated and then the files are downloaded >>to my hard drive. But then everything just waits for the PPP timeout from >>Apple's Remote Access in order to disconnect. Is there a way to script this >>part of the process as well from Python - an automatic disconnect? I >>haven't found any way so far. >> > >Run gensuitemodule.py on the Remote Access Commands scripting >addition. This will give you access to the PPP appleevent commands. >It would though tell you when your download has finished. That last sentence should read: It will not, though, tell you when your download has finished. dyslexia lures doh.......... -- Bill Bedford mailto:billb@mousa.demon.co.uk The Tigers of wrath are wiser than the horses of instruction. From jeffrey@Digicool.com Wed Feb 9 18:06:37 2000 From: jeffrey@Digicool.com (Jeffrey P Shell) Date: Wed, 09 Feb 2000 13:06:37 -0500 Subject: [Pythonmac-SIG] carbon compliance of python 1.5.2 In-Reply-To: <20000209103518.02A6E36E440@snelboot.oratrix.nl> Message-ID: on 2/9/2000 5:35 AM, Jack Jansen at jack@oratrix.nl wrote:: >> I was wondering if python 152 is carbon compliant, and if not, what are the >> main reasons. >> > If I remember correctly the main carbon non-compliancies are StandardFile use > for dialogs and a little bit of code in the interpreter inner loop that looks > for command-period. But it's been a while since I ran the carbon tester, so I > may have forgotten things. > >> And how does it run on Mac X? [nit]::MacX is an X windows server. Python runs great over that :). > I never tried it. I would be very interested in any reports on this, if > someone has done so. There is both great potential and danger with Python for MacOS X -- MacPython has a lot of its effort put to Python(ic) modules for the Mac toolbox. Since MacOS X is based on Darwin which is largely based on FreeBSD 3.2, a Unix Python compiles fairly easily. (Since I can't get MacOS X Server and MacOS X DP2 to live together, I haven't tried building a Zope-ready Python on MacOS X yet. There were some issues the first time I tried compiling Python1.5.2 on MacOS X DP 1, largely the fact that MacOS X no longer reports itself as rhapsody but as 'MacOS 10.0' when you run the unix 'uname' command.:) This was before I knew of the configure option to set the host to Apples BSD on PowerPC. It looks like Apple will finally be detailing their development tools strategy at WWDC 2000. I *doubt* that MacOS X will ship with even 'cc' stock. (I think even in MacOS X Server, you have to install the development tools from the WebObjects CD to get even the unix command line compiler tools). I have the feeling that MacPython would get a very low scoring on the Carbon Dater application due to the number of cross-platform libraries (when Carbon Dater was first released, Netscape Communicator scored very low on Carbon Compliance due to its number of cross-platform libraries), so using a tool like that to spot Carbon porting issues might not work for us. I'm very interesting in seeing MacPython work on MacOS X, but my general feeling at this point is that there will be at least two Pythons available. Scott Anguish from Stepwise has been welcomed into the core Darwin community, and he's the one who made a Python package for MacOS X Server (in his note about Apple bringing him into the core Darwin community he mentioned Python). So there's a possibility that MacOS X will ship with a unix Python stock. There's also Python 1.4 heavily linked to Cocoa in Objective Everything (www.tiptop.com), which hasn't seen much development lately. TipTop claims that ObjectiveEverything will work with Carbon so that you can use Python, Perl, or TCL with Carbon applications. But again -- it's an old Python. mmm, big message of disjointed information. :) --- Jeffrey P Shell, jeffrey@Digicool.com http://www.zope.org/ From giorgio@dimi.uniud.it Thu Feb 10 09:00:48 2000 From: giorgio@dimi.uniud.it (Giorgio Brajnik) Date: Thu, 10 Feb 2000 10:00:48 +0100 Subject: [Pythonmac-SIG] python & macOS X Message-ID: <200002100900.KAA00594@du010119.cc.uniud.it> I've got a more detailed question regarding Python on MacOS X. We're developing an application using Python for everything except the GUI (a good exercise in embedding python!). Thus the application kernel is totally portable between mac and linux, and hopefully windows, and does not make use of anything specific to PythonMac (except for a call to PyMac_Initialize()). Which will be the main difficulties in compiling and installing on MacOS X the Python system that runs on linux? How much carbon compliant would that be? Thanks again, Giorgio Brajnik ______________________________________________________________________ Dip. di Matematica e Informatica | voice: +39 0432-55.8445 Universita` di Udine | fax: +39 0432-55.8499 Via delle Scienze, 206 | email: giorgio@dimi.uniud.it Loc. Rizzi -- 33100 Udine -- ITALY | http://www.dimi.uniud.it/~giorgio From jack@oratrix.nl Thu Feb 10 16:20:03 2000 From: jack@oratrix.nl (Jack Jansen) Date: Thu, 10 Feb 2000 17:20:03 +0100 Subject: [Pythonmac-SIG] CVS tree snapshots Message-ID: <20000210162004.8C67236E440@snelboot.oratrix.nl> There has been some demand for source tree snapshots without having to install MacCVS. Now, this is technically easy: run a nightly scripts that does a cvs update, stuffs the resulting directory and uploads it to an ftp server. All the tools involved are scriptable, so that's the "easy" bit:-) However, I don't have the infrastructure right now to set this up. Is there someone who is willing to do this? -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From jeffrey@Digicool.com Thu Feb 10 17:31:17 2000 From: jeffrey@Digicool.com (Jeffrey P Shell) Date: Thu, 10 Feb 2000 12:31:17 -0500 Subject: [Pythonmac-SIG] Re: python & macOS X In-Reply-To: <20000210170046.A1ABB1CDCC@dinsdale.python.org> Message-ID: > Which will be the main difficulties in compiling and installing on MacOS X the > Python system that runs on linux? I assume you mean running at the Unix level (aka Darwin). The main difficulty is that MacOS X / Darwin is too new to be recognized by the Python configuration scripts, although the notes at xclave.macnn.com (see link below) might address this issue. I can't get MacOS X DP2 and MacOS X Server happily residing on the same machine yet, so I haven't tried building on MacOS X for quite some time. I don't think there's any TKinter support either, but I may be wrong on that. But for what's been done so far on MacOS X Server, here's a few resources that I know of. See my notes at http://www.zope.org/Members/jshell/buildingZopeOnMacOSXServer (it discusses building a threaded (no problem) shared lib (small problem) on MacOS X Server - basically building a Zope friendly Python. It assumes basic knowledge of configuring Python for compilation). Or here http://xclave.macnn.com/Features/QuickNDirty/ (although they don't discuss the LDFLAGs problem when compiling shared libraries). There's an installable (no threads, no shared libs) package on Softrak http://softrak.stepwise.com/Apps/WebObjects/Softrak (search for 'Python'). -- Jeffrey P Shell, jeffrey@Digicool.com http://www.zope.org/ From savageb@pacbell.net Thu Feb 10 17:54:06 2000 From: savageb@pacbell.net (Bob Savage) Date: Thu, 10 Feb 2000 09:54:06 -0800 Subject: [Pythonmac-SIG] Re: python & macOS X In-Reply-To: Message-ID: on 2/10/00 9:31 AM, Jeffrey P Shell wrote: > I can't get MacOS X DP2 and > MacOS X Server happily residing on the same machine yet, so I haven't tried > building on MacOS X for quite some time. I don't think there's any TKinter > support either, but I may be wrong on that. Yeah, and the situation is particularly unstable right now. DP3 is expected within the week for one thing. Also Apple's big opportunity to explain to the developer community is still a couple of months away (WWDC happens in May, I believe). Since moving from DP2 to DP3 involves a complete rewrite of the graphics engine (moving from Display Postscript to "Quartz" the new PDF-based engine), it might be too soon to get real answers to these questions. Bob From jon@clearink.com Thu Feb 10 19:49:55 2000 From: jon@clearink.com (jon *) Date: Thu, 10 Feb 2000 11:49:55 -0800 Subject: [Pythonmac-SIG] CVS tree snapshots In-Reply-To: <20000210162004.8C67236E440@snelboot.oratrix.nl> Message-ID: on 2/10/00 8:20 AM, Jack Jansen wrote: > There has been some demand for source tree snapshots without having to install > MacCVS. Now, this is technically easy: run a nightly scripts that does a cvs > update, stuffs the resulting directory and uploads it to an ftp server. All > the tools involved are scriptable, so that's the "easy" bit:-) > > However, I don't have the infrastructure right now to set this up. Is there > someone who is willing to do this? If someone wants to set this up on a unix box, here are my hack scripts for java.apache.org cvs stuff... #!/bin/sh # Setup the PATH so that all of the utilities are found PATH=/usr/local/bin:/bin export PATH # Serial number SERIAL=`date +%Y%m%d` # Log onto the CVS server specified below (so an entry exists in the '.cvspass' # file for the user), check out a working copy of the module(s) required, and # set this script to run on cron. Ensure that the working version stays clean # (do not compile in it!). #CVSROOT=:pserver:jservpub@cvs.working-dogs.com:/products/cvs/master CVSROOT=/products/cvs/master export CVSROOT # CVS Module name module=ecs # Name for distribution TAG=Apache-ECS-${SERIAL} # Path to public ftp/http directory PUBDIR=/serv/websites/working-dogs/htdocs/daily # make PUBDIR if needed mkdir -p ${PUBDIR} # change to the right directory cd ${PUBDIR} # Create an exportable directory of the CVS module cvs -Q -z3 export -d ${TAG} -r HEAD ${module} #( cd ${module}; cvs -z3 update ) # Create 'Apache-JServ-YYYYMMDD{.tar.gz|.zip}' files on ftp/http server tar -c -z --exclude CVS -f ${PUBDIR}/${TAG}.tar.gz ${TAG} # cleanup the export directory rm -r ${PUBDIR}/${TAG} # End of script From jack@oratrix.nl Thu Feb 10 21:44:37 2000 From: jack@oratrix.nl (Jack Jansen) Date: Thu, 10 Feb 2000 22:44:37 +0100 Subject: [Pythonmac-SIG] CVS tree snapshots In-Reply-To: Message by jon * , Thu, 10 Feb 2000 11:49:55 -0800 , Message-ID: <20000210214443.78829CF32F@oratrix.oratrix.nl> Recently, jon * said: > on 2/10/00 8:20 AM, Jack Jansen wrote: > > > There has been some demand for source tree snapshots without having to inst > all > > MacCVS. Now, this is technically easy: run a nightly scripts that does a cv > s > > update, stuffs the resulting directory and uploads it to an ftp server. All > > the tools involved are scriptable, so that's the "easy" bit:-) > > If someone wants to set this up on a unix box, here are my hack scripts for > java.apache.org cvs stuff... Unfortunately that won't work. At least: I _think_ it won't work, so please prove me wrong (setting this up on unix would be easy enough). The problem is the resource forks in project files and resource files. While these are extracted fine on a Macintosh I think that the files you extract on Unix are not very useful. They're some sort of macBinary format, but not really (I haven't found out what they are, it could be applesingle or some such weird format). And then you'd have to tar/gzip the result, which is a slight problem to mac users. But this is the minor problem, as Stuffit Expander with the enhanced version can expand these files (although you'll loose all creator/type info, I think). -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From orla_redbird@crosswinds.net Thu Feb 10 21:57:34 2000 From: orla_redbird@crosswinds.net (Gordon Worley) Date: Thu, 10 Feb 2000 16:57:34 -0500 Subject: [Pythonmac-SIG] CVS tree snapshots Message-ID: >>> There has been some demand for source tree snapshots without having to install MacCVS. Now, this is technically easy: run a nightly scripts that does a cvs update, stuffs the resulting directory and uploads it to an ftp server. All the tools involved are scriptable, so that's the "easy" bit:-) However, I don't have the infrastructure right now to set this up. Is there someone who is willing to do this? <<< Sorry, I can't set this up (I don't have the stuff, either). I was wondering, however, if, in addition to snapshots, could we do nightly builds? I realize that this will be about like Mozilla's nightly builds that aren't always the most reliable releases, but it would offer a way for those of use who don't have the tools for compiling MacPython to have the latest version to play with. I'm especialy think along the lines of that I keep reading on the list about new features that have been added to the CVS tree, but which I know that I have no hope of using becase, although I have MacCVS and can access the tree, that doesn't change the fact that I am unable to compile any of the code (nor do I have the knowledge to, I'll admit, because I've always been a fan of interpreted languages, which skip out on the complie and link steps). Anyway, if it is possible I think it would be nice to have. - Gordon Worley http://www.crosswinds.net/~orla_redbird/ mailto:orla_redbird@crosswinds.net From managan@llnl.gov Thu Feb 10 22:23:45 2000 From: managan@llnl.gov (Rob Managan) Date: Thu, 10 Feb 2000 14:23:45 -0800 Subject: [Pythonmac-SIG] CVS tree In-Reply-To: <20000210214443.78829CF32F@oratrix.oratrix.nl> References: <20000210214443.78829CF32F@oratrix.oratrix.nl> Message-ID: I would like to know how to build the current CVS tree. I just got a fresh copy of both python and the Mac stuff. I end up with many warnings as I build PythonCorePPC but one error due to a change in MSL IO routines. Apparently MetroWerks pulled the __num_to_file routine which GUSI uses. I haven't gone to the GUSI 2 yet. Is that required or is there a work around for this?? /* mm 981015 If these routines are really needed, they need updating to account for dynamically */ /* allocated file structures You can look on this as like the cheshire cat's smile, remaining */ /* after the cat has disappeared */ /*int __file_to_num(__std(FILE) * file); __std(FILE) * __num_to_file(int file_num);*/ Link Error : undefined '__num_to_file' (code) Referenced from 'fwalk' in MSLGUSI.Lib.PPC Referenced from 'GUSISetupMSLSIOUX()' in MSLGUSI.Lib.PPC *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan LLNL ph: 925-423-0903 P.O. Box 808, L-095 FAX: 925-422-3389 Livermore, CA 94551-0808 From tmk@skynet.be Thu Feb 10 22:48:59 2000 From: tmk@skynet.be (tmk) Date: Thu, 10 Feb 2000 23:48:59 +0100 Subject: [Pythonmac-SIG] Re: python & macOS X In-Reply-To: References: Message-ID: At 12:31 -0500 2000/02/10, Jeffrey P Shell wrote: > > Which will be the main difficulties in compiling and installing=20 >on MacOS X the > > Python system that runs on linux? > >I assume you mean running at the Unix level (aka Darwin). > >The main difficulty is that MacOS X / Darwin is too new to be recognized by >the Python configuration scripts, although the notes at xclave.macnn.com >(see link below) might address this issue. I can't get MacOS X DP2 and >MacOS X Server happily residing on the same machine yet, so I haven't tried >building on MacOS X for quite some time. I don't think there's any TKinter >support either, but I may be wrong on that. But for what's been done so fa= r >on MacOS X Server, here's a few resources that I know of. > >See my notes at >http://www.zope.org/Members/jshell/buildingZopeOnMacOSXServer >(it discusses building a threaded (no problem) shared lib (small problem) o= n >MacOS X Server - basically building a Zope friendly Python. It assumes >basic knowledge of configuring Python for compilation). Hey Jeffrey! This is way cool! I've been praying for this to happen. Did I miss a=20 posting metioning this How-To on the Mac OS X specific lists? Thanks a MILLION :-) =3D tmk =3D PS: Any clue as to how to build Python on Mac OS X Server =E0 la *NeXT*=20 framework? >Or here http://xclave.macnn.com/Features/QuickNDirty/ (although they don't >discuss the LDFLAGs problem when compiling shared libraries). > >There's an installable (no threads, no shared libs) package on Softrak >http://softrak.stepwise.com/Apps/WebObjects/Softrak (search for 'Python'). > >-- >Jeffrey P Shell, jeffrey@Digicool.com >http://www.zope.org/ > > >_______________________________________________ >Pythonmac-SIG maillist - Pythonmac-SIG@python.org >http://www.python.org/mailman/listinfo/pythonmac-sig From jack@oratrix.nl Thu Feb 10 22:56:23 2000 From: jack@oratrix.nl (Jack Jansen) Date: Thu, 10 Feb 2000 23:56:23 +0100 Subject: [Pythonmac-SIG] CVS tree In-Reply-To: Message by Rob Managan , Thu, 10 Feb 2000 14:23:45 -0800 , Message-ID: <20000210225629.64379CF32F@oratrix.oratrix.nl> Recently, Rob Managan said: > I would like to know how to build the current CVS tree. I just got a > fresh copy of both python and the Mac stuff. I end up with many > warnings as I build PythonCorePPC but one error due to a change in > MSL IO routines. Apparently MetroWerks pulled the __num_to_file > routine which GUSI uses. > > I haven't gone to the GUSI 2 yet. Is that required or is there a work > around for this?? Yes, the workaround is RTFWP (uhm... lemme look... Yes, this is actually described on http://www.cwi.nl/~jack/macpython.html;-). You should get the special GUSI mentioned on the MacPython webpage to compile the current sources (or the 1.5.2c1 sources, for that matter, if you use the current CW compiler). GUSI 2 doesn't work yet, because there are some fixes Guido should check in and he's away, and there's also still a few glitches with runtime support that we haven't figured out yet. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From jack@oratrix.nl Thu Feb 10 23:48:13 2000 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 11 Feb 2000 00:48:13 +0100 Subject: [Pythonmac-SIG] CVS tree snapshots In-Reply-To: Message by Gordon Worley , Thu, 10 Feb 2000 16:57:34 -0500 , Message-ID: <20000210234819.638E9CF32F@oratrix.oratrix.nl> > I was > wondering, however, if, in addition to snapshots, could we do nightly > builds? Owwww... You offer people a finger and not only do they take the whole hand, but the arm too:-) But, you're definitely right, these would be very nice to have. Also for us (me and Just and other contributers-with-source) as the quick feedback is good. However, this will have to go on the long-term to-do list, as I've just found a way to decode the MacCVS files and recode them in MacBinary. I've put such a dump in ftp://ftp.cwi.nl/pub/jack/python/mac/SourceDump/ , if someone could try it and let me know whether it works that would be nice. You have to unpack the .bin files yourself, and you probably have to set correct creator/types too (at least for the .prj files, which have to be CWIE/MMPR, if I remember correctly). For now I'll make these dumps on demand (don't hesitate to ask: I have scripts for it), if enough people bother me often enough I'll automate it. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From managan@llnl.gov Fri Feb 11 17:40:38 2000 From: managan@llnl.gov (Rob Managan) Date: Fri, 11 Feb 2000 09:40:38 -0800 Subject: [Pythonmac-SIG] CVS tree snapshots In-Reply-To: <20000210234819.638E9CF32F@oratrix.oratrix.nl> References: <20000210234819.638E9CF32F@oratrix.oratrix.nl> Message-ID: At 12:48 AM +0100 2/11/00, Jack Jansen wrote: > > I was > > wondering, however, if, in addition to snapshots, could we do nightly > > builds? > >Owwww... You offer people a finger and not only do they take the whole >hand, but the arm too:-) > >But, you're definitely right, these would be very nice to have. Also >for us (me and Just and other contributers-with-source) as the quick >feedback is good. > >However, this will have to go on the long-term to-do list, as I've >just found a way to decode the MacCVS files and recode them in >MacBinary. I've put such a dump in >ftp://ftp.cwi.nl/pub/jack/python/mac/SourceDump/ , if someone could >try it and let me know whether it works that would be nice. You have >to unpack the .bin files yourself, and you probably have to set >correct creator/types too (at least for the .prj files, which have to >be CWIE/MMPR, if I remember correctly). > >For now I'll make these dumps on demand (don't hesitate to ask: I have >scripts for it), if enough people bother me often enough I'll automate >it. >-- I tried it and was able to build PythonCore except for 3 missing files: Couldn't find project file "dialogs.rsrc". Couldn't find project file "errors.rsrc". Couldn't find project file "gusiprefs.rsrc". *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan LLNL ph: 925-423-0903 P.O. Box 808, L-095 FAX: 925-422-3389 Livermore, CA 94551-0808 From jack@oratrix.nl Fri Feb 11 23:22:03 2000 From: jack@oratrix.nl (Jack Jansen) Date: Sat, 12 Feb 2000 00:22:03 +0100 Subject: [Pythonmac-SIG] CVS tree snapshots In-Reply-To: Message by Rob Managan , Fri, 11 Feb 2000 09:40:38 -0800 , Message-ID: <20000211232208.90DFBCF32F@oratrix.oratrix.nl> Recently, Rob Managan said: > I tried it and was able to build PythonCore except for 3 missing files: > > Couldn't find project file "dialogs.rsrc". > > Couldn't find project file "errors.rsrc". > > Couldn't find project file "gusiprefs.rsrc". That's what I meant by "you'll have to unpack the macbinary files yourself". Granted, this comment wasn't very precise. The exact statement is: After you unpack the .tgz file you locate all .bin files in the resulting folder. You feed all these through Stuffit Expander or through another program that can decode MacBinary format. This will unpack your .rsrc files. Sorry for the confusion, -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From dgreen@rewindtech.com Mon Feb 14 19:16:15 2000 From: dgreen@rewindtech.com (Dan Green) Date: Mon, 14 Feb 2000 14:16:15 -0500 Subject: [Pythonmac-SIG] Ahoy! Message-ID: <20000214141615.A16214@brainy.rewindtech.com> Hello, there. New to the list ... couldn't find an answer to this in the archives, so here it is. I'm trying to write an event handler in python to replace one written in AppleScript. Here's what I've got: from MiniAEFrame import AEServer, MiniApplication class EventHandler(AEServer, MiniApplication): def __init__(self): MiniApplication.__init__(self) AEServer.__init__(self) print "installing standard event handlers" self.installaehandler('aevt', 'oapp', self.open_app) self.installaehandler('aevt', 'quit', self.quit) self.installaehandler('ascr', 'psbr', self.retrospectEvent) self.mainloop() def retrospectEvent(self, _object=None, _class=None, _type=None, **args): print _object, ":", _class, ":", _type for key in args.keys(): print key + "==" + args[key] def open_app(self, **args): pass def quit(self, **args): self._quit() if __name__ == '__main__': EventHandler() But when an event actually gets sent from retrospect (the software I'm trying to capture events from), I get one of these in the Python window: AE error: (-608, 'noOutstandingHLE') in High Level Event: 'ascr' 'psbr' So the event is being trapped and sent to the right application. Unfortunately, my knowledge of Mac internals is not fantastic, so I'm at a loss here. Any help would be appreciated. Thanks! -- Dan Green | Developer | I used to be disgusted, now I find I'm just amused. Rewind Technologies | -- Elvis Costello From erik@letterror.com Tue Feb 15 08:12:35 2000 From: erik@letterror.com (Erik van Blokland) Date: Tue, 15 Feb 2000 09:12:35 +0100 Subject: [Pythonmac-SIG] Ahoy! Message-ID: <200002150816.JAA28934@leidschenveen.denhaag.dataweb.net> -- Dan Green [2/14/00 8:16 PM]: >But when an event actually gets sent from retrospect (the software I'm trying >to capture events from), I get one of these in the Python window: If you just want to *see* which events are sent around, there's a very handy tool from the people that make Lasso: ftp://ftp.blueworld.com/Lasso251/LassoCaptureAE.hqx It shows a window with the text of the events rushing by. It's a bit awkward in its interface, but it works. I've found it very useful when figuring out python AE stuff. Erik -- letterror From jack@oratrix.nl Tue Feb 15 09:49:44 2000 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 15 Feb 2000 10:49:44 +0100 Subject: [Pythonmac-SIG] Ahoy! In-Reply-To: Message by Dan Green , Mon, 14 Feb 2000 14:16:15 -0500 , <20000214141615.A16214@brainy.rewindtech.com> Message-ID: <20000215094944.DC1B5371868@snelboot.oratrix.nl> Hmm, this all looks good. There's one reason why it could fail: if you have turned this into an applet, and you have the applet be started by retrospect (with an "activate") you have to turn off "argv emulation" on the resulting applet with EditPythonPrefs. This is so the initial AppleEvent isn't gobbled up by the AppleEvent code that creates sys.argv. It's easy to check whether this is the problem: it doesn't occur if the applet is already running, in that case the event should come through fine. > Hello, there. > New to the list ... couldn't find an answer to this in the archives, > so here it is. I'm trying to write an event handler in python to replace one > written in AppleScript. Here's what I've got: > > from MiniAEFrame import AEServer, MiniApplication > > class EventHandler(AEServer, MiniApplication): > def __init__(self): > MiniApplication.__init__(self) > AEServer.__init__(self) > print "installing standard event handlers" > self.installaehandler('aevt', 'oapp', self.open_app) > self.installaehandler('aevt', 'quit', self.quit) > self.installaehandler('ascr', 'psbr', self.retrospectEvent) > self.mainloop() > > def retrospectEvent(self, _object=None, _class=None, _type=None, **args): > print _object, ":", _class, ":", _type > for key in args.keys(): > print key + "==" + args[key] > > def open_app(self, **args): > pass > > def quit(self, **args): > self._quit() > > if __name__ == '__main__': > EventHandler() > > But when an event actually gets sent from retrospect (the software I'm trying > to capture events from), I get one of these in the Python window: > > AE error: (-608, 'noOutstandingHLE') > in High Level Event: 'ascr' 'psbr' -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From pf@artcom-gmbh.de Wed Feb 16 10:19:11 2000 From: pf@artcom-gmbh.de (Peter Funk) Date: Wed, 16 Feb 2000 11:19:11 +0100 (MET) Subject: [Pythonmac-SIG] What about the Tcl/Tk problems? Message-ID: Hi! Guido posted an official annoucement about IDLE 0.5 to 'comp.lang.python'. He wrote: [...] > IDLE has the following features: > > - coded in 100% pure Python, using the Tkinter GUI toolkit (i.e. Tcl/Tk) > > - cross-platform: works on Windows and Unix (on the Mac, there are > currently problems with Tcl/Tk) Anybody aware of what Guido ment here? The path related problems discussed in this SIG in November/December? I've no Mac here at the moment, so I can't check now, whether IDLE will run with the version, after the paths have been manually fixed. But I'm interested to have a working Python/Tcl/Tk combo available for the Mac until April. I'm sure, that I can convince my company to spend some money and effort on this, if this could help to get this working. Regards, Peter -- Peter Funk, Oldenburger Str.86, 27777 Ganderkesee, Tel: 04222 9502 70, Fax: -60 From PClaerhout@CREO.BE Wed Feb 16 11:23:02 2000 From: PClaerhout@CREO.BE (Pieter Claerhout) Date: Wed, 16 Feb 2000 12:23:02 +0100 Subject: [Pythonmac-SIG] Pop-down list in MacPython Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA7111@MSGEURO1> Hello, I just created an app using Python and I want to include a drop-down list in one of the dialogs. I was able to make one with adding a CNTL in ResEdit with an associated menu, but now I have to problems: 1. How do I get the selected item of the list when the user dismisses the dialog box? 2. How do I change the contents of this drop-down list based on a list I get elsewhere? I don't have to change it when the drop-down list when the dialog box is shown, but only before the dialog box is shown. Any ideas on how to do this?? Kind regards, Pieter PClaerhout@creo.be http://chil.webhostme.com/ From just@letterror.com Wed Feb 16 12:12:35 2000 From: just@letterror.com (Just van Rossum) Date: Wed, 16 Feb 2000 13:12:35 +0100 Subject: [Pythonmac-SIG] What about the Tcl/Tk problems? In-Reply-To: Message-ID: At 11:19 AM +0100 16-02-2000, Peter Funk wrote: >Hi! > >Guido posted an official annoucement about IDLE 0.5 to 'comp.lang.python'. >He wrote: >[...] >> IDLE has the following features: >> >> - coded in 100% pure Python, using the Tkinter GUI toolkit (i.e. Tcl/Tk) >> >> - cross-platform: works on Windows and Unix (on the Mac, there are >> currently problems with Tcl/Tk) > >Anybody aware of what Guido ment here? >The path related problems discussed in this SIG in November/December? >I've no Mac here at the moment, so I can't check now, whether IDLE >will run with the >version, after the paths have been manually fixed. > >But I'm interested to have a working Python/Tcl/Tk combo available for >the Mac until April. I'm sure, that I can convince my company to spend >some money and effort on this, if this could help to get this working. I think the main problem is that the Tcl/Tk version shipped with MacPython is too old. Neither Jack nor I have the time to fix this (which is also due to the fact that *we* don't use it...), so if you could help here, that would be Great! The last time I tried to run Idle (which was closer to version 0.4 than to 0.5 at the time) I could easily get it to run by uncommenting one line in Idle, but it still sucked: even the most standard shortcuts (like copy/paste, etc.) were not Mac-like: they used the control key instead of the command key. I don't know if this is Idle's problem or Tk's problem, though. And then there's the fact that the Tk version shipped with MacPython looks very clumsy, and seems to be very unstable. But: I hardly know anything about the Tcl/Tk internals, so I can't help at all. Jack knows quite a bit more, but still, I'm afraid you'd be largely on your own :-(. Just From schliep@zpr.uni-koeln.de Wed Feb 16 12:29:07 2000 From: schliep@zpr.uni-koeln.de (Alexander Schliep) Date: Wed, 16 Feb 2000 13:29:07 +0100 Subject: [Pythonmac-SIG] What about the Tcl/Tk problems? In-Reply-To: Just van Rossum "Re: [Pythonmac-SIG] What about the Tcl/Tk problems?" (Jul 9, 7:48am) References: Message-ID: <10002161329.ZM20319@Twister.MI.Uni-Koeln.DE> On Jul 9, 7:48am, Just van Rossum wrote: > I think the main problem is that the Tcl/Tk version shipped with MacPython > is too old. Neither Jack nor I have the time to fix this (which is also due > to the fact that *we* don't use it...), so if you could help here, that > would be Great! Which would be easier if not Codewarrior ($$$) but MPW was used for building MacPython. Last time I enquired there actually was a reason for that concerning some library (cant search my mail archives right now). Nevertheless it greatly reduces the number of people able to help (e.g., me). Not running Python/Tkinter apps properly straight out of the box is sad, and just one more argument for the "Macs suck" crowd. While I am at it. Could MacPython just please read Unix text files instead of insisting on the silly conversion to the MacOs conventions. The Python on my Windooze box can do it, so it can not be that hard ;) Yours, Alexander -- Alexander Schliep schliep@zpr.uni-koeln.de ZPR/ZAIK Tel: +49-221-470-6040 (w) University of Cologne FAX: +49-221-470-5160 Weyertal 80 http://www.zpr.uni-koeln.de/~schliep 50931 Cologne, Germany From qmay@usa.net Wed Feb 16 13:01:31 2000 From: qmay@usa.net (Quintin May) Date: Wed, 16 Feb 2000 08:01:31 -0500 Subject: [Pythonmac-SIG] Python Drag-and-Drop and events Message-ID: I need to implement drag and drop within an application under development. I've tried the "tkdnd.py" module included in the 1.5.2 distribution. DND works fine within a window using the code in that module, but it's not possible to drag from one window to another (the documentation in the source as well as the design of the demo indicate that this should work). I presume that this demo was developed on a UNIX or PC and that it works there. My debugging indicates that once the mouse pointer moves out of the window in which the drag started, all events stop being sent to the application. The events start being delivered again when the pointer moves back into the window. Most of the DND logic is based in the callback which checks for a new window/widget under the pointer for the drag destination. Without events, no code gets called, and no DND occurs. I've tried using local and global grabs to capture the events, but to no avail. The events just stop being delivered. Has anyone else experienced this, and does anyone have an inter-window/intra-application DND solution for Mac Python? I've seen that wxPython/wxWindows supports DND, but it's not yet available for the Mac. The application being developed needs to be cross platform so going with a Mac-only solution isn't possible. Thanks - Quintin -- Just because something doesn't do what you planned it to do doesn't mean it's useless. - Thomas Edison From pf@artcom-gmbh.de Wed Feb 16 12:49:35 2000 From: pf@artcom-gmbh.de (Peter Funk) Date: Wed, 16 Feb 2000 13:49:35 +0100 (MET) Subject: [Pythonmac-SIG] What about the Tcl/Tk problems? In-Reply-To: from Just van Rossum at "Feb 16, 2000 1:12:35 pm" Message-ID: Hi! First let me thank you for your immediate response. Just van Rossum: > I think the main problem is that the Tcl/Tk version shipped with MacPython > is too old. Neither Jack nor I have the time to fix this (which is also due > to the fact that *we* don't use it...), so if you could help here, that > would be Great! I'm mostly a unix guy and have never done anything serious with the mac myself. However one of my employees owns a Mac and does "something" with it in its spare time. Unfortunately I have absolutely no imagination what will be needed to build Python and Tcl/Tk on the mac. I've never heard of CW-Pro files before. I guess the mac build process is not only a ½ hour task like as it was for me on Solaris and IRIX, where building a Python binary package was very simple: I simply had to choose the right --prefix for configure, edit Modules/Setup a little and then run make, make install and finally only had to hack in a tiny installer shell script, which creates some symlinks under /usr/local/bin /usr/local/lib .... So first a Mac software shopping list (Compiler, packager, ...) would help me lot. > The last time I tried to run Idle (which was closer to version 0.4 than to > 0.5 at the time) I could easily get it to run by uncommenting one line in > Idle, but it still sucked: even the most standard shortcuts (like > copy/paste, etc.) were not Mac-like: they used the control key instead of > the command key. This can (and should) be fixed. Doug Hellmann has done something similar in his 'PmwContribD.GuiAppD' package: if sys.platform == 'mac': accelerator_prefix = 'Command' elif sys.platform == 'win32': accelerator_prefix = 'Control' else: accelerator_prefix = 'Control' > I don't know if this is Idle's problem or Tk's problem, > though. That depends. Since Tk doesn'nt provides this kind of platform abstraction, it must be done at the python level. This would be easy to add, since 'IDLE' already contains two different key definition dictionaries for windows and unix in the module 'keydefs.py'. Adding a third for the mac looks straightforward. > And then there's the fact that the Tk version shipped with > MacPython looks very clumsy, and seems to be very unstable. > But: I hardly > know anything about the Tcl/Tk internals, so I can't help at all. Jack > knows quite a bit more, but still, I'm afraid you'd be largely on your own > :-(. May be someone else listening to this group here is interested in earning some money by solving this? Regards, Peter -- Peter Funk, Oldenburger Str.86, 27777 Ganderkesee, Tel: 04222 9502 70, Fax: -60 From just@letterror.com Wed Feb 16 13:31:09 2000 From: just@letterror.com (Just van Rossum) Date: Wed, 16 Feb 2000 14:31:09 +0100 Subject: [Pythonmac-SIG] Python Drag-and-Drop and events In-Reply-To: Message-ID: At 8:01 AM -0500 16-02-2000, Quintin May wrote: >Has anyone else experienced this, and does anyone have an >inter-window/intra-application DND solution for Mac Python? I've seen that >wxPython/wxWindows supports DND, but it's not yet available for the Mac. I don't think that's true: I've seen a page dedicated to wxWindows on Mac. I forgot where it is, and I have no clue how mature it is. I guess if wxWindows for Mac works, porting wxPython to Mac would not be that hard. Just From just@letterror.com Wed Feb 16 13:29:29 2000 From: just@letterror.com (Just van Rossum) Date: Wed, 16 Feb 2000 14:29:29 +0100 Subject: [Pythonmac-SIG] What about the Tcl/Tk problems? In-Reply-To: <10002161329.ZM20319@Twister.MI.Uni-Koeln.DE> References: Just van Rossum "Re: [Pythonmac-SIG] What about the Tcl/Tk problems?" (Jul 9, 7:48am) Message-ID: At 1:29 PM +0100 16-02-2000, Alexander Schliep wrote: >On Jul 9, 7:48am, Just van Rossum wrote: >> I think the main problem is that the Tcl/Tk version shipped with MacPython >> is too old. Neither Jack nor I have the time to fix this (which is also due >> to the fact that *we* don't use it...), so if you could help here, that >> would be Great! > >Which would be easier if not Codewarrior ($$$) but MPW was used for >building MacPython. Last time I enquired there actually was a reason >for that concerning some library (cant search my mail archives right now). > >Nevertheless it greatly reduces the number of people able to help (e.g., me). Nevertheless nor Jack nor I have the time to add MPW support for MacPython. If *you* could contirbute that, that would of course be excellent. >Not running Python/Tkinter apps properly straight out of the box is sad, and >just one more argument for the "Macs suck" crowd. Hold it right there: the fact that it doesn't work well is *not* because Macs suck, but because Mac support for Tk is weak. If people misinterpret the weak Tk support on the Mac as "Macs suck", well, that's really not my problem. >While I am at it. Could MacPython just please read Unix text files instead >of insisting on the silly conversion to the MacOs conventions. The Python >on my Windooze box can do it, so it can not be that hard ;) If it's so easy: go right ahead! (Complaining doesn't get you very far in the open source world: you get what you pay for.) Just From just@letterror.com Wed Feb 16 13:35:48 2000 From: just@letterror.com (Just van Rossum) Date: Wed, 16 Feb 2000 14:35:48 +0100 Subject: [Pythonmac-SIG] What about the Tcl/Tk problems? In-Reply-To: References: from Just van Rossum at "Feb 16, 2000 1:12:35 pm" Message-ID: At 1:49 PM +0100 16-02-2000, Peter Funk wrote: >I'm mostly a unix guy and have never done anything serious with the mac >myself. However one of my employees owns a Mac and does "something" >with it in its spare time. Unfortunately I have absolutely no imagination >what will be needed to build Python and Tcl/Tk on the mac. I've never >heard of CW-Pro files before. > >I guess the mac build process is not only a =BD hour task like as >it was for me on Solaris and IRIX, where building a Python binary >package was very simple: I simply had to choose the right --prefix >for configure, edit Modules/Setup a little and then run make, make >install and finally only had to hack in a tiny installer shell script, >which creates some symlinks under /usr/local/bin /usr/local/lib .... > >So first a Mac software shopping list (Compiler, packager, ...) would >help me lot. Metrowerks CodeWarrior Pro version 5 is needed to compile MacPython. Building is not as smooth as it could be, but it's not that hard either. And you only have to set it up once: from that point on it's no big deal anymore. Just hit "Make" in CodeWarrior... >This can (and should) be fixed. Doug Hellmann has >done something similar in his 'PmwContribD.GuiAppD' package: > > if sys.platform =3D=3D 'mac': > accelerator_prefix =3D 'Command' > elif sys.platform =3D=3D 'win32': > accelerator_prefix =3D 'Control' > else: > accelerator_prefix =3D 'Control' Ok, that's a useful suggestion for Guido. >May be someone else listening to this group here is interested in >earning some money by solving this? Wow, that's fantastic! Thank you very much for this. I hope someone will step up and do this, and Jack and I will try our best to give additional support. Just From PClaerhout@CREO.BE Wed Feb 16 13:38:58 2000 From: PClaerhout@CREO.BE (Pieter Claerhout) Date: Wed, 16 Feb 2000 14:38:58 +0100 Subject: [Pythonmac-SIG] Python Drag-and-Drop and events Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA7112@MSGEURO1> Hi, I'm subscribed to the wxPython mailing list, and the guy who is responsible for the wxPython distribution, Robin Dunn, is willing to port wxPython to the mac, but he doesn't have a mac to compile it on. He has however, if I'm not mistaking, a copy of CodeWarrior. So maybe someone can help over here? I would really love it when someone stepped forward, and helped Robin to port wxPython to the mac. Kind regards, Pieter PClaerhout@creo.be http://chill.webhostme.com/ -----Original Message----- From: Just van Rossum [mailto:just@letterror.com] Sent: Wednesday, February 16, 2000 2:31 PM To: Quintin May; pythonmac-sig@python.org Subject: Re: [Pythonmac-SIG] Python Drag-and-Drop and events At 8:01 AM -0500 16-02-2000, Quintin May wrote: >Has anyone else experienced this, and does anyone have an >inter-window/intra-application DND solution for Mac Python? I've seen that >wxPython/wxWindows supports DND, but it's not yet available for the Mac. I don't think that's true: I've seen a page dedicated to wxWindows on Mac. I forgot where it is, and I have no clue how mature it is. I guess if wxWindows for Mac works, porting wxPython to Mac would not be that hard. Just _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://www.python.org/mailman/listinfo/pythonmac-sig From etienne@alias.it Wed Feb 16 15:45:20 2000 From: etienne@alias.it (Etienne Antoniutti Di Muro) Date: Wed, 16 Feb 2000 16:45:20 +0100 Subject: [Pythonmac-SIG] tricky cPickling Message-ID: <38AAC610.86BBBB6E@alias.it> List members, hello there !! recently I have encountered some problems using cPickle.load function. Here it comes: I do have two methods in a class (myclass.save(filename) and myclass.load(filename)), each one is devoted to its obvious task, using cPickle module. myclass.save(filename) works properly, saving three cPickable objects, say 'ss', 'pa' and 'rm'.Well, not quite simple ones, indeed (dumped file is about 600K large)!! myclass.load(filename) excepts some problems, as follows (note, it just calls cPiclkle.load(file))!!! :-(( The firts Error encountered is a NameError with an object used by 'ss', as if python is unable to load the module that object, comes from. Yes, I know, I do explicitly import that module before loading 'ss' with cPickle, but why does cPickle not find that module on its own? More Troublesome is that I have different behaviours of the Python interpreter, according how i call the script that does the cPickle loading action: I think this is due to different exception management, i.e: 1_ making my script an applet NO exception is raised; 2_ ruinning the script from the Python interactive window, it raises the NameErroer exception mentioned above; 3 _the same script DOES NOT run from IDE menu File -> open -> 'myscript.py' -> "Run All" 4 _Most important, cause it is where i do really need it working, my module does not work in a C function call, in which I embedded myclass.load(filename) !! At last but not at least i'm wondering why I get quite frequently MemoryErrors running cPiclke methods. thanks for support etienne From just@letterror.com Wed Feb 16 16:13:23 2000 From: just@letterror.com (Just van Rossum) Date: Wed, 16 Feb 2000 17:13:23 +0100 Subject: [Pythonmac-SIG] tricky cPickling In-Reply-To: <38AAC610.86BBBB6E@alias.it> Message-ID: Erm, I can't really follow what you're trying to, and since you didn't post real code nor real tracebacks it's hard to guess... Is this what you want to do: class MyStuff: def save(self, filename): f = open(filename, "wb") cPickle.dump(f, self) f.close() def load(filename): f = open(filename, "rb") obj = cPickle.load(f) f.close() return obj ? About the file size and MemoryErrors: maybe your objects have attributes that get pickled along with the main object, but you don't really want them to be pickled? (Ie. references to objects that your implementation needs but are not part of the data itself.) In that case you need to customize the pickle behavior by adding __getstate__() and __setstate__() methods to your class. You should be able to find documentation for that in the library reference, under pickle. Hope this helps, Just From jack@oratrix.nl Wed Feb 16 16:49:32 2000 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 16 Feb 2000 17:49:32 +0100 Subject: [Pythonmac-SIG] Pop-down list in MacPython In-Reply-To: Message by Pieter Claerhout , Wed, 16 Feb 2000 12:23:02 +0100 , <2B1262E83448D211AE4B00A0C9D61B03BA7111@MSGEURO1> Message-ID: <20000216164933.78766371868@snelboot.oratrix.nl> > Hello, > > I just created an app using Python and I want to include a > drop-down list in one of the dialogs. I was able to make > one with adding a CNTL in ResEdit with an associated menu, > but now I have to problems: > > 1. How do I get the selected item of the list when the user > dismisses the dialog box? > > 2. How do I change the contents of this drop-down list based > on a list I get elsewhere? I don't have to change it when the > drop-down list when the dialog box is shown, but only before > the dialog box is shown. Pieter, all this is pretty hairy if you use Pre-Appearance calls: you create a popup menu (see FrameWork for an example) and then you stuff this menu into the control (Inside Mac has the details on this). I forget whether you have to stuff only the Menu ID, only the Menu Handle or both, but I do remember that this is important. Fortunately all this has become a lot simpler with Appearance. If you run MacPython from the CVS archive you can have appearance support now, otherwise you'll have to wiat for another 1-2 months until I finally find the time to do a new distribution. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From jack@oratrix.nl Wed Feb 16 16:57:12 2000 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 16 Feb 2000 17:57:12 +0100 Subject: [Pythonmac-SIG] What about the Tcl/Tk problems? In-Reply-To: Message by pf@artcom-gmbh.de (Peter Funk) , Wed, 16 Feb 2000 13:49:35 +0100 (MET) , Message-ID: <20000216165712.6660C371868@snelboot.oratrix.nl> > I guess the mac build process is not only a =BD hour task like as > it was for me on Solaris and IRIX, where building a Python binary > package was very simple: I simply had to choose the right --prefix > for configure, edit Modules/Setup a little and then run make, make > install and finally only had to hack in a tiny installer shell script, > which creates some symlinks under /usr/local/bin /usr/local/lib .... > = > So first a Mac software shopping list (Compiler, packager, ...) would = > help me lot. The only thing you need to buy is CodeWarrior. The current release is 5.3= , you = can probably buy 5 and upgrade it to 5.3 over the net. Next you'll need some working knowledge of Tcl/Tk, Mac programming and Py= thon = programming (mainly mac-programming), this should get you as far as build= ing = Tcl/Tk for the Mac. Finally you'll need quite a bit of patience as you pi= ck my = brain to find out how I tied Tcl/Tk into Python. The main problem is tyin= g the = I/O systems (and, hence, the event loops) together. Maybe what I did for = the = previous release of tcl/tk still works, but so far they've radically chan= ged = their I/O system every single release (sigh). -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++= Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig = ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.= htm = From dgreen@rewindtech.com Wed Feb 16 20:49:13 2000 From: dgreen@rewindtech.com (Dan Green) Date: Wed, 16 Feb 2000 15:49:13 -0500 Subject: [Pythonmac-SIG] MiniAEFrame Message-ID: <20000216154913.A31614@brainy.rewindtech.com> Hey, folks. MiniAEFrame exhibits some slightly rude behavior: starting @ line 128 if _parameters.has_key('----'): _object = _parameters['----'] del _parameters['----'] try: rv = apply(_function, (_object,), _parameters) except TypeError, name: raise TypeError, ('AppleEvent handler misses formal keyword argument', _function, name) else: try: rv = apply(_function, (), _parameters) except TypeError, name: raise TypeError, ('AppleEvent handler misses formal keyword argument', _function, name) Catching TypeError just before issuing a callback is pretty mean, since a bunch of syntax errors I was making in my code was being caught by that exception. Just food for thought. -- Dan Green | pick yourself up off the side of the road with your Developer | elevator bones and your whip-flash tones / members only, Rewind Technologies | hypnotizers move through the room like ambulance drivers From jack@oratrix.nl Wed Feb 16 21:02:46 2000 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 16 Feb 2000 22:02:46 +0100 Subject: [Pythonmac-SIG] MiniAEFrame In-Reply-To: Message by Dan Green , Wed, 16 Feb 2000 15:49:13 -0500 , <20000216154913.A31614@brainy.rewindtech.com> Message-ID: <20000216210251.CAD13D71E1@oratrix.oratrix.nl> Recently, Dan Green said: > Hey, folks. > MiniAEFrame exhibits some slightly rude behavior: > [code removed] > > Catching TypeError just before issuing a callback is pretty mean, since a > bunch of syntax errors I was making in my code was being caught by that > exception. Whatever you do here, it is always wrong:-( This code is executed in a callback from the main eventloop, so if there is no try/except clause then it will fail silently, without any stacktrace, and with the rest of the program happily continuing. This is a standard problem with Python callbacks, and one that won't be fixed until Guido puts his blessing on stackless Python, or at least some way to make an exception forwardable (and representable) across the C stack. And the missing keyword argument is so common that it needs special handling: you can send appleevents with any keyword you want to a Python script, so you definitely want some indication that this is happening. But, of course, better ideas on how to handle this are always welcome, -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From cwebster@nevada.edu Wed Feb 16 21:08:38 2000 From: cwebster@nevada.edu (Corran Webster) Date: Wed, 16 Feb 2000 13:08:38 -0800 Subject: [Pythonmac-SIG] What about the Tcl/Tk problems? In-Reply-To: References: <10002161329.ZM20319@Twister.MI.Uni-Koeln.DE> Just van Rossum "Re: [Pythonmac-SIG] What about the Tcl/Tk problems?" (Jul 9, 7:48am) Message-ID: > At 1:29 PM +0100 16-02-2000, Alexander Schliep wrote: > >On Jul 9, 7:48am, Just van Rossum wrote: > >> I think the main problem is that the Tcl/Tk version shipped with MacPython > >> is too old. Neither Jack nor I have the time to fix this (which is >also due > >> to the fact that *we* don't use it...), so if you could help here, that > >> would be Great! > > > >Which would be easier if not Codewarrior ($$$) but MPW was used for > >building MacPython. Last time I enquired there actually was a reason > >for that concerning some library (cant search my mail archives right now). > > > >Nevertheless it greatly reduces the number of people able to help (e.g., >me). > > Nevertheless nor Jack nor I have the time to add MPW support for MacPython. > If *you* could contirbute that, that would of course be excellent. This might be time to mention my notes at: http://www.nevada.edu/~cwebster/Python/MPWHOWTO/MPWHOWTO.html which at least get you running extensions to python using MPW (linking into the regular PythonCore from the distribution). I haven't tried it, but if you had a recent version of the Mac distribution of Tcl/Tk, it should be possible to compile _tkinter to link to both the Python core and the Tcl/Tk shared libraries, aand so you may be able to get a new version of Tkinter without having to go through the pain of an MPW-based conversion of both Python and Tcl/Tk. That said, it's not inconceivable that a Python MPW tool can be written - I experimented with this last year and got it to compile and link, but file system support was out of whack (couldn't import modules) and I ran out of time to work on it. Getting it to interact nicely with MPW SIOW may be a bit more work, but there is, I believe, some support already in there from way back when. Hopefully I'll have some time to look at this again in the next litle while. Regards, Corran From cwebster@nevada.edu Mon Feb 21 18:28:32 2000 From: cwebster@nevada.edu (Corran Webster) Date: Mon, 21 Feb 2000 10:28:32 -0800 Subject: [Pythonmac-SIG] Distutils for Mac Message-ID: This weekend I had a bit of a play with the distribution utilities from the distutils sig - no more than making it able to install and compile .py files and put them in the right places, although I had a good long think about how to fit mac-based compilers into their system and it seems possible given a bit of messing around with Apple Events. But before taking this on in a more serious way, I wanted to check if anyone else has been working on it. I think that this is an important thing for the macintosh port to be involved with. Makining it easier for Unix and Windows-based developers to make their projects available for the macintosh would be a big plus, as would a mechanism which makes it easier for us to distribute binary distributions of extensions amongst ourselves. Regards, Corran From tom@sz-sb.de Tue Feb 22 15:42:54 2000 From: tom@sz-sb.de (Tom) Date: Tue, 22 Feb 2000 16:42:54 +0100 Subject: [Pythonmac-SIG] Closing the sioux console?? Message-ID: <38B2AE7C.82BD49F9@sz-sb.de> I spent a few hours trying to find documentation on closing the sioux window, to be able to continue solely with tk. How can i do this on the Mac? I really didn't find any good hints - is this anywhere documented????? tia Tom From jack@oratrix.nl Tue Feb 22 16:06:26 2000 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 22 Feb 2000 17:06:26 +0100 Subject: [Pythonmac-SIG] Closing the sioux console?? In-Reply-To: Message by Tom , Tue, 22 Feb 2000 16:42:54 +0100 , <38B2AE7C.82BD49F9@sz-sb.de> Message-ID: <20000222160626.95242371868@snelboot.oratrix.nl> > > I spent a few hours trying to find documentation on closing > the sioux window, to be able to continue solely with tk. How > can i do this on the Mac? > I really didn't find any good hints - is this anywhere documented????? I don't think you can do that, at least not from Python. What you can do is make sure the console isn't opened, by using the "delay console window until needed" option on the applet, and not writing to stdout (or redirecting it to some place safe) or reading from stdin. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From nika@kassube.de Tue Feb 22 17:16:25 2000 From: nika@kassube.de (Nils Kassube) Date: Tue, 22 Feb 2000 18:16:25 +0100 Subject: [Pythonmac-SIG] Gadfly Message-ID: Guten Abend. Is anyone here using Gadfly on Mac OS? | >>> import gadfly | Traceback (innermost last): | File "", line 1, in ? | File "Macintosh HD:Programme:Python 1.5.2c1:kwP:gadfly.py", line 5, in ? | sql = sqlgen.getSQL() | File "Macintosh HD:Programme:Python 1.5.2c1:kwP:sqlgen.py", line 77, in getSQL | return reloadSQLG(filename) | File "Macintosh HD:Programme:Python 1.5.2c1:kwP:sqlgen.py", line 69, in reloadSQLG | infile = open(filename, "rb") | IOError: [Errno 22] Invalid argument: 'D:\\downloads\\kwParsing\\sql.mar' Cheers, Nils -- nika@kassube.de (preferred) 4kassube@informatik.uni-hamburg.de From savageb@pacbell.net Tue Feb 22 22:39:26 2000 From: savageb@pacbell.net (Bob Savage) Date: Tue, 22 Feb 2000 14:39:26 -0800 Subject: [Pythonmac-SIG] Gadfly In-Reply-To: Message-ID: on 2/22/00 9:16 AM, Nils Kassube wrote: > | IOError: [Errno 22] Invalid argument: 'D:\\downloads\\kwParsing\\sql.mar' > Hi, sorry it took me so long to get back to you on this. What you need to do is double-click on the file "gfinstall.py". That creates the "sql.mar" file so you should then be all set. Bob From dgoodger@bigfoot.com Wed Feb 23 21:45:54 2000 From: dgoodger@bigfoot.com (David Goodger) Date: Wed, 23 Feb 2000 16:45:54 -0500 Subject: [Pythonmac-SIG] pythondoc on mac; multi-platform file names Message-ID: I am attempting to use Daniel Larsson's pythondoc (http://starship.python.net/crew/danilo/pythondoc/) on MacOS, and am running into trouble. Pythondoc wants to create files with names like 'module.class.html'. When the total is over 31 characters (Mac's filename length limit), pythondoc fails. I could hack the code to make it work, but I'd rather do something general which could be included in the next release. Also, there are inter-file cross references to consider. 1. Has anyone else successfully used pythondoc on MacOS, perhaps with modifications? If so, I'd like to see any modifications, or at least hear how you got around the OS problems. 2. Is there a general-purpose file naming utility module for Python which gets around the limitations of various operating systems? Perhaps something that checks the validity of a name, or creates a unique name (for a specified directory) based on the input. Mac files can have spaces & puntuation (except colon ':') in their names, but are limited to 31 characters. DOS (does anyone still use DOS? :-) is 8.3. Unix & Windows have their own (hard or soft) rules. I like Python for its multi-platform capabilities (among many other aspects). This type of utility would make multi-platform programming that much easier. Thanks. -- David Goodger dgoodger@bigfoot.com From tom@sz-sb.de Fri Feb 25 15:33:45 2000 From: tom@sz-sb.de (Tom) Date: Fri, 25 Feb 2000 16:33:45 +0100 Subject: [Pythonmac-SIG] Applets and an extended python Message-ID: <38B6A0D8.83BD4CAE@sz-sb.de> Hello, i still have problems using python without console window. Using the binary distribution for the Mac i have no problem creating Applets, but what i need ist an Applet that uses the Phyton-interpreter i have created. What steps do i have to go through? I didn't find anything in the dokumentation and looking through the source seems a bit too much to me :) cu Tom From jack@oratrix.nl Fri Feb 25 16:08:28 2000 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 25 Feb 2000 17:08:28 +0100 Subject: [Pythonmac-SIG] Applets and an extended python In-Reply-To: Message by Tom , Fri, 25 Feb 2000 16:33:45 +0100 , <38B6A0D8.83BD4CAE@sz-sb.de> Message-ID: <20000225160828.AB03C371868@snelboot.oratrix.nl> > > Hello, > > i still have problems using python without console window. Using the binary > distribution for the Mac i have no problem creating Applets, but what i need > ist an Applet that uses the Phyton-interpreter i have created. What > steps do > i have to go through? I didn't find anything in the dokumentation and looking > through the source seems a bit too much to me :) I'm not sure what you mean by "the Python interpreter I have created", but if you mean that you've built a static Python interpreter (probably with your own extension modules or so) what you want is doable. The main program (which is in macapplication.c) is the same for PythonInterpreter and applets (actually, the BuildApplet simply uses the PythonInterpreter executable to build applets). It checks for a 'PYC ' resource named '__main__' in the application resource fork, and if it finds that it goes in applet-mode otherwise in application-mode. So by copying the PYC resource from an applet to your application you have an applet that uses your application as the interpreter. If people want to do this more often I could add an option to BuildApplet where it wouldn't always use PythonInterpreter to build applets but where you could ask it to use a different file. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From PClaerhout@CREO.BE Mon Feb 28 12:41:27 2000 From: PClaerhout@CREO.BE (Pieter Claerhout) Date: Mon, 28 Feb 2000 13:41:27 +0100 Subject: [Pythonmac-SIG] Moving files Message-ID: <2B1262E83448D211AE4B00A0C9D61B03BA7160@MSGEURO1> Hi, is there a function available in Python to move a file from one directory to another? Kind regards, P. From joanca@typerware.com Mon Feb 28 12:27:34 2000 From: joanca@typerware.com (JoanCarles p Casas=?ISO-8859-1?Q?=edn?=) Date: Mon, 28 Feb 2000 14:27:34 +0200 Subject: [Pythonmac-SIG] Moving files Message-ID: <20000228132544.C8B4C1CD20@dinsdale.python.org> Pieter Claerhout wrote: >Hi, > >is there a function available in Python to move a file >from one directory to another? import findertools findertools.move(file_or_folder, destination_folder) Hope this helps, JoanCarles :::!!!::: joanca@typerware.com http://www.typerware.com From erik@letterror.com Mon Feb 28 14:19:03 2000 From: erik@letterror.com (Erik van Blokland) Date: Mon, 28 Feb 2000 15:19:03 +0100 Subject: [Pythonmac-SIG] Moving files Message-ID: <200002281423.PAA14538@leidschenveen.denhaag.dataweb.net> -- JoanCarles p Casas=EDn [2/28/00 1:27 PM]: >>Hi, >> >>is there a function available in Python to move a file >>from one directory to another? > >import findertools > >findertools.move(file_or_folder, destination_folder) this one is faster: import os srcpath =3D 'the:old:location.txt' # fill in your paths here! dstpath =3D 'the:new:location.txt' os.renames(srcpath, dstpath) findertools instructs the Finder via appleevents to move the files. When you're moving a lot the AE mechanims gets clogged and cause the Finder the protest/crash. os.renames just changes the directory directly. erik van blokland -- letterror From just@letterror.com Mon Feb 28 16:24:37 2000 From: just@letterror.com (Just van Rossum) Date: Mon, 28 Feb 2000 17:24:37 +0100 Subject: [Pythonmac-SIG] Moving files In-Reply-To: <200002281423.PAA14538@leidschenveen.denhaag.dataweb.net> Message-ID: At 3:19 PM +0100 28-02-2000, Erik van Blokland wrote: >import os >srcpath = 'the:old:location.txt' # fill in your paths here! >dstpath = 'the:new:location.txt' >os.renames(srcpath, dstpath) Or os.rename() (without trailing s). os.renames() creates folders if needed and deletes folders which are left empty, so be careful with that. Just From fear@technologist.com Mon Feb 28 17:50:13 2000 From: fear@technologist.com (Chris Jacobson) Date: Mon, 28 Feb 2000 11:50:13 -0600 Subject: [Pythonmac-SIG] GUSI2... status/etc? Message-ID: <200002281750.MAA17945@pop05.iname.net> Whats the status on getting it over to GUSI2? I'd like to get at the source & projects that already has whatever work is done, to help. (why rewrite the blueprints?) - Chris Jacobson From Max.Haas@unibas.ch Tue Feb 29 07:43:36 2000 From: Max.Haas@unibas.ch (Max Haas) Date: Tue, 29 Feb 2000 08:43:36 +0100 Subject: [Pythonmac-SIG] Nested lists Message-ID: <01JMH2D20U368Y0UZ3@ubaclu.unibas.ch> Hi, ask for help for a newbie question (can't find the starting point for a solution) Question: I need some void lists, e.g. map(lambda x:[] * 6, range(6)) Works fine. When I try to implement this in a function I get something like: def mklist(num): return map(lambda x:[] * num, range(num)) and mklist(4) yields [[], [], [], [], [], []] This works in 'Python interactive'. In a normal Python window I get a NameError. I can't figure out the basic difference between the behaviour of 'Python interactive' and a 'normal' Python window. Any help much appreciated. Max From jack@oratrix.nl Tue Feb 29 09:50:07 2000 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 29 Feb 2000 10:50:07 +0100 Subject: [Pythonmac-SIG] Nested lists In-Reply-To: Message by Max Haas , Tue, 29 Feb 2000 08:43:36 +0100 , <01JMH2D20U368Y0UZ3@ubaclu.unibas.ch> Message-ID: <20000229095046.F35F2371868@snelboot.oratrix.nl> > When I try to implement this in a function I get something like: > > def mklist(num): > return map(lambda x:[] * num, range(num)) > > and mklist(4) yields [[], [], [], [], [], []] > > This works in 'Python interactive'. In a normal Python window I get a NameError. This is bound to be in an FAQ somewhere: the lambda has its own namespace, i.e. within the lambda body you can see (1) names within that body and (2) global names. So, you can't see the names in the intermedeate function. The workaround is to abuse the parameter mechanism: def mklist(num): return map(lambda x, num=num: []*num, range(num)) -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From nika@kassube.de Tue Feb 29 16:40:43 2000 From: nika@kassube.de (Nils Kassube) Date: Tue, 29 Feb 2000 17:40:43 +0100 Subject: [Pythonmac-SIG] os.path.getsize() In-Reply-To: <200002281423.PAA14538@leidschenveen.denhaag.dataweb.net> Message-ID: Guten Abend. I hope, I don't miss something obvious again :-) --cut-- >>> import os.path >>> os.path.getsize("a.py") Traceback (innermost last): File "", line 1, in ? File "Macintosh HD:Programme:Python 1.5.2c1:Lib:macpath.py", line 107, in getsize return st[stat.ST_SIZE] NameError: stat --cut-- What's wrong? It worked on Win32. Cheers, Nils -- nika@kassube.de (preferred) 4kassube@informatik.uni-hamburg.de From joanca@typerware.com Tue Feb 29 17:19:11 2000 From: joanca@typerware.com (JoanCarles p Casas=?ISO-8859-1?Q?=edn?=) Date: Tue, 29 Feb 2000 18:19:11 +0100 Subject: [Pythonmac-SIG] os.path.getsize() Message-ID: <20000229171722.6504A1CD9C@dinsdale.python.org> Nils Kassube wrote: >Guten Abend. > >I hope, I don't miss something obvious again :-) >--cut-- >>>> import os.path >>>> os.path.getsize("a.py") >Traceback (innermost last): > File "", line 1, in ? > File "Macintosh HD:Programme:Python 1.5.2c1:Lib:macpath.py", line 107, >in getsize > return st[stat.ST_SIZE] >NameError: stat >--cut-- Many many time ago Jack Jansen answered this question to me: ---------------------------------- Jack Jansen: There are a few ways to do this, depending on what you're interested in. If you want to get the size of the data fork only the best method is os.stat(). The sixth value is the size of the data fork. This method is portable to other platforms. If you want the full size use os.xstat(). rv[6] is again data fork size, rv[10] is the resource fork size. xstat is mac-specific. You can also use the GetFInfo() method of a macfs.FSSpec object, if that is handier. Again, mac-specific. Note that all these methods give you the number of bytes in the file, *not* the amount of space it occupies on disk (the finder info command gives both). Does anyone know how to obtain the diskspace numbers? ---------------------------------- >What's wrong? It worked on Win32. You're now using a Mac! ;) JoanCarles :::!!!::: joanca@typerware.com http://www.typerware.com From lists@kassube.de Tue Feb 29 19:13:39 2000 From: lists@kassube.de (Nils Kassube) Date: Tue, 29 Feb 2000 20:13:39 +0100 Subject: [Pythonmac-SIG] Re: os.path.getsize() In-Reply-To: Message-ID: Joan Carles p Casas=EDn wrote: > is os.stat(). The sixth value is the size of the data fork. This > method is portable to other platforms. Well, it's actually the 7th value because we start counting with 0.=20 Yes, os.stat("a.py")[6] works.=20 I found the problem in macpath.py: You have to change the line "from stat import *" to "import stat". Is this fixed in the current CVS version? I use release 1.5.2c1. =20 > You're now using a Mac! ;) I'm not sure if it's worth investing time to work around the problems with the Mac OS <=3D9 implementation when the BSD-based Mac OS X is expected to be available this summer. Maybe then it's possible to build a cross-platform GUI app also for the=20 Mac platform, not only for Unix/X11 and Win32. Cheers, Nils -- nika@kassube.de (preferred) 4kassube@informatik.uni-hamburg.de From peter.sommerfeld@gmx.de Tue Feb 29 22:37:42 2000 From: peter.sommerfeld@gmx.de (Peter Sommerfeld) Date: Tue, 29 Feb 2000 23:37:42 +0100 Subject: [Pythonmac-SIG] os.path.getsize() In-Reply-To: Message-ID: Nils Kassube wrote: > Guten Abend. Good evening :-) > I hope, I don't miss something obvious again :-) The obvious seems to be that os.stat is not defined on Mac. (You know, think differently :-). os.stat is part of the posix standart. Use Mac-Toolbox functions instead. Gruesse aus Lueneburg Peter BTW: Use the IDE in debug mode and you'll find out things like this easily. Type it in a new window, check "run as main" and "enable debugger", set a breakpoint and hit cmd-R. > --cut-- >>>> import os.path >>>> os.path.getsize("a.py") > Traceback (innermost last): > File "", line 1, in ? > File "Macintosh HD:Programme:Python 1.5.2c1:Lib:macpath.py", line 107, in > getsize > return st[stat.ST_SIZE] > NameError: stat > --cut-- > > What's wrong? It worked on Win32. > > Cheers, > Nils > -- > nika@kassube.de (preferred) > 4kassube@informatik.uni-hamburg.de > > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://www.python.org/mailman/listinfo/pythonmac-sig > From jack@oratrix.nl Tue Feb 29 22:44:24 2000 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 29 Feb 2000 23:44:24 +0100 Subject: [Pythonmac-SIG] os.path.getsize() In-Reply-To: Message by Peter Sommerfeld , Tue, 29 Feb 2000 23:37:42 +0100 , Message-ID: <20000229224430.23B26191AA0@oratrix.oratrix.nl> This is a bug in macpath.py. It's fixed in the CVS archive, and the fix will be in the next release. As I didn't fix (or break:-) this I think a possible workaround may be to add an "import stat" to the top of macpath.py. But of course the comments about getsize() maybe not returning the info you're looking for is true too, -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm