From Jack.Jansen@cwi.nl Mon Sep 2 10:14:06 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 02 Sep 1996 11:14:06 +0200 Subject: [PYTHONMAC-SIG] Python + PaperPort? In-Reply-To: Message by guzdial@cc.gatech.edu (Mark Guzdial) , Fri, 30 Aug 1996 18:11:57 -0400 (EDT) , Message-ID: <9609020914.AA28027=jack@schelvis.cwi.nl> > Does anybody else using Python on the Mac have a PaperPort? Again with > 1.4b3 (as with 1.3.3) when I tried to run MkPluginAliases, I got: > > Traceback (innermost last): > File "flap:jack:Python:Mac:scripts:MkPluginAliases.py", line 11, in ? > ImportError: No module named os > > I decided to try it with no extensions today, and everything > worked fine! 11 restarts after fiddling with extensions later, it comes > down to the Paperport control panel. If it's loaded, I can't run Python; > if it isn't, everything's fine. The error message seems to point at a problem with STR# resource 129, where sys.path is stored. If the Paperport software somehow puts a new resource 129 somewhere in the system resources Python will see this during startup and attempt to use it as initialization for sys.path. I don't know of an easy fix, if this is indeed the problem. For the next release I will access the "global" resources by name in stead of by number. Hmm, on second hands I *do* know a workaround. Start Python with extensions off, and let it create the preferences file. With ResEdit, open the preferences file and the interpreter, and copy STR# 128 from the preferences file to the interpreter as STR# 129. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From just@knoware.nl Mon Sep 2 14:55:47 1996 From: just@knoware.nl (Just van Rossum) Date: Mon, 2 Sep 1996 15:55:47 +0200 Subject: [PYTHONMAC-SIG] Python + PaperPort? Message-ID: At 11:14 AM 9/2/96, Jack Jansen wrote: >> Does anybody else using Python on the Mac have a PaperPort? Again with >> 1.4b3 (as with 1.3.3) when I tried to run MkPluginAliases, I got: >> >> Traceback (innermost last): >> File "flap:jack:Python:Mac:scripts:MkPluginAliases.py", line 11, in ? >> ImportError: No module named os >> >> I decided to try it with no extensions today, and everything >> worked fine! 11 restarts after fiddling with extensions later, it comes >> down to the Paperport control panel. If it's loaded, I can't run Python; >> if it isn't, everything's fine. > >The error message seems to point at a problem with STR# resource 129, where >sys.path is stored. If the Paperport software somehow puts a new resource 129 >somewhere in the system resources Python will see this during startup and >attempt to use it as initialization for sys.path. > >I don't know of an easy fix, if this is indeed the problem. For the next >release I will access the "global" resources by name in stead of by number. > >Hmm, on second hands I *do* know a workaround. Start Python with extensions >off, and let it create the preferences file. With ResEdit, open the >preferences file and the interpreter, and copy STR# 128 from the preferences >file to the interpreter as STR# 129. If thats's indeed the problem, wouldn't it be easier to check for a STR# nr. 129 with Get1Resource(), to make sure only the current res file is searched? Just ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Mon Sep 2 15:23:24 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 02 Sep 1996 16:23:24 +0200 Subject: [PYTHONMAC-SIG] Python + PaperPort? In-Reply-To: Message by just@knoware.nl (Just van Rossum) , Mon, 2 Sep 1996 15:55:47 +0200 , Message-ID: <9609021423.AA00109=jack@schelvis.cwi.nl> > >Hmm, on second hands I *do* know a workaround. Start Python with extensions > >off, and let it create the preferences file. With ResEdit, open the > >preferences file and the interpreter, and copy STR# 128 from the preferences > >file to the interpreter as STR# 129. > > If thats's indeed the problem, wouldn't it be easier to check for a STR# nr. 129 > with Get1Resource(), to make sure only the current res file is searched? This is difficult, since the application is not the "topmost" resource file anymore by the time this code gets executed (the shared library has also been added to the resource file chain). Finding the application file to open it again would be rather cumbersome. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Wed Sep 4 13:03:35 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 04 Sep 1996 14:03:35 +0200 Subject: [PYTHONMAC-SIG] System 6 Message-ID: <9609041203.AA16619=jack@schelvis.cwi.nl> Is anyone using Python under System 6, or does anyone know of people who do so? Sys6 compatability hasn't been tested for a long long time anyway, and I would like to rip out the System 6 compatability code (which needs to be taken out to prepare for MacOS 8 anyway). -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Wed Sep 4 14:15:05 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 04 Sep 1996 15:15:05 +0200 Subject: [PYTHONMAC-SIG] Event handling bug in 1.4b3 Message-ID: <9609041315.AA17139=jack@schelvis.cwi.nl> Before you all start complaining (i.e. why haven't you complained yet:-): I just found a bug in the 1.4b3 event handling code, which effectively means that Python does not look at the event queue when your program is busy, with the exception of checking for command-dot. This means you are not able to switch applications, type ahead, etc. Sorry, it will be fixed in 1.4 (or contact me if this seriously inconveniences you). -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Fri Sep 6 10:31:58 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Fri, 06 Sep 1996 11:31:58 +0200 Subject: [PYTHONMAC-SIG] MSDOS floppies Message-ID: <9609060931.AA02817=jack@schelvis.cwi.nl> I just noticed that Python doesn't like MSDOS floppies very much: - os.chdir('DOSDISK:') does not work (making an alias to the floppy and chdir()ing there does work!) - os.listdir(':') when your working directory is a dos floppy does not work. Personally, I couldn't care less:-), but if anyone feels the urge to dive into the problem I will graciously accept donations of working code... -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Mon Sep 9 15:03:14 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 09 Sep 1996 16:03:14 +0200 Subject: [PYTHONMAC-SIG] Update for MacPython 1.4b3 for CFM68K Message-ID: <9609091403.AA26511=jack@schelvis.cwi.nl> If you are using the CFM68K version of MacPython 1.4b3 and you are experiencing problems with creating applets or with using Tkinter you should download . This fixes the following bugs: - _tkinter was built so that you don't need to install a full Tcl/Tk distribution on your system, but this didn't work correctly. Now it does. - Applets were created with the same creator-code as the interpreter, making it difficult to run normal scripts after creating an applet. This has been fixed. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jshell@inconnect.com Mon Sep 9 15:48:39 1996 From: jshell@inconnect.com (jeffrey P. Shell) Date: Mon, 09 Sep 1996 08:48:39 -0600 Subject: [PYTHONMAC-SIG] applet question References: <9609091403.AA26511=jack@schelvis.cwi.nl> Message-ID: <32342E47.40F3@inconnect.com> one quick question: when an Applet is 'made', is the Python code contained within the applet? or does it point to the code it needs? primarily, with some of the Python code i'm working on, there is a central Module/Framework i'm using, and a few different 'front ends' that access that Module. the code in the front ends doesn't change too much, but the Framework is. Do i have to rebuild the Applets that use that Framework everytime i change it? It's no huge deal, but i'm just wondering before i start building everything in my excitement over the CFM version of Python :). ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Mon Sep 9 16:41:42 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 09 Sep 1996 17:41:42 +0200 Subject: [PYTHONMAC-SIG] applet question In-Reply-To: Message by "jeffrey P. Shell" , Mon, 09 Sep 1996 08:48:39 -0600 , <32342E47.40F3@inconnect.com> Message-ID: <9609091541.AA27486=jack@schelvis.cwi.nl> > one quick question: when an Applet is 'made', is the Python code > contained within the applet? or does it point to the code it needs? > primarily, with some of the Python code i'm working on, there is a > central Module/Framework i'm using, and a few different 'front ends' > that access that Module. the code in the front ends doesn't change too > much, but the Framework is. Do i have to rebuild the Applets that use > that Framework everytime i change it? It's no huge deal, but i'm just > wondering before i start building everything in my excitement over the > CFM version of Python :). Jeffrey, the compiled code for the main module is incorporated in the applet, nothing else. Actually, I use this fact for debugging applets: make your main code do nothing else than 'execfile("real_applet_code.py")' and you only have to run mkapplet once. Then, when I'm satisfied that the code works I rename real_applet_code.py to the real name and run mkapplet once. There is actually a way to create a fully self-contained applet, but I haven't documented it yet since the procedure is a bit involved and I want to streamline it (if I find the time). For the adventurous, here is the procedure: - Collect *all* modules used by your program into a folder. I really mean "all", so including anything from Lib, etc. - Run compileall.py on that folder. - Run PackLibDir on the folder, giving you a resource file with PYC resources for all your modules. - Temporarily replace PythonApplet by either PythonStandalone (PPC) or Python68K (68k). - Create your applet. (And don't forget to put PythonApplet back in its place). - Use ResEdit to copy the PYC resources from your PackLibDir output file to your applet. PYC resource numbers are not important (names are), so let resedit fix the duplicates. - Drop the applet onto EditPythonPrefs, remove all sys.path components and replace them by the single string $(APPLICATION) - I think you have to use ResEdit to remove the "alis" resource from the resulting applet to make it truly portable, but I'm not 100% sure. You now have a fully standalone application that you can give away to anyone, it does not depend on any Python infrastructure anymore, even if the program is run on a machine that has python already installed. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From managan@llnl.gov Mon Sep 9 19:21:18 1996 From: managan@llnl.gov (Rob Managan) Date: Mon, 9 Sep 1996 11:21:18 -0700 Subject: [PYTHONMAC-SIG] Numerical Python Message-ID: I have compiled the Numeric python libraries for the Mac. For Power PC users it should be as easy as expanding the archive and adding two directories to the pythonpaths with EditPythonPrefs. AFter a few people test it I suggest I send the archive to Jack to store with the rest of the Mac software. I suggest this since I don't have a ftp site available to me. Currently this is compiled for version 1.4b3 of Python and 1.0a2 of the Numeric module. *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan managan@llnl.gov LLNL ph: 510-423-0903 P.O. Box 808, L-178 FAX: 510-423-5804 Livermore, CA 94551-0808 ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jstrout@ucsd.edu Fri Sep 13 16:12:59 1996 From: jstrout@ucsd.edu (Joseph Strout) Date: Fri, 13 Sep 1996 08:12:59 -0700 (PDT) Subject: [PYTHONMAC-SIG] drawing cicns (or better yet, "sprites")? Message-ID: Hi all, Does anyone know if it's possible to plot cicns (color icons) from Python? I can load the resource with GetResource, but then I can't figure out how to DO anything with it. FYI, what I'm really after is a way to draw simple sprites, so I can get my little brothers-in-law hooked on Python. They're only interested in games, and "game" to them means moving shapes. I'm about ready to give up on Python and use Chipmunk Basic instead... so if you have any info, we'd be much obliged. Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jstrout@ucsd.edu Sun Sep 15 17:49:29 1996 From: jstrout@ucsd.edu (Joseph Strout) Date: Sun, 15 Sep 1996 09:49:29 -0700 (PDT) Subject: [PYTHONMAC-SIG] wanted: "Run Python" BBEdit extension Message-ID: In my never-ending quest for a Mac programming language for kids that doesn't suck, I've recently been looking at Chipmunk Basic. It comes with a very cool feature: a BBEdit plug-in that adds a "Run as Chipmunk Basic" command to the Extensions menu. You edit your source in BBEdit (Lite), pick this off the menu, and poof! the Mac switches to Chipmunk Basic, loads your code, and executes it. In Python, the most efficient paradigm I've come up with is to edit my code, save it, then switch to the Finder and drag the file onto the Python app. Then when it's done I have to be sure to quit (Python). This is not terrible, but the BBEdit extension is nicer. Of course, *nicest* would be a Mac Python IDE. Edit your code (with syntax hilighting), command-R to run, command-D to debug, set breakpoints just by clicking the little stop signs in the sidebar... ah, but now I'm just dreaming... ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jstrout@ucsd.edu Sun Sep 15 17:49:29 1996 From: jstrout@ucsd.edu (Joseph Strout) Date: Sun, 15 Sep 1996 09:49:29 -0700 (PDT) Subject: [PYTHONMAC-SIG] wanted: "Run Python" BBEdit extension Message-ID: In my never-ending quest for a Mac programming language for kids that doesn't suck, I've recently been looking at Chipmunk Basic. It comes with a very cool feature: a BBEdit plug-in that adds a "Run as Chipmunk Basic" command to the Extensions menu. You edit your source in BBEdit (Lite), pick this off the menu, and poof! the Mac switches to Chipmunk Basic, loads your code, and executes it. In Python, the most efficient paradigm I've come up with is to edit my code, save it, then switch to the Finder and drag the file onto the Python app. Then when it's done I have to be sure to quit (Python). This is not terrible, but the BBEdit extension is nicer. Of course, *nicest* would be a Mac Python IDE. Edit your code (with syntax hilighting), command-R to run, command-D to debug, set breakpoints just by clicking the little stop signs in the sidebar... ah, but now I'm just dreaming... ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Sun Sep 15 20:34:13 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Sun, 15 Sep 1996 15:34:13 -0400 (EDT) Subject: [PYTHONMAC-SIG] wanted: "Run Python" BBEdit extension In-Reply-To: Message-ID: Another share-ware editor, Alpha, is like a somewhat more macified version of emacs: it supports syntax coloring, and interfaces to other programs. You would need to write a python-mode module in Tcl. I use this in my xlisp-stat programming now over BEDIT,because someone else contributed an xlisp mode. I have not delved into the inner working of extending the editor yet, so I have no idea what it would take. The "official" OSA conforming way to do this is to separate the interpreter from the interface and control it with do-script apple events. Thus you can buy a fancier more featured development environment for AppleScript than the vanilla script editor that comes from Apple. I have no idea how language dependent any of these editors are -- if Mac Python was more OSA compliant, could you use the AppleScript editor for Python development ? I don't know. ( And no time at the moment to research the question, although I WILL try to look at a couple of Alpha programs to see how hard it would be to add a python mode. I've been using it for Python without a language specific mode - the handiest command is to shift block of code left/right.) ---| Steven D. Majewski (804-982-0831) |--- ---| Computer Systems Engineer University of Virginia |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| Box 449 Health Science Center Charlottesville,VA 22908 |--- [ "The grass is always greener, except at t=0" - Stan Kelly-Bootle ] ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From friedric@rose.rsoc.rockwell.com Sun Sep 15 21:01:22 1996 From: friedric@rose.rsoc.rockwell.com (Robin Friedrich) Date: Sun, 15 Sep 1996 15:01:22 -0500 Subject: [PYTHONMAC-SIG] wanted: "Run Python" BBEdit extension Message-ID: <199609152001.PAA15787@darwin.rsoc.rockwell.com> Steve, I too use Alpha and have been wishing for a Python mode but have not had time to learn TCL enough to implement it myself. After looking at several other Alpha mode implementations it seems straightforward. If you get to it before I do I would love to try it out. I'm unsure about the spawning of a macpython process though. -Robin Friedrich ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From just@knoware.nl Sun Sep 15 21:18:38 1996 From: just@knoware.nl (Just van Rossum) Date: Sun, 15 Sep 1996 22:18:38 +0200 Subject: [PYTHONMAC-SIG] wanted: "Run Python" BBEdit extension Message-ID: At 9:49 AM 9/15/96, Joseph Strout wrote: >In my never-ending quest for a Mac programming language for kids that >doesn't suck, I've recently been looking at Chipmunk Basic. It comes with >a very cool feature: a BBEdit plug-in that adds a "Run as Chipmunk Basic" >command to the Extensions menu. You edit your source in BBEdit (Lite), >pick this off the menu, and poof! the Mac switches to Chipmunk Basic, >loads your code, and executes it. It should be very easy, I'll look into it, I've written a simple BBEdit extension before, and with AppleEvents, it should be a breeze, to speak with Jack. I already have a simple engine that lets you send python code to the interpreter via AE. >In Python, the most efficient paradigm I've come up with is to edit my >code, save it, then switch to the Finder and drag the file onto the Python >app. Then when it's done I have to be sure to quit (Python). This is not >terrible, but the BBEdit extension is nicer. >Of course, *nicest* would be a Mac Python IDE. Edit your code (with >syntax hilighting), command-R to run, command-D to debug, set breakpoints >just by clicking the little stop signs in the sidebar... ah, but now I'm >just dreaming... Well, I have an attempt at such a thing going, but it's not *near* beta. Integrated editor (supports collapsing!) and run command is there, Jack's working on a graphical debugger, so somehow I believe there'll be something very nice at some point. I don't know yet how to do syntax highlighting efficiently. It's however unlikely this will be finished before 1.4 mac will be released though. Let me know if you want to have a look at the current state of my stuff. Just PS: i got this message twice, is that normal? ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jac@gandalf.llnl.gov Sun Sep 15 22:23:12 1996 From: jac@gandalf.llnl.gov (James Crotinger) Date: Sun, 15 Sep 96 14:23:12 PDT Subject: [PYTHONMAC-SIG] Alpha & Emacs In-Reply-To: References: Message-ID: <9609152123.AA04533@gandalf.llnl.gov> Steven D. Majewski writes: > > > Another share-ware editor, Alpha, is like a somewhat more macified > version of emacs: it supports syntax coloring, and interfaces to > other programs. You would need to write a python-mode module in > Tcl. I use this in my xlisp-stat programming now over BEDIT,because > someone else contributed an xlisp mode. I have not delved into > the inner working of extending the editor yet, so I have no idea > what it would take. Alpha is a pretty poor excuse for emacs. There is a version of emacs that runs on the mac (at ftp://ftp.cs.cornell.edu/pub/parmet), but it is based on Emacs 18. I use it when I really want emacs, but it has some problems, so I use Alpha for most things. I'd REALLY like an Emacs 19 port, but haven't seen any indication that this is being done. Jim ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Mon Sep 16 10:02:02 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 16 Sep 1996 11:02:02 +0200 Subject: [PYTHONMAC-SIG] wanted: "Run Python" BBEdit extension In-Reply-To: Message by just@knoware.nl (Just van Rossum) , Sun, 15 Sep 1996 22:18:38 +0200 , Message-ID: <9609160902.AA19470=jack@schelvis.cwi.nl> > At 9:49 AM 9/15/96, Joseph Strout wrote: > [...] a BBEdit plug-in that adds a "Run as Chipmunk Basic" > >command to the Extensions menu. You edit your source in BBEdit (Lite), > >pick this off the menu, and poof! the Mac switches to Chipmunk Basic, > >loads your code, and executes it. > > It should be very easy, I'll look into it, I've written a simple BBEdit > extension before, and with AppleEvents, it should be a breeze, to speak > with Jack. I already have a simple engine that lets you send python code to > the interpreter via AE. I have collected various parts you need for this (mainly a similar BBEdit extension to run a MacPerl script), but I cannot interface it to the interpreter at the moment. Or, more precise: I can get the appleevent to the interpreter, but at the time the interpreter gets the event it will be somewhere deep down in the stdio/sioux library doing a read from the console, and I can't think of a good way to get control back to the interpreter in a controlled way. This will be fixed when (a) the IDE is finished (since then we'll control our own eventloop) or (b) we have our own console module (since then we can signal it to terminate the read). Both/either of these should happen fairly soon. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From just@knoware.nl Mon Sep 16 12:03:25 1996 From: just@knoware.nl (Just van Rossum) Date: Mon, 16 Sep 1996 13:03:25 +0200 Subject: [PYTHONMAC-SIG] wanted: "Run Python" BBEdit extension Message-ID: At 11:02 AM 9/16/96, Jack Jansen wrote: >> At 9:49 AM 9/15/96, Joseph Strout wrote: >> [...] a BBEdit plug-in that adds a "Run as Chipmunk Basic" >> >command to the Extensions menu. You edit your source in BBEdit (Lite), >> >pick this off the menu, and poof! the Mac switches to Chipmunk Basic, >> >loads your code, and executes it. >> >> It should be very easy, I'll look into it, I've written a simple BBEdit >> extension before, and with AppleEvents, it should be a breeze, to speak >> with Jack. I already have a simple engine that lets you send python code to >> the interpreter via AE. >I have collected various parts you need for this (mainly a similar BBEdit >extension to run a MacPerl script), but I cannot interface it to the >interpreter at the moment. Or, more precise: I can get the appleevent to the >interpreter, but at the time the interpreter gets the event it will be >somewhere deep down in the stdio/sioux library doing a read from the console, >and I can't think of a good way to get control back to the interpreter in a >controlled way. We could get it very easily to run if we start a generalized version of my PythonSlave. (It is a simple FrameWork app which responds to AppleEvents.) The only disadvantages are: you don't have an interactive mode (although we could fake that) and you have to start that script explicitly. Hmm, it's of course possible to have the extension start the script, but then you have to send an AE to the Finder, and that's something I haven't mastered yet. In fact I tried to look it up in inside mac and just couldn't find it. Does anyone know more? >This will be fixed when (a) the IDE is finished (since then we'll control our >own eventloop) or (b) we have our own console module (since then we can signal >it to terminate the read). Both/either of these should happen fairly soon. Hmm, I'm pretty busy right now, I'm not sure when I can get the stuff I'm working on finished :-( As soon as I've sorted out the main problems with my editor and if you provide a way to hook up your debugger, we're really getting there. That's the point when we should ask people to test it. Just ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From just@knoware.nl Mon Sep 16 15:20:48 1996 From: just@knoware.nl (Just van Rossum) Date: Mon, 16 Sep 1996 16:20:48 +0200 Subject: [PYTHONMAC-SIG] ANNOUNCE: BBEdit extension to run python scripts Message-ID: I've put together a very basic BBEdit extension, that sort of does what Joe requested. If you're interested, I'll send the archive. I have no ftp server. Just -- Here's the READ ME: BBPython -- a BBEdit extension to make the Python interpreter exectute the content of the current window. contents: - BBPython -- the extension - PythonSlave.py -- the "slave" script that handles the AppleEvents - source -- source code & CW9 project for the extension quickstart: - drop BBPuthon in BBEdit extensions folder - double-click PythonSlave.py - start BBEdit - type some code - go to Extensions menu: "Perform as Python" - be happy warning: since PythonSlave.py runs its own event loop and we have no interface to SIOUX you *cannot* copy from the console. Duh. extra feature: while PythonSlave.py is running you can still double-click Python documents, they will get executed as if Python was not alreadu running. bugs: perhaps Have fun with it! And please report bugs, or fix 'em. Just van Rossum, Letterror ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From sdm7g@virginia.edu Mon Sep 16 15:55:43 1996 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Mon, 16 Sep 1996 10:55:43 -0400 (EDT) Subject: [PYTHONMAC-SIG] ANNOUNCE: BBEdit extension to run python scripts In-Reply-To: Message-ID: On Mon, 16 Sep 1996, Just van Rossum wrote: > I've put together a very basic BBEdit extension, that sort of does what Joe > requested. If you're interested, I'll send the archive. I have no ftp > server. > Yes - please send a copy. [ You might as well send it out to the whole list -- I think the PYTHONMAC-SIG audience is specific enough that most everyone will be interested to at least take a look at it. ] ---| Steven D. Majewski (804-982-0831) |--- ---| Computer Systems Engineer University of Virginia |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| Box 449 Health Science Center Charlottesville,VA 22908 |--- [ "The grass is always greener, except at t=0" - Stan Kelly-Bootle ] ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From just@knoware.nl Mon Sep 16 16:04:07 1996 From: just@knoware.nl (Just van Rossum) Date: Mon, 16 Sep 1996 17:04:07 +0200 Subject: [PYTHONMAC-SIG] ANNOUNCE: BBEdit extension to run python scripts Message-ID: At 10:55 AM 9/16/96, Steven D. Majewski wrote: >Yes - please send a copy. ok, I did. >[ You might as well send it out to the whole list -- I think the > PYTHONMAC-SIG audience is specific enough that most everyone will > be interested to at least take a look at it. ] Hmm, if everybody is really interested, we'd better put it on ftp somewhere. I'd rather not harass the people that might not want it. Jack? ftp.python.org/contrib ? But I'd rather have it tested by a few people before we do that... Just ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From friedric@rose.rsoc.rockwell.com Mon Sep 16 16:19:01 1996 From: friedric@rose.rsoc.rockwell.com (Robin Friedrich) Date: Mon, 16 Sep 1996 10:19:01 -0500 Subject: [PYTHONMAC-SIG] ANNOUNCE: BBEdit extension to run python scripts Message-ID: <199609161519.KAA17427@darwin.rsoc.rockwell.com> |> Steve wrote: |> >[ You might as well send it out to the whole list -- I think the |> > PYTHONMAC-SIG audience is specific enough that most everyone will |> > be interested to at least take a look at it. ] |> Please don't. the majodomo will not forward anything larger than 40KB. |> Hmm, if everybody is really interested, we'd better put it on ftp somewhere. |> I'd rather not harass the people that might not want it. |> |> Jack? ftp.python.org/contrib ? |> But I'd rather have it tested by a few people before we do that... I would just upload it to ftp.python.org and have them put it in contrib. Looking forward to it. -Robin ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From billpy@mousa.demon.co.uk Mon Sep 16 18:14:49 1996 From: billpy@mousa.demon.co.uk (billpy@mousa.demon.co.uk) Date: Mon, 16 Sep 1996 13:14:49 -0400 (EDT) Subject: No subject Message-ID: Reply - To: Date: Mon, 16 Sep 1996 00:27:33 +0000 To: pythonmac-sig@python.org From: Bill Bedford Subject: Re:[PYTHONMAC-SIG] wanted: "Run Python" BBEdit extension --============_-1369288835==_============ Content-Type: text/plain; charset="us-ascii" At 4:49 pm +0000 on 15/09/96, Joseph Strout wrote: ~In my never-ending quest for a Mac programming language for kids that ~doesn't suck, I've recently been looking at Chipmunk Basic. It comes with ~a very cool feature: a BBEdit plug-in that adds a "Run as Chipmunk Basic" ~command to the Extensions menu. You edit your source in BBEdit (Lite), ~pick this off the menu, and poof! the Mac switches to Chipmunk Basic, ~loads your code, and executes it. ~ ~In Python, the most efficient paradigm I've come up with is to edit my ~code, save it, then switch to the Finder and drag the file onto the Python ~app. Then when it's done I have to be sure to quit (Python). This is not ~terrible, but the BBEdit extension is nicer. I have 3 Fkey programed with KeyQuencer F13 is 'import ' F14 is 'reload()' F15 is '.Main()' I write in alpha, switch to Python using the controlstrip and press F14 F15. OK each time I start work on a new module I have to change the Keyquencer scripts, but that is no big deal. I've attatched a simple alpha python mode file - no doubt someone can improve it. --============_-1369288835==_============ Content-Type: text/plain; name="pythonMode.tcl"; charset="us-ascii" Content-Disposition: attachment; filename="pythonMode.tcl" ############################################################################# # Python.tcl # John Sarapata # sarapata_john@jpmorgan.com # # Installing: # Put AppleScript.tcl in your Usercode folder # Put the following line in userstartup.tcl: # source $HOME:Tcl:Usercode:AppleScript.tcl # # Description: # This file implements an AppleScript mode, for people who wish Script # Editor had complex functions like search and replace. Currently, it # only supports color editing and function finding, but I may extend it. # # I have not found a way to distinguish function definitions from # on error constructs, so I assume that any "on name" statements at # the beginning of the line are definitions. Script Editor saves files # in this format, so you will only need to be careful when creating # functions in Alpha. ############################################################################# if {$startingUp} { addMode Python dummyPython {*.py *.pyc} PythonMenu addMenu PythonMenu return } #=============================================================================== # Set up the mode variables newModeVar Python elecRBrace {0} 1 newModeVar Python electricSemi {0} 1 newModeVar Python elecLBrace {0} 1 newModeVar Python electricTab {0} 1 newModeVar Python wordWrap {0} 1 newModeVar Python autoMark {def} 0 newModeVar Python prefixString {#} 0 newModeVar Python leftFillColumn {3} 0 newModeVar Python funcExpr {^(def) +([a-zA-Z0-9_]+\(\):)} 0 newModeVar Python wordBreak {[a-zA-Z0-9_]+} 0 newModeVar Python wordBreakPreface {[^a-zA-Z0-9_]} 0 newModeVar Python stringColor green 0 newModeVar Python commentColor red 0 newModeVar Python keywordColor blue 0 proc dummyPython {} {} #=============================================================================== # Set up comments and keywords set PythonKeyWords { and elif from lambda return break else global not try class except if or while continue exec import pass def finally in print del for is raise } if {[info exists Pythonwords]} {set PythonKeyWords [concat $PythonKeyWords $Pythonwords]} regModeKeywords -e {#} -c $PythonmodeVars(commentColor) -k $PythonmodeVars(keywordColor) Python $PythonKeyWords -s $PythonmodeVars(stringColor) unset PythonKeyWords #=============================================================================== # File Marking proc PythonMarkFile {} { global PythonmodeVars set pos 0 while {![catch {search -f 1 -r 1 -m 0 -i 1 $PythonmodeVars(funcExpr) $pos} res]} { set start [lindex $res 0] set end [lindex $res 1] set text [lindex [getText $start $end] 1] set pos $end set inds($text) "$start $end" } if {[info exists inds]} { foreach f [lsort [array names inds]] { setNamedMark $f [lineStart [lineStart [lindex $inds($f) 0]] - 1] [lindex $inds($f) 0] [lindex $inds($f) 1] } } } --============_-1369288835==_============ Content-Type: text/plain; charset="us-ascii" ----------------------------------------------------------------------- Bill Bedford Designer of Photo-Etches billb@mousa.demon.co.uk owner Brit_Rail-L --- british railways historical list ----------------------------------------------------------------------- --============_-1369288835==_============-- ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jshell@inconnect.com Mon Sep 16 21:18:52 1996 From: jshell@inconnect.com (jeffrey P. Shell) Date: Mon, 16 Sep 1996 14:18:52 -0600 Subject: [PYTHONMAC-SIG] BBEdit (full) Message-ID: <323DB62C.13AF@inconnect.com> [NOTE: i originally sent this reply just to Joseph, but realized it's info the whole list might need. Also, since this writing I've picked up Alpha and have been rather impressed, but since i have the full BBEdit i think i will use that for now] Joseph Strout wrote: > > In my never-ending quest for a Mac programming language for kids that > doesn't suck, I've recently been looking at Chipmunk Basic. It comes with > a very cool feature: a BBEdit plug-in that adds a "Run as Chipmunk Basic" > command to the Extensions menu. You edit your source in BBEdit (Lite), > pick this off the menu, and poof! the Mac switches to Chipmunk Basic, > loads your code, and executes it. > > In Python, the most efficient paradigm I've come up with is to edit my > code, save it, then switch to the Finder and drag the file onto the Python > app. Then when it's done I have to be sure to quit (Python). This is not > terrible, but the BBEdit extension is nicer. > > Of course, *nicest* would be a Mac Python IDE. Edit your code (with > syntax hilighting), command-R to run, command-D to debug, set breakpoints > just by clicking the little stop signs in the sidebar... ah, but now I'm > just dreaming... you know, if i had CodeWarrior, i'd make that extension.. :) i use BBEdit (i got the full 3.5.2 now) extensively. I can't remember if BBEdit lite has this function, but in BBEdit 3.5 there's a small menu on the Phillips bar (?) that has a seperate item for each mac folder leading to the file, including the file itself. Combining that with Snitch (a freeware utility that extends the finders "Get Info" command and allows you to set Type/Creator) to set the files to load Python instead of BBEdit, i pull down that menu, click on the file in the finder (it just finds it for you basically), and run it. I know there's a Run Perl extension out as well, so a Python one shouldn't be too hard to make.. if only i had the right tools at this time.. :) i think a few well-placed letters to BareBones software about Python would be nice as well. The full versions of BBEdit offer a lot of little programming helps, and i think 4.0 colorizes the code. But Python isn't supported (yet). A Mac-Python IDE would be nice, but you seldom get really really good editors like BBEdit in such an environment. (Hell, even BBEdit Lite is so far above anything else i've used on the mac to date) -- .jPS || jshell@inconnect.com || http://www.cynapses.com/ry/ ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From just@knoware.nl Wed Sep 18 02:19:30 1996 From: just@knoware.nl (Just van Rossum) Date: Wed, 18 Sep 1996 03:19:30 +0200 Subject: [PYTHONMAC-SIG] Q: How To Tell The Finder To Launch An App With A Doc? Message-ID: Although this is not a Python specific question, I hope you don't mind asking here. It's still Python related. In my BBEdit extension in which I can send Python code to the interpreter I would like to give a prompt when the slave script is not running, asking the user to locate it and then: Launch The Interpreter With The Script. I am told I have to send an AppleEvent to the Finder to do this, but I've crawled through most of the stuff on my Inside Mac CD and I Can't Bleedin' Find It. Does anyone know what event to send? Or what else to do? I think Jack would also like to know, so we can also make a convenient call for this in Python / aetools.py. No More Connection Invalid Errors. Please? Thanks so much in advance. Just ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From roseman@cpsc.ucalgary.ca Wed Sep 18 03:14:47 1996 From: roseman@cpsc.ucalgary.ca (Mark Roseman) Date: Tue, 17 Sep 1996 20:14:47 -0600 Subject: [PYTHONMAC-SIG] Q: How To Tell The Finder To Launch An App With A Doc? In-Reply-To: Your message of "Wed, 18 Sep 1996 03:19:30 +0200." Message-ID: <199609180214.UAA09739@janu.cpsc.ucalgary.ca> In message you write: > In my BBEdit extension in which I can send Python code to the interpreter I > would like to give a prompt when the slave script is not running, asking > the user to locate it and then: Launch The Interpreter With The Script. > I am told I have to send an AppleEvent to the Finder to do this, but I've > crawled through most of the stuff on my Inside Mac CD and I Can't Bleedin' > Find It. Does anyone know what event to send? Or what else to do? I think > Jack would also like to know, so we can also make a convenient call for > this in Python / aetools.py. No More Connection Invalid Errors. Please? here is part of a tcl extension i wrote that did this.. mark /* * Launch a file, optionally specifying a type and creator (0L to leave as is). * This works exactly as if you'd double clicked on the file in the Finder, which * not surprisingly is how its implemented (via the AppleEvents route of course). */ int LaunchFile(OSType creator, OSType type, char *filename) { FSSpec docFile, dirSpec; OSErr result; FInfo docInfo; AEAddressDesc finderAddress; AppleEvent theEvent, reply; long aSig = 'MACS'; AliasHandle DirAlias, FileAlias; AEDesc fileList; AEDesc aeDirDesc, listElem; if ((result = FSMakeFSSpec (0, 0, c2pstr(filename), &docFile)) != noErr) { return -1; } if ((result = FSpGetFInfo(&docFile, &docInfo)) != noErr) { return -2; } if (creator!=(OSType) 0L) { docInfo.fdCreator = creator; } if (type!=(OSType) 0L) { docInfo.fdType = type; } if ((creator!=(OSType)0L) || (type!=(OSType)0L)) { if ((result = FSpSetFInfo(&docFile, &docInfo)) != noErr) { return -3; } } if ((result = AECreateDesc(typeApplSignature, (Ptr)&aSig, 4, &finderAddress)) != noErr) { return -4; } if ((result = AECreateAppleEvent('FNDR', 'sope', &finderAddress, kAutoGenerateReturnID, kAnyTransactionID, &theEvent)) != noErr) { return -5; } FSMakeFSSpec(docFile.vRefNum, docFile.parID, nil, &dirSpec); NewAlias(nil, &dirSpec, &DirAlias); NewAlias(nil, &docFile, &FileAlias); result = AECreateList(nil, 0, 0, &fileList); HLock((Handle)DirAlias); AECreateDesc(typeAlias, (Ptr)*DirAlias, GetHandleSize((Handle)DirAlias), &aeDirDesc); HUnlock((Handle)DirAlias); if ((result = AEPutParamDesc(&theEvent, keyDirectObject, &aeDirDesc)) == noErr) { AEDisposeDesc(&aeDirDesc); HLock((Handle)FileAlias); AECreateDesc(typeAlias, (Ptr)*FileAlias, GetHandleSize((Handle)FileAlias), &listElem); HLock((Handle)FileAlias); result = AEPutDesc(&fileList, 0, &listElem); } AEDisposeDesc(&listElem); result = AEPutParamDesc(&theEvent, 'fsel', &fileList); AEDisposeDesc(&fileList); if ((result = AESend(&theEvent, &reply, kAENoReply+kAENeverInteract, kAENormalPriority, kAEDefaultTimeout, 0L, 0L)) != noErr) { return -6; } if ((result = AEDisposeDesc(&theEvent)) != noErr) { return -7; } if ((result = AEDisposeDesc(&reply)) != noErr) { return -8; } return 0; } ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Thu Sep 19 11:42:38 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Thu, 19 Sep 1996 12:42:38 +0200 Subject: [PYTHONMAC-SIG] Q: How To Tell The Finder To Launch An App With A Doc? In-Reply-To: Message by Mark Roseman , Tue, 17 Sep 1996 20:14:47 -0600 , <199609180214.UAA09739@janu.cpsc.ucalgary.ca> Message-ID: <9609191042.AA14818=jack@schelvis.cwi.nl> YES!!!! Thanks, Mark, for pointing me in the right direction. I never managed to find out how to make the finder open something, but I was looking in the new (7.1) finder suite, and it turns out that this is much more easily done using the 7.0 finder scripting interface. If people can't wait for this functionality until the 1.4 release: let me know and I'll send you the example code in Python. One minor problem remains: with this interface you have to specify the fsspec or full pathname of the application you want to launch, while what you would really want is to specify either the 4-char creator or (possibly) the filename only of the application. Does anyone have code to browse through the finders' desktop database to get from creator to full pathname? -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From roseman@cpsc.ucalgary.ca Thu Sep 19 15:46:52 1996 From: roseman@cpsc.ucalgary.ca (Mark Roseman) Date: Thu, 19 Sep 1996 08:46:52 -0600 Subject: [PYTHONMAC-SIG] Q: How To Tell The Finder To Launch An App With A Doc? In-Reply-To: Your message of "Thu, 19 Sep 1996 12:42:38 +0200." <9609191042.AA14818=jack@schelvis.cwi.nl> Message-ID: <199609191446.IAA06965@janu.cpsc.ucalgary.ca> > One minor problem remains: with this interface you have to specify the fsspec > or full pathname of the application you want to launch, while what you would > really want is to specify either the 4-char creator or (possibly) the filenam > e > only of the application. Does anyone have code to browse through the finders' > desktop database to get from creator to full pathname? i'll send you code to dig the application out of the desktop database separately. but you'll also want to keep the existing functionality, as it lets you "double-click" on a document and have it launch its app, not only just launch an app. mark ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From just@knoware.nl Thu Sep 19 16:49:59 1996 From: just@knoware.nl (Just van Rossum) Date: Thu, 19 Sep 1996 17:49:59 +0200 Subject: [PYTHONMAC-SIG] Q: How To Tell The Finder To Launch An App With A Doc? Message-ID: At 12:42 PM 9/19/96, Jack Jansen wrote: >YES!!!! My sentiments exactly... >One minor problem remains: with this interface you have to specify the fsspec >or full pathname of the application you want to launch, while what you would >really want is to specify either the 4-char creator or (possibly) the filename >only of the application. Does anyone have code to browse through the finders' >desktop database to get from creator to full pathname? With this interface you have to specify the FSSpec of the *file* to be launched, not of the application, the finder sorts it out using the creator of the file. I guess there must also be an event type that let you launch an app without a document by just telling its signature. But how... Just ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Mon Sep 23 15:46:10 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 23 Sep 1996 16:46:10 +0200 Subject: [PYTHONMAC-SIG] Design of MacPython CGI interface Message-ID: <9609231446.AA16456=jack@schelvis.cwi.nl> Folks, I've gotten CGI scripts in Python to work, more or less, but now I'm thinking of the final design of the interface and I'm stuck, so I'd like some feedback. On unix (and NT, and probably most other systems) Python CGI scripts are run as "main program". They import the cgi module, use its functionality to obtain the script parameters, send their resulting document to stdout and terminate. On the Mac, the situation is different. A CGI script is run and should immedeately go into its eventloop. It will then receive a "do CGI script" AppleEvent, which contains the script parameters. Then, the script should execute and pass the resulting document back to the webserver as the data in the AppleEvent reply. After this, the script can either remain running (to wait for the next "do CGI script" AppleEvent) or exit (in which case it will be restarted the next time it is needed). I can think of a number of ways to design the MacPython CGI interface: 1. Forget about compatability with Unix CGI scripts altogether. This would result in an interface something like import maccgi def myscript(args): rv = "Content-Type: blabla\n" rv = rv + blablabla ... return rv maccgi.run(myscript) 2. Implement the above interface, and ask Guido to optionally support this interface for Unix/NT as well. (so people who use this interface get compatability, people who use the current unix interface don't). 3. Similar to (2), but implement some things in the Mac interface that would make it a bit more unix-like. The two things that come to mind are - in maccgi.run(), setup stdout to point to a file-like object so the "print" statement can be used for output generation - don't pass the arguments in the call to myscript() but use the cgi.FieldStorage() idiom used by the unix scripts (possibly augmented with stuffing things into sys.environ). The unix cgi.py would contain the routine def run(func): func() for compatability. 4. Make porting even easier for the unix buffs, by allowing the script code to be in the script body (in stead of in a separate routine, as in the three designs above). This would mean writing routines maccgi.start() and maccgi.end(), where the start routine would go into the eventloop until the "do CGI script" event was received, decode it, setup stdout as in (3) and return. End() would collect the stdout results and send them as AppleEvent reply. 5. Something else altogether. I would personally favor solution (3), but Guido appears not too willing to change cgi.py (although I can always hope, of course, that this message will convince him otherwise). And, of course, it is possible that people have brilliant ideas for (5), or that people think CGI script portability isn't a worthwile issue. What do people think? -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From gandreas@skypoint.com Tue Sep 24 03:54:47 1996 From: gandreas@skypoint.com (Glenn Andreas) Date: Mon, 23 Sep 1996 21:54:47 -0500 (CDT) Subject: [PYTHONMAC-SIG] PowerPlant? Message-ID: Considering how unappealing the Tkinter stuff is for a mac application, one alternative would be to leverage off an existing framework, namely PowerPlant (the "write your own" is second on the list, but since PowerPlant provides all sorts of goodies that "write your own" doesn't...). It seems that if Python could use the PowerPlant framework (and Constructor), this could be a very big deal for the MacPython communitee. Now, in "a previous life" I spent a great deal of time hacking wxPython, so I got to see, in general, how to fit Python into a class framework, but is the "pass the object as an opaque magic cookie through a procedural (non-object orient) interface" techinque the best thing to do? I was envisioning something more like making a subclass of all "interesting" PP classes that was "scriptendable" - basically there was a python object associated with the object, and then all the method calls would first get passed through the Python layer (assuming the corresponding method call existed in Python land). Yes, creating these subclasses this seems like a lot code, but with the AppleScriptability of CW10, almost all of it could be automated (which was one of the reasons I never considered doing this before). Any other suggestions on strategies on how to best structure the marriage of the C++ and the Python objects? There are obviously other problems to deal with as well (for example, registering the class "read from stream" routines, and who exactly owns the main event loop: the SIOUX console window or PP) but these seem small in comparision... I'm not promising anything here yet mind you, but I know that I would be quite happy and more productive if I could whip up a PP based app as fast as I was able to whip up a Motif app using wxPython... Glenn Andreas Author of Macintosh games: gandreas@skypoint.com, gandreas@aol.com Theldrow 2.3 http://www.skypoint.com/members/gandreas Blobbo 1.0.2 ftp://ftp.skypoint.com/pub/members/g/gandreas Be good, and you will be lonesome ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From roseman@cpsc.ucalgary.ca Tue Sep 24 04:06:59 1996 From: roseman@cpsc.ucalgary.ca (Mark Roseman) Date: Mon, 23 Sep 1996 21:06:59 -0600 Subject: [PYTHONMAC-SIG] PowerPlant? In-Reply-To: Your message of "Mon, 23 Sep 1996 21:54:47 CDT." Message-ID: <199609240307.VAA02378@janu.cpsc.ucalgary.ca> Glenn wrote: > Considering how unappealing the Tkinter stuff is for a mac application, one > alternative would be to leverage off an existing framework, namely > PowerPlant.. pardon my ignorance, what about the tkinter stuff doesn't work well, or is it just the lack of proper native look and feel, which is coming along at sun? the problem with targeting powerplant is that not only is it a lot of work, but the framework keeps changing, so its a never ending amount of work to do it right. so unless there's a good resource commitment somewhere.. or maybe i'm just showing my bias against anything that isn't a cross-platform solution. :-) mark ============================================================================= Mark Roseman, Research Associate phone: (403) 220-3532 / 220-7259 Dept. of Computer Science fax: (403) 284-4707 University of Calgary email: roseman@cpsc.ucalgary.ca Calgary, Alta CANADA T2N 1N4 http://www.cpsc.ucalgary.ca/~roseman ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jstrout@ucsd.edu Tue Sep 24 04:52:27 1996 From: jstrout@ucsd.edu (Joseph Strout) Date: Mon, 23 Sep 1996 20:52:27 -0700 (PDT) Subject: [PYTHONMAC-SIG] PowerPlant? In-Reply-To: Message-ID: On Mon, 23 Sep 1996, Glenn Andreas wrote: > Considering how unappealing the Tkinter stuff is for a mac application, one > alternative would be to leverage off an existing framework, namely > PowerPlant (the "write your own" is second on the list, but since > PowerPlant provides all sorts of goodies that "write your own" doesn't...). As a third alternative, what about a smaller C++ framework? There's one called "MacZoop" which looks very nice. It's tiny, both in code and complexity (only 5 core classes, I believe), but it does all the basics. More info is available at: http://www.warwick.ac.uk/~corbe/MacZoop/MacZoop.html I like your idea of layering Python right on top of the C++ object interface -- and automating this via Applescript is a great idea. (Though I would think that one could just as easily munch the header files with a Python script...) ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From friedric@rose.rsoc.rockwell.com Tue Sep 24 13:58:29 1996 From: friedric@rose.rsoc.rockwell.com (Robin Friedrich) Date: Tue, 24 Sep 1996 07:58:29 -0500 Subject: [PYTHONMAC-SIG] PowerPlant? Message-ID: <199609241258.HAA02907@darwin.rsoc.rockwell.com> |> Date: Mon, 23 Sep 1996 21:06:59 -0600 |> From: Mark Roseman |> |> Glenn wrote: |> > Considering how unappealing the Tkinter stuff is for a mac application, one |> > alternative would be to leverage off an existing framework, namely |> > PowerPlant.. |> |> pardon my ignorance, what about the tkinter stuff doesn't work well, |> or is it just the lack of proper native look and feel, which is coming |> along at sun? >From what I've seen the tkinter stuff on the Mac consumes way too much resource (both memory and cpu) to be practical for anything but tinkering. I would really like to see a toolbox native GUI builder for Python but that almost inhibits any crossplatform options without a lot of work. (What happened with wxPython for the Mac? btw) ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From gandreas@skypoint.com Tue Sep 24 14:27:26 1996 From: gandreas@skypoint.com (Glenn Andreas) Date: Tue, 24 Sep 1996 08:27:26 -0500 (CDT) Subject: [PYTHONMAC-SIG] PowerPlant? Message-ID: >Glenn wrote: >> Considering how unappealing the Tkinter stuff is for a mac application, one >> alternative would be to leverage off an existing framework, namely >> PowerPlant.. > >pardon my ignorance, what about the tkinter stuff doesn't work well, >or is it just the lack of proper native look and feel, which is coming >along at sun? Here's a couple of reasons where Tk fails and PowerPlant doesn't the look and feel its capabilities (for example, does it support drag & drop? Or how about a spread sheet class?) speed tools (like the PowerPlant constructor for generating the UI) ability to easily create new widgets in C++ Of course Tk provides: cross-platform it already works easy to write code to (Tkinter seems very cleanly laid out) >the problem with targeting powerplant is that not only is it a lot of >work, but the framework keeps changing, so its a never ending amount >of work to do it right. so unless there's a good resource commitment >somewhere.. or maybe i'm just showing my bias against anything that >isn't a cross-platform solution. :-) That's why I'm trying to leverage off the new scriptability of the IDE so I can automatically suck out all the useful stuff and generate the module automagically, so when it changes, there is at most only a small amount of work to do. Besides, when a new version of Tk comes out, things have to be fixed there as well (not that a new version of Tk comes out every three monthes). While crossplatform would be nice, it isn't at the top of my list (i.e., I don't make my living off crossplatform stuff). At any rate, I'm still trying to nail down the issues and approach before determining if it is even feasible... Glenn Andreas Author of Macintosh games: gandreas@skypoint.com, gandreas@aol.com Theldrow 2.3 http://www.skypoint.com/members/gandreas Blobbo 1.0.2 ftp://ftp.skypoint.com/pub/members/g/gandreas I don't want a 12 lb. Nestles Crunch for 25 dollars. ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jshell@inconnect.com Tue Sep 24 23:49:44 1996 From: jshell@inconnect.com (jeffrey P. Shell) Date: Tue, 24 Sep 1996 16:49:44 -0600 Subject: [PYTHONMAC-SIG] PowerPlant? References: Message-ID: <32486588.6FEA@inconnect.com> I have heard that Tk 4.3 will support more native widgets, allowing for a more 'mac-like' feel while still maintaining cross-platform support. WPY is tied in now with the MFC, which allow you to easily make windows-style apps. What is MacPython tied in with? MacApp? is there any good modern set of foundation classes for the Mac similar to (but better than) MFC? Or are we just wired into the basic Toolbox API? I should finally be picking myself up a copy of CodeWarrior soon and I'm interested in toying with some MacOS stuff, namely OpenDoc and OSA/AppleScript. What work has already been done in these areas? I would love to have Python in an OpenDoc/Cyberdog container. (note: it's been a while since i've programmed in C/C++, especially for a GUI, so don't quote me on any of this stuff.) :) -- .jPS || jshell@inconnect.com || http://www.cynapses.com/ry/ ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jstrout@ucsd.edu Tue Sep 24 23:51:46 1996 From: jstrout@ucsd.edu (Joseph Strout) Date: Tue, 24 Sep 1996 15:51:46 -0700 (PDT) Subject: [PYTHONMAC-SIG] PowerPlant? In-Reply-To: <32486588.6FEA@inconnect.com> Message-ID: On Tue, 24 Sep 1996, jeffrey P. Shell wrote: > WPY is tied in now with the MFC, which allow you to easily make > windows-style apps. What is MacPython tied in with? MacApp? Nope, no class library at all. Just the toolbox (and only parts of that). > is there > any good modern set of foundation classes for the Mac similar to (but > better than) MFC? Yes, there's PowerPlant, the Think Class Library, and a few smaller frameworks like MacZoop. I think PowerPlant is closest to MFC. > I should finally be picking myself up a copy of CodeWarrior soon and I'm > interested in toying with some MacOS stuff, namely OpenDoc and > OSA/AppleScript. What work has already been done in these areas? I think you'll find some examples of this stuff on the CDs. > I would love to have Python in an OpenDoc/Cyberdog container. That would be great! ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Wed Sep 25 16:22:26 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 25 Sep 1996 17:22:26 +0200 Subject: [PYTHONMAC-SIG] Windowing debugger availble (alpha-test version) Message-ID: <9609251522.AA03952=jack@schelvis.cwi.nl> I've put an alpha-release of my new debugger TWIT (The Window-Independent Tracer) up for ftp in . Features: - graphical interface similar to MetroWerks debugger. - stack, local and global variables, source code, breakpoints all visible on-screen. - module browser allows you to look at any module and its variables - AppleEvent interface to external source editor - Just van Rossum's browser for complex data structures incorporated. - Useable for live and post-mortem debugging. Note the "alpha" bit: some things don't work yet (modifying variables, PM-debugging is not complete, "about" box crashes the debugger) and the "window-independence" bit of the name is a pure lie. Also, debugging FrameWork-based programs is probably impossible. Still, it is functional and I desparately need feedback on functionality and interface, so please give it a go, -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ------- End of Forwarded Message ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Thu Sep 26 17:29:27 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Thu, 26 Sep 1996 18:29:27 +0200 Subject: [PYTHONMAC-SIG] Twit 0.2 Message-ID: <9609261629.AA12401=jack@schelvis.cwi.nl> I found time to hack on twit some more today, so I've put version 0.2 in . Changes: - The interface has changed considerably (menus in stead of buttons) - you can start a new debug session when the previous one is over - double-clicking a python source while the debugger is running it will debug it (may also work with BBpy) - debugging FrameWork (and possibly als Tk or other windowing) applications should work -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From jeff@cynapses.com Mon Sep 30 16:51:15 1996 From: jeff@cynapses.com (jeffrey P. Shell) Date: Mon, 30 Sep 1996 09:51:15 -0600 Subject: [PYTHONMAC-SIG] Mac ftplib problems References: <324FD270.1305@cynapses.com> Message-ID: <324FEC73.3FC2@cynapses.com> i've experienced a lot of problems with 'ftplib' on MacPython.. i had these errors both in 1.3.3 and 1.4b3. Every command i execute just sends back a big traceback. It happens both on trying to get in anonymous (since there's no environment variables that i know of to sub in for the 'user@hostname' password, i thought that might be raising an error), but even when trying to get into my local ISP, i get odd errors and can't move around: > ftp.login('jshell','[password]') > Traceback (innermost last): > File "", line 1, in ? > File "Hard Disk:Desktop Folder:Documents:jeff's Ÿ:Python 1.4b3 CFM68K:Lib:ftplib.py", line 296, in login > resp = self.sendcmd('USER ' + user) > File "Hard Disk:Desktop Folder:Documents:jeff's Ÿ:Python 1.4b3 CFM68K:Lib:ftplib.py", line 222, in sendcmd > return self.getresp() > File "Hard Disk:Desktop Folder:Documents:jeff's Ÿ:Python 1.4b3 CFM68K:Lib:ftplib.py", line 198, in getresp > raise error_proto, resp > 331 Password required for jshell. this works just fine on the sunOS. -- .jPS || jeff@cynapses.com || http://www.cynapses.com/ry/ ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org ================= From Jack.Jansen@cwi.nl Mon Sep 30 21:14:41 1996 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 30 Sep 1996 22:14:41 +0200 Subject: [PYTHONMAC-SIG] Mac ftplib problems In-Reply-To: Message by "jeffrey P. Shell" , Mon, 30 Sep 1996 09:51:15 -0600 , <324FEC73.3FC2@cynapses.com> Message-ID: <9609302014.AA22687=jack@schelvis.cwi.nl> Recently, "jeffrey P. Shell" said: > i've experienced a lot of problems with 'ftplib' on MacPython.. i had=20 > these errors both in 1.3.3 and 1.4b3. Every command i execute just=20 > sends back a big traceback. It happens both on trying to get in=20 > anonymous (since there's no environment variables that i know of to sub=20 > in for the 'user@hostname' password, i thought that might be raising an=20 > error), but even when trying to get into my local ISP, i get odd errors=20 > and can't move around: This is very easy to fix: change the two "makefile('r')" calls in ftplib.py to "makefile('rb')". It took me about 20 seconds to find out what the problem was using twit :-) The strange thing is that I made this same fix a long time ago. It must have gotten lost somewhere along the way... -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm ================= PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org =================