From maccgi@bellsouth.net Fri Oct 1 00:23:54 1999 From: maccgi@bellsouth.net (Richard Gordon) Date: Thu, 30 Sep 1999 19:23:54 -0400 Subject: [Pythonmac-SIG] Problems with Tk using MacPython vers 1.5.2c1 In-Reply-To: References: Message-ID: At 10:31 -0500 09/30/1999, Brian J. Stankiewicz wrote: >I know that this is a bit of a newbie question, but I am trying to install >MacPython on my 8500 with OS 8.0 and I am having a difficult time figuring >out how to get the Tk commands to work. Here is a short session with the >search paths included, but when I try to import Tkinter it tries to find >_tkinter and cannot find the module. I found _tkinter.ppc.slib and placed >a re-named copy _tkinter in the extensions folder, but this didn't do the >trick either. Could someone please give me a hand on this? I'm not sure what the preferred approach to this is, but I ran into the same thing and fixed it by using EditPythonPrefs to add $(PYTHON):Extensions:Imaging:PIL: to my sys.path. I don't recall having to do that in the past, but at least it worked for me. Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) From btcoburn@oberlin.edu Fri Oct 1 04:19:02 1999 From: btcoburn@oberlin.edu (Ben Coburn) Date: Thu, 30 Sep 1999 23:19:02 -0400 (EDT) Subject: [Pythonmac-SIG] Problems with Tk using MacPython vers 1.5.2c1 In-Reply-To: Message-ID: On Thu, 30 Sep 1999, Richard Gordon wrote: > At 10:31 -0500 09/30/1999, Brian J. Stankiewicz wrote: > >I know that this is a bit of a newbie question, but I am trying to install > >MacPython on my 8500 with OS 8.0 and I am having a difficult time figuring > >out how to get the Tk commands to work. Here is a short session with the > >search paths included, but when I try to import Tkinter it tries to find > >_tkinter and cannot find the module. I found _tkinter.ppc.slib and placed > >a re-named copy _tkinter in the extensions folder, but this didn't do the > >trick either. Could someone please give me a hand on this? > I distinctly remember having to add $(PYTHON):Lib:lib-tk to the search path when I installed 1.5.2c1. You should not have to move any files. Regards, Ben Coburn ----------------------------------------------------------------------- Ben Coburn "Black holes are where God divided by zero." -Anon. btcoburn@oberlin.edu Offsite Paradox Associate Biochemistry & Biology Major Arcosanti Paradox Project Oberlin College http://www.arcosanti.org/paradox/ ----------------------------------------------------------------------- From bstankie@eye.psych.umn.edu Fri Oct 1 04:51:44 1999 From: bstankie@eye.psych.umn.edu (Brian J. Stankiewicz) Date: Thu, 30 Sep 1999 22:51:44 -0500 Subject: [Pythonmac-SIG] "A GUI Test Session" from Learning Python Crashes Message-ID: Is there a reason why running the code on pg. 23 of Learning Python crashes Python? I am able to get the dialog box up just fine, but when I hit the button titled "Hello", the program completely freezes and I have to "Kill" (Option-Apple-esc) out of Python. It won't even let me copy out of the command window. I am going to retype the trace-back for everyone's pleasure: >>> from Tkinter import * >>> w=Button(text="Hello",command='exit') >>> w.pack() >>> w.mainloop() Traceback (innermost last): File "", line 1, in ? File "Zamboo:Applications:Programming:Python 1.5.2c1:Lib:lib-self.tk.mainloop(n) File "Zamboo:Applications:Programming:Python 1.5.2c1:Lib:lib-tk:Tkinter.py",line 75 in _exit SystemExit: 0 The Tkwindow is blank, but it is still there. Any ideas? -Brian *-----------------------------------------------* | Brian J.Stankiewicz (o)612-624-7353 | | 75 East River Rd. (f)612-626-2079 | | Elliot Hall | | University of Minnesota | | Minneapolis, Minnesota 55455 | |-----------------------------------------------| |http://vision.psych.umn.edu/www/people/brian | | bstankie@eye.psych.umn.edu | *-----------------------------------------------* From bstankie@eye.psych.umn.edu Fri Oct 1 04:47:14 1999 From: bstankie@eye.psych.umn.edu (Brian J. Stankiewicz) Date: Thu, 30 Sep 1999 22:47:14 -0500 Subject: [Pythonmac-SIG] Tk installation fix Message-ID: Thanks to Ben Coburn and Richard Gordon I was able to get Tk to work on my mac. I fixed the problem by placing the following path's in the Python Preferences: $(PYTHON):Lib:lib-tk $(PYTHON):Extensions:Imaging:PIL Is there a reason that these two paths are not automatically set during the installation. I was a bit frustrated when I couldn't get through the example code in Chapter 1 of Learning Python (pg 23 has a Tk sample). -Brian *-----------------------------------------------* | Brian J.Stankiewicz (o)612-624-7353 | | 75 East River Rd. (f)612-626-2079 | | Elliot Hall | | University of Minnesota | | Minneapolis, Minnesota 55455 | |-----------------------------------------------| |http://vision.psych.umn.edu/www/people/brian | | bstankie@eye.psych.umn.edu | *-----------------------------------------------* From ita.mis@euro.apple.com Fri Oct 1 11:09:54 1999 From: ita.mis@euro.apple.com (Maero Tasselli) Date: Fri, 01 Oct 1999 12:09:54 +0200 Subject: [Pythonmac-SIG] python 1.5.2c1 performance Message-ID: <37F48870.2FE528C@euro.apple.com> Hi, I've read some comments about the degradation in performance for python 1.5.2c1 over 1.5.2b1. I never used the beta version but, for those interested, here is the pystone benchmark comparing version 1.5.1 and 1.5.2c1: PowerMac 9600/MP 112MB/RAM MACOS/8.6 Python 1.5.1 (20MB RAM partition) Pystone(1.1) time for 10000 passes = 2.73333 This machine benchmarks at 3658.54 pystones/second >>> Pystone(1.1) time for 10000 passes = 2.7 This machine benchmarks at 3703.7 pystones/second >>> Pystone(1.1) time for 10000 passes = 2.73333 This machine benchmarks at 3658.54 pystones/second >>> Pystone(1.1) time for 10000 passes = 2.65 This machine benchmarks at 3773.58 pystones/second >>> Pystone(1.1) time for 10000 passes = 2.76667 This machine benchmarks at 3614.46 pystones/second >>> Python 1.5.2c1 (20MB RAM partition) Pystone(1.1) time for 10000 passes = 2.75 This machine benchmarks at 3636.36 pystones/second >>> Pystone(1.1) time for 10000 passes = 2.71667 This machine benchmarks at 3680.98 pystones/second >>> Pystone(1.1) time for 10000 passes = 2.73333 This machine benchmarks at 3658.54 pystones/second >>> Pystone(1.1) time for 10000 passes = 2.73333 This machine benchmarks at 3658.54 pystones/second >>> Pystone(1.1) time for 10000 passes = 2.71667 This machine benchmarks at 3680.98 pystones/second >>> Regards Tasselli Marco From jhrsn@pop.pitt.edu Fri Oct 1 13:21:18 1999 From: jhrsn@pop.pitt.edu (Jim Harrison) Date: Fri, 1 Oct 1999 08:21:18 -0400 Subject: [Pythonmac-SIG] Advanced Editor patch -- change line endings Message-ID: <199910011216.IAA25128@post-ofc05.srv.cis.pitt.edu> >OK, here's a patch (at http://www.strout.net/python/mac/) which >extends the IDE's editor in a couple of ways: For newbies like me--remember to change the line endings to Mac after the files are downloaded, at least when downloading by dragging out of the Navigator window. BBedit or BBedit Lite works well for this. Bad things happen if you run these patches with unix line endings. Once that was done...this is awesome! Many thanks to Joe, Just, Jack and others who have worked on this. Also, function? and inspect() are great for those of use who are climbing the learning curve. Similar functionality with an option-click on the name in the IDE editor might be worth considering. Jim Harrison ________________________________________________________________________ James H. Harrison, Jr., MD, PhD Associate Director of Pathology Informatics, Department of Pathology Faculty Member in Residence, Center for Biomedical Informatics University of Pittsburgh Health System C920 PUH, 200 Lothrop Street Pittsburgh, PA 15213 jhrsn@pop.pitt.edu | voice: 412-647-5529 | fax: 412-647-9588 "If you want sense, you'll have to make it yourself!!"-Norton Juster ________________________________________________________________________ From joe@strout.net Fri Oct 1 15:50:19 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 1 Oct 1999 07:50:19 -0700 Subject: [Pythonmac-SIG] Advanced Editor patch -- change line endings In-Reply-To: <199910011216.IAA25128@post-ofc05.srv.cis.pitt.edu> References: <199910011216.IAA25128@post-ofc05.srv.cis.pitt.edu> Message-ID: At 8:21 AM -0400 10/01/99, Jim Harrison wrote: >For newbies like me--remember to change the line endings to Mac after the >files are downloaded, at least when downloading by dragging out of the >Navigator window. BBedit or BBedit Lite works well for this. Bad things >happen if you run these patches with unix line endings. This is a good point. There's a free tool called Cyclone which will do drag-and-drop conversion once you've configured it; I've put a note about it on my web page. >Once that was done...this is awesome! Many thanks to Joe, Just, Jack and >others who have worked on this. Also, function? and inspect() are great >for those of use who are climbing the learning curve. Good, glad it's proving useful. >Similar functionality with an option-click on the name in the IDE editor >might be worth considering. That's an excellent idea. OK, so the click modifiers we'll be having soon are: option-click: look for docstring on the clicked function or class command-click: copy the clicked chunk of text to the current cursor location Sounds good to me! Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From jack@oratrix.nl Fri Oct 1 16:49:51 1999 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 01 Oct 1999 17:49:51 +0200 Subject: [Pythonmac-SIG] Problems with Tk using MacPython vers 1.5.2c1 In-Reply-To: Message by "Brian J. Stankiewicz" , Thu, 30 Sep 1999 10:31:07 -0500 , Message-ID: <19991001154951.C0E7A36E440@snelboot.oratrix.nl> > I know that this is a bit of a newbie question, but I am trying to install > MacPython on my 8500 with OS 8.0 and I am having a difficult time figuring > out how to get the Tk commands to work. Here is a short session with the > search paths included, but when I try to import Tkinter it tries to find > _tkinter and cannot find the module. I found _tkinter.ppc.slib and placed > a re-named copy _tkinter in the extensions folder, but this didn't do the > trick either. Could someone please give me a hand on this? Brian, if I remember correctly Tk is an optional component, you did install it, did you? It could well be that if you _don't_ install it only the _tkinter module is not included but the Tkinter and friends are, giving the impression that you do have Tk installed. And where did you find the _tkinter.ppc.slb file? It should be in the PlugIns folder, if it was installed elsewhere that is the problem (mine, to be exact;-). -- 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 joe@strout.net Fri Oct 1 16:51:39 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 1 Oct 1999 08:51:39 -0700 Subject: [Pythonmac-SIG] PyAdvancedEditor.py update Message-ID: Hi all, I've updated PyAdvancedEditor. It now sports the following additional features: Better Chunking: The standard WASTE word-finding function isn't very appropriate for Python code; it breaks on underscores, doesn't break on periods, etc. AdvancedEditor gives you more Python-savvy chunks of text when you double-click. In addition, you can double-click a grouping character (a parenthesis, square bracket, curly brace, or quotation mark) to select the entire range delimited by that character. Note that the finding of quoted strings may not work correctly when triple-quoted strings are involved. Option Click -- Function Look-up: This feature looks up the function or class name you option-click on, without moving the cursor. Command Click -- Insert Chunk: When you command-click, the chunk of text at the location clicked is copied to the current cursor location. It's equivalent to double-clicking, doing a Copy, putting the cursor back to its previous location, and Paste (except that the clipboard is not modified). Because it uses the same chunking algorithm as double-clicking, this works nicely with grouping characters (like parentheses) too. To get these, all you need to do is download PyAdvancedEditor.py, fix the line endings, drop it in the Mac:Tools:IDE folder, and run BuildIDE.py. You do NOT need to reapply any patches. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From jack@oratrix.nl Fri Oct 1 17:00:59 1999 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 01 Oct 1999 18:00:59 +0200 Subject: [Pythonmac-SIG] Advanced Editor patch In-Reply-To: Message by "Joseph J. Strout" , Thu, 30 Sep 1999 13:49:32 -0700 , Message-ID: <19991001160059.D5DE736E440@snelboot.oratrix.nl> > Function Look-up: > > This feature looks for doc strings for a function or class when you > type a question mark ("?") after the function name in an editor > window. For example, go into any IDE editor window at type "string?". > The string.__doc__ will be printed to the output window. It also > works for functions, e.g. "string.strip?". When the query is > successful, the question mark is absorbed (not entered into the > editor). If you really need to type the question mark after a known > function, you'll have to type it first after a space, and then delete > the space. Joe, this is a great feature, but a rather hacky implementation, I think. Why not use command-questionmark or something like that? (Command-questionmark may be bad because it's bound to help) And also add it to the menu, what the command should do is assume the cursor in the frontmost window is at the end of (or in the middle of) the thing you want to look up. -- 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 Fri Oct 1 17:04:05 1999 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 01 Oct 1999 18:04:05 +0200 Subject: [Pythonmac-SIG] Problems with Tk using MacPython vers 1.5.2c1 In-Reply-To: Message by Richard Gordon , Thu, 30 Sep 1999 19:23:54 -0400 , Message-ID: <19991001160520.8968136E440@snelboot.oratrix.nl> > I'm not sure what the preferred approach to this is, but I ran into > the same thing and fixed it by using EditPythonPrefs to add > $(PYTHON):Extensions:Imaging:PIL: to my sys.path. I don't recall > having to do that in the past, but at least it worked for me. Ah, luckily that's Justs fault not mine (and he isn't here to contradict me:-). For reasons you don't want to know there are two _tkinters in what I send to him, and the one from PIL is what should be installed in the PlugIns folder. Apparently the installer missed that this time and puts it in the PIL folder. -- 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 joe@strout.net Fri Oct 1 17:18:56 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 1 Oct 1999 09:18:56 -0700 Subject: [Pythonmac-SIG] Advanced Editor patch In-Reply-To: <19991001160059.D5DE736E440@snelboot.oratrix.nl> References: <19991001160059.D5DE736E440@snelboot.oratrix.nl> Message-ID: At 6:00 PM +0200 10/01/99, Jack Jansen wrote: >this is a great feature, but a rather hacky implementation, I think. Why not >use command-questionmark or something like that? (Command-questionmark may be >bad because it's bound to help) Actually, it's not bound to anything as far as I can see. Maybe that would be a good solution. Another possibility would be something more analogous to what MCL does: do it whenever when you type an open-paren after a function name. Let the paren go through in any case (making it therefore somewhat less hackish than the current interface), but print out a docstring when you can. Naturally you'd want to be able to turn this feature off, so as to not clutter up your output window... Hmm, nope, I like Jack's idea better. Anybody else have an opinion on this? Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From schliep@zpr.uni-koeln.de Fri Oct 1 17:24:26 1999 From: schliep@zpr.uni-koeln.de (Alexander Schliep) Date: Fri, 1 Oct 1999 18:24:26 +0200 Subject: [Pythonmac-SIG] Problems with Tk using MacPython vers 1.5.2c1 In-Reply-To: Jack Jansen "Re: [Pythonmac-SIG] Problems with Tk using MacPython vers 1.5.2c1" (Oct 1, 5:49pm) References: <19991001154951.C0E7A36E440@snelboot.oratrix.nl> Message-ID: <9910011824.ZM21520@Octopussy.MI.Uni-Koeln.DE> On Oct 1, 5:49pm, Jack Jansen wrote: > Brian, > if I remember correctly Tk is an optional component, you did install it, did Nope. Tk is part of the distribution (as it should be). Is that Tk 8.2 btw ? > you? It could well be that if you _don't_ install it only the _tkinter module > is not included but the Tkinter and friends are, giving the impression that > you do have Tk installed. > > And where did you find the _tkinter.ppc.slb file? It should be in the PlugIns > folder, if it was installed elsewhere that is the problem (mine, to be > exact;-). I had to add $(PYTHON):Lib:lib-tk for import Tkinter to work (which is a bug, right?) and then $(Python):Extensions:Imaging:PIL for _tkinter to be found. Could the default Python Prefs please be changed such that Tk works out of the box ? Yours, Alexander -- Alexander Schliep schliep@zpr.uni-koeln.de ZPR/ZAIK Tel: +49-221-470-6011 (w) University of Cologne FAX: +49-221-470-5160 Weyertal 80 http://www.zpr.uni-koeln.de/~schliep 50931 Cologne, Germany From eddthompson@ssi.parlorcity.com Fri Oct 1 17:52:50 1999 From: eddthompson@ssi.parlorcity.com (EuphoriaDJ) Date: Fri, 1 Oct 1999 11:52:50 -0500 Subject: [Pythonmac-SIG] python mode for alpha In-Reply-To: <199910010503.BAA17829@python.org> Message-ID: I was digging through pythonftp and saw a listing for a mode for alpha but it is only the name not the file, does anyone know where I could get the file? An Elephant: A mouse built to government specifications Never try to out stubborn a cat Natural laws have no pity TTFN http://www.parlorcity.com/edd/index.html From maccgi@bellsouth.net Fri Oct 1 18:09:48 1999 From: maccgi@bellsouth.net (Richard Gordon) Date: Fri, 1 Oct 1999 13:09:48 -0400 Subject: [Pythonmac-SIG] "A GUI Test Session" from Learning Python Crashes In-Reply-To: References: Message-ID: At 22:51 -0500 09/30/1999, Brian J. Stankiewicz wrote: >Is there a reason why running the code on pg. 23 of Learning Python crashes >Python? I am able to get the dialog box up just fine, but when I hit the >button titled "Hello", the program completely freezes and I have to "Kill" >(Option-Apple-esc) out of Python. > >It won't even let me copy out of the command window. I am going to retype >the trace-back for everyone's pleasure: I get pretty much the same results including the freeze, but I do see a Hello button. I don't know what the story is here, but noticed that before running this, the author launches python with a startup script called runpy, so that may have something to do with it. I haven't experimented, but you might study the preceding pages to see what runpy is all about. Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) From joe@strout.net Fri Oct 1 19:14:25 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 1 Oct 1999 11:14:25 -0700 Subject: [Pythonmac-SIG] Advanced Editor patch In-Reply-To: <199910011729.NAA21902@post-ofc06.srv.cis.pitt.edu> References: <199910011729.NAA21902@post-ofc06.srv.cis.pitt.edu> Message-ID: At 1:34 PM -0400 10/01/99, Jim Harrison wrote: >When the ICeTEe extension is installed, command-clicks are trapped and >the clicked text is examined for a URL. If present, the URL is fed to the >browser indicated in Internet Config. This could cause a conflict with >your plans for command-clicks in the IDE. Oops, you're right, that's what it does. Hmph, I prefer the insert-chunk function, but command-click is something of a standard. Though it makes more sense in things like newsreaders and email apps than in a code editor. Glenn has suggested making these functions user-configurable, but I haven't thought of a good way to do that without increasing the complexity overmuch. Well, I'm open to suggestions here... at a minimum, I'll set up a little dictionary at the top of PyAdvancedEditor.py which maps the various modifier combinations to actions, so that you can rearrange the mappings that way. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From bstankie@eye.psych.umn.edu Fri Oct 1 22:00:21 1999 From: bstankie@eye.psych.umn.edu (Brian J. Stankiewicz) Date: Fri, 1 Oct 1999 16:00:21 -0500 Subject: [Pythonmac-SIG] "A GUI Test Session" from Learning Python Crashes In-Reply-To: References: Message-ID: Hi Richard and MP-SIG, Okay, I have done some more testing ont he problem and here are some more symptoms that I am finding. If I run one of the Demos (Demo:tkinter:Matt:Canvas-demo-sipmple.py) from the IDE I get the tk window displayed, but when I hit the "quit" button the Python completely freezes. However, if I run the same program by simply double-clicking on the .py file and running it in the Python interpretor only, it runs just fine and will quit gracefully. Are Richard and I the only ones suffering with this? Is this a problem with the IDE? -Brian At 1:09 PM -0400 10/1/99, Richard Gordon wrote: >At 22:51 -0500 09/30/1999, Brian J. Stankiewicz wrote: >>Is there a reason why running the code on pg. 23 of Learning Python crashes >>Python? I am able to get the dialog box up just fine, but when I hit the >>button titled "Hello", the program completely freezes and I have to "Kill" >>(Option-Apple-esc) out of Python. >> >>It won't even let me copy out of the command window. I am going to retype >>the trace-back for everyone's pleasure: > >I get pretty much the same results including the freeze, but I do see >a Hello button. I don't know what the story is here, but noticed that >before running this, the author launches python with a startup script >called runpy, so that may have something to do with it. I haven't >experimented, but you might study the preceding pages to see what >runpy is all about. > > >Richard Gordon >-------------------- >Gordon Consulting & Design >Database Design/Scripting Languages >mailto:richard@richardgordon.net >http://www.richardgordon.net >770.971.6887 (voice) >770.216.1829 (fax) ____________________________________________________________ Brian J.Stankiewicz, Ph.D. |bstankie@eye.psych.umn.edu 75 East River Rd. | Department of Psychology | University of Minnesota |(Off)612-624-7353 Minneapolis, Minnesota 55455 |(Fax)612-626-2079 ________________________________|___________________________ http://vision.psych.umn.edu/www/people/brian ____________________________________________________________ From maccgi@bellsouth.net Fri Oct 1 23:03:03 1999 From: maccgi@bellsouth.net (Richard Gordon) Date: Fri, 1 Oct 1999 18:03:03 -0400 Subject: [Pythonmac-SIG] "A GUI Test Session" from Learning Python Crashes In-Reply-To: References: Message-ID: At 14:58 -0700 10/01/1999, Joseph J. Strout wrote: >This is not too surprising. The IDE has its own menu bar. Tk has >its own menu bar. When you run a Tk program from within the IDE, >Tk's menu bar clobbers that of the IDE. When the Tk program quits, >there is no longer a valid menu bar, and the Mac goes off in search >of one and never comes back. ;) (Actually, it probably just shoots >itself.) Oh yeah, I forgot about that, but the book stuff that Brian originally mentioned breaks regardless of how it's run, so there's something else going on with that as well. Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) From joe@strout.net Fri Oct 1 22:58:20 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 1 Oct 1999 14:58:20 -0700 Subject: [Pythonmac-SIG] "A GUI Test Session" from Learning Python Crashes In-Reply-To: References: Message-ID: At 4:00 PM -0500 10/01/99, Brian J. Stankiewicz wrote: >Okay, I have done some more testing ont he problem and here are some more >symptoms that I am finding. If I run one of the Demos >(Demo:tkinter:Matt:Canvas-demo-sipmple.py) from the IDE I get the tk window >displayed, but when I hit the "quit" button the Python completely freezes. >However, if I run the same program by simply double-clicking on the .py >file and running it in the Python interpretor only, it runs just fine and >will quit gracefully. This is not too surprising. The IDE has its own menu bar. Tk has its own menu bar. When you run a Tk program from within the IDE, Tk's menu bar clobbers that of the IDE. When the Tk program quits, there is no longer a valid menu bar, and the Mac goes off in search of one and never comes back. ;) (Actually, it probably just shoots itself.) Sadly, the IDE is not good for making stand-alone apps which have their own menu bar, or for doing just about anything with Tk. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From andres@corrada.com Sat Oct 2 01:18:14 1999 From: andres@corrada.com (Andres Corrada) Date: Fri, 01 Oct 1999 20:18:14 -0400 Subject: [Pythonmac-SIG] python mode for alpha References: Message-ID: <37F54DBE.656034B3@corrada.com> I have the sit file for the alpha-mode if no one volunteers a site to download the file from. The mode is not maintained anymore by its author but it does a respectable job. ------------------------------------------------------- Andres Corrada-Emmanuel Email: andres@corrada.com Owner http://www.corrada.com/mamey Mamey Phone: (413) 587-9595 ------------------------------------------------------- From dozier@abs.net Sat Oct 2 04:19:27 1999 From: dozier@abs.net (Bill Dozier) Date: Fri, 01 Oct 1999 23:19:27 -0400 Subject: [Pythonmac-SIG] python mode for alpha Message-ID: <199910020326.XAA13720@vwww1.abs.net> > THIS MESSAGE IS IN MIME FORMAT. Since your mail reader does not understand this format, some or all of this message may not be legible. --MS_Mac_OE_3021664768_7267989_MIME_Part Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Here is an Alpha python mode written by Howard Oakley (howard@quercus.demon.co.uk, http://www.quercus.demon.co.uk). Since he posted this to comp.lang.python, I don't imagine he'll mind me offering it here. To load it, open the file with Alpha and let the app install the mode. --MS_Mac_OE_3021664768_7267989_MIME_Part Content-type: text/plain; name="pythonMode.tcl"; x-mac-creator="414C4641"; x-mac-type="54455854" Content-disposition: attachment Content-transfer-encoding: base64 IyAoYXV0by1pbnN0YWxsKQ0jIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIw0jIHB5dGhvbk1vZGUu dGNsDSMgIEhvd2FyZCBPYWtsZXksIEVITiAmIERJSiBPYWtsZXkNIyAgaG93YXJkQHF1ZXJj dXMuZGVtb24uY28udWsNIw0jIERlc2NyaXB0aW9uOg0jCVRoaXMgYXV0by1pbnN0YWxsaW5n IGZpbGUgaW1wbGVtZW50cyBhIHNpbXBsZSBtb2RlIGZvciBlZGl0aW5nDSMJUHl0aG9uIHVz aW5nIEFscGhhLiBJdCBoYXMgYmVlbiB0ZXN0ZWQgd2l0aCBBbHBoYSB2ZXJzaW9uIDcuMi4N IwlUaGUgZmVhdHVyZXMgb2YgdGhpcyBtb2RlIGluY2x1ZGU6DSMJc3ludGF4IGNvbG91cmlu ZyAtIGNvbW1lbnRzIGluIHJlZCwgc3RyaW5ncyAoc29tZSkgaW4gZ3JlZW4sDSMJCWtleXdv cmRzIGluIGJsdWUsIGFuZCBjb2xvbnMgKGEgUHl0aG9uIHBhcnRpY3VsYXIpIGluIG1hZ2Vu dGENIwllYXN5IHByb2R1Y3Rpb24gb2YgY29tbWVudCBib3hlcyBldGMuDSMJZGVmIGFuZCBj bGFzcyBtYXJraW5nIC0gYXV0b21hdGljYWxseSBnZW5lcmF0ZWQgbWFya3MgKE0gcG9wdXAp IGdpdmUNIwkJdGhlIGZ1bmN0aW9uIG5hbWUgZmlyc3QsIGFuZCB0aGVuIHRoZSBjbGFzcyAo aWYgYW55KSwgd2hpbHN0IGNsYXNzDSMJCWRlZmluaXRpb25zIGdpdmUgdGhlIGNsYXNzIG5h bWUgdHdpY2U7IHRoZSB7fSBwb3B1cCB0YWtlcw0jCQl5b3UgdG8gY2xhc3MgZGVmaW5pdGlv bnMNIwlhdXRvbWF0aWMgaW5kZW50YXRpb24gLSBnaXZlbiB0aGUgaW1wb3J0YW5jZSBvZiB0 aGlzIGluIFB5dGhvbiBjb250cm9sDSMJCXN0cnVjdHVyZXMsIHRoaXMgd2FzIGFuIGVzc2Vu dGlhbCwgYW5kIGlzIGFjY29tcGxpc2hlZA0jCQl1c2luZyB0YWJzIGluIHN5bnRhY3RpYyBj b250ZXh0Lg0jCVRoZSBjb2RlIGJlbG93IGlzIGEgY29iYmxpbmcgdG9nZXRoZXIgb2YgY29k ZSBzdG9sZW4gZnJvbSBvdGhlciBzb3VyY2VzLg0jCVdoaWxzdCB0aGUgZmluZSBjb2RlIG9m IHRoZSBvcmlnaW5hbCBzb3VyY2VzIGlzIHJlbGlhYmxlLCB0aGVyZSBhcmUNIwlhbGwgc29y dHMgb2YgbmFzdHkga2x1ZGdlcyB3aGljaCBJIGhhdmUgdXNlZCB0byBnZXQgaXQgdG8gZG8g d2hhdA0jCUkgbmVlZGVkLiBUY2wgcHVyaXN0cyB3aG8gY2FuIGltcHJvdmUgb24gaXQgYXJl IGludml0ZWQgdG8gZG8gc286DSMJcGxlYXNlIGUtbWFpbCB5b3VyIGNvcnJlY3Rpb25zIHRv IG1lIHNvIHRoYXQgSSBjYW4gbWFpbnRhaW4gdGhpcy4NIwlNeSB0aGFua3MgYW5kIGFwb2xv Z2llcyB0byB0aG9zZSBmcm9tIHdob20gSSBoYXZlIHN0b2xlbiBjb2RlLg0jIFZlcnNpb246 IDEuMCBkYXRlZCAxNyBTZXAgMTk5OSBbb3IgaWYgeW91IHByZWZlciBpdCwgMTk5OS0wOS0x N10uDSMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjDWFscGhhOjptb2RlIFB5dGggMS4wIGR1bW15 UHl0aCB7Ki5weX0ge2VsZWN0cmljQnJhY2VzIGVsZWN0cmljVGFiIGVsZWN0cmljUmV0dXJu fQ0NbmV3UHJlZgl2IGxlZnRGaWxsQ29sdW1uIHsxfSBQeXRoDW5ld1ByZWYJdiB3b3JkQnJl YWsge1x3K30gUHl0aA1uZXdQcmVmCWYgd29yZFdyYXAgezB9IFB5dGgNbmV3UHJlZgl2IGZ1 bmNFeHByIHteWyBcdF0qKGRlZnxjbGFzcylbIFx0XSsoW0EtWmEtejAtOV9dKyl9IFB5dGgN bmV3UHJlZgl2IHBhcnNlRXhwciB7XlsgXHRdKihbQS1aYS16MC05X10qKX0gUHl0aA1uZXdQ cmVmCXYgd29yZEJyZWFrUHJlZmFjZSB7XFd9IFB5dGgNbmV3UHJlZglmIGF1dG9NYXJrIDAg UHl0aA0NcHJvYyBkdW1teVB5dGgge30ge30NDSMgSSBleHRlbmQgdGhlIHJhbmdlIG9mIGtl eXdvcmRzIGEgbGl0dGxlLCB0byBpbmNsdWRlIHNvbWUgdHlwZSBjb252ZXJzaW9ucw0jIGFu ZCBvdGhlciBpbXBvcnRhbnQgaXRlbXMNDXNldCBweXRoS2V5V29yZHMgew0JYWNjZXNzIGFu ZCBicmVhayBjbGFzcyBjb250aW51ZSBkZWYgZGVsIGVsaWYgZWxzZQ0JZXhjZXB0IGV4ZWMg ZmluYWxseSBmb3IgZnJvbSBnbG9iYWwgaWYgaW1wb3J0IGluDQlpcyBsYW1iZGEgbm90IG9y IHBhc3MgcHJpbnQgcmFpc2UgcmV0dXJuIHNlbGYgdHJ5IHdoaWxlIA0JPSA8ID4gPD0gPj0g KyAqIC0gLyAhPSA8PiAlIHwgXiAmDQlsZW4gbWluIG1heCB+IGFicyBpbnQgbG9uZyBmbG9h dCBjb21wbGV4IGRpdm1vZCBwb3cNCWxpc3QgbWFwIHR1cGxlIGV2YWwgc3RyaW5nIHJlcHIg YXNzZXJ0DX0NDXJlZ01vZGVLZXl3b3JkcyAtZSB7I30gLXMgZ3JlZW4gLWMgcmVkIC1pIDog LUkgbWFnZW50YSAtayBibHVlIFB5dGggJHB5dGhLZXlXb3Jkcw11bnNldCBweXRoS2V5V29y ZHMNDWhvb2s6OnJlZ2lzdGVyIHNhdmVIb29rIG1vZGlmaWVkICJQeXRoIg0jPT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT0NIyBmb3IgVGNsIDguMCBjb21wYXRpYmlsaXR5LCBob3BlZnVs bHkNbmFtZXNwYWNlIGV2YWwgUHl0aCB7fQ0jPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0N DXByb2MgZHVtbXlQeXRoIHt9IHt9DQ0jIGZvciBlYXN5IHByb2R1Y3Rpb24gb2YgY29tbWVu dCBib3hlcyBldGMuDQ1zZXQgY29tbWVudENoYXJhY3RlcnMoUHl0aDpHZW5lcmFsKSAiXCMi DXNldCBjb21tZW50Q2hhcmFjdGVycyhQeXRoOlBhcmFncmFwaCkgW2xpc3QgIiMtLS0tIiAi Iy0tLS0iICIjIl0Nc2V0IGNvbW1lbnRDaGFyYWN0ZXJzKFB5dGg6Qm94KSBbbGlzdCAiIyIg MiAiIyIgMiAiIyIgM10NDSMgdGhlIG1hcmsgcm91dGluZSwgd2hpY2ggaGFzIHRvIGFwcGVu ZCB0aGUgY2xhc3MgbmFtZSAqaWYqIHRoZSBkZWZpbml0aW9uIGlzDSMgcGFydCBvZiBhIGNs YXNzIGRlZmluaXRpb24sIGJ1dCByZXNldCB0aGUgZW1wdHkgY2xhc3MgbmFtZSBpZiBpdCBp cyBub3QsDSMgaS5lLiB0aGVyZSBpcyBubyBsZWFkaW5nIHdoaXRlc3BhY2UgYmVmb3JlIHRo ZSAnZGVmJw0jIC0gdGhpcyB0aGVyZWZvcmUgYnVpbGRzIHRoZSBNIHBvcHVwIG1lbnUuDQ1w cm9jIFB5dGg6Ok1hcmtGaWxlIHt9IHsNCWdsb2JhbCBQeXRobW9kZVZhcnMNCXNldCBwb3Mg W21pblBvc10NCXNldCBjbGFzc25vbSAiIg0JDQl3aGlsZSB7IVtjYXRjaCB7c2VhcmNoIC1z IC1mIDEgLXIgMSAtbSAwIC1pIDEgJFB5dGhtb2RlVmFycyhmdW5jRXhwcikgJHBvc30gcmVz XX0gew0JCXNldCBzdGFydCBbbGluZGV4ICRyZXMgMF0NCQlzZXQgZW5kIFtwb3M6Om1hdGgg W2xpbmRleCAkcmVzIDFdICsgMV0NCQlzZXQgdGV4dCBbZ2V0VGV4dCAkc3RhcnQgJGVuZF0N CQkNCQlpZiB7W3JlZ2V4cAktaW5kaWNlcyB7KGNsYXNzKVsgXHRdKyhbYS16QS1aMC05X10r KX0gJHRleHQgZHVtbXkgZHVtbXkwCXBuYW1lXX0gew0JCSAgICBzZXQJaTEgW2V4cHIgW2xp bmRleCAkcG5hbWUJMF0JKyAkc3RhcnRdDQkJICAgIHNldAlpMglbZXhwciBbbGluZGV4ICRw bmFtZSAxXQkrICRzdGFydCArIDFdDSMgdGhpcyBpcyB0aGUgc3RhcnQgb2YgYSBjbGFzcyBk ZWZpbml0aW9uLCBzbyBzYXZlIHRoZSBjbGFzcyBuYW1lDQkJICAgIHNldAljbGFzc25vbSAg W2dldFRleHQgJGkxICRpMl0NCQl9IGVsc2Ugew0JCSAgICBpZiB7JHBvcyA+IFttaW5Qb3Nd fSB7DQkJCXNldCBwcCBbcG9zOjptYXRoICRzdGFydCAtIDFdDQkJCXNldCBwcSBbcG9zOjpt YXRoICRzdGFydCArIDFdDQkJCXNldCBwciBbZ2V0VGV4dCAkcHAgJHBxXQ0JCQlpZiB7IVty ZWdleHAge1sgXHRdK30gJHByXX0gew0jIHRoaXMgaXMgYSBzdGFuZGFsb25lIGRlZiwgdGhl cmVmb3JlIHJlc2V0IHRoZSBjbGFzcyBuYW1lIHRvIGFuIGVtcHR5IHN0cmluZw0JCQkgICAg c2V0IGNsYXNzbm9tICIiDQkJCX0NCQkgICAgfQ0JCX0NCQkJCQ0JCWlmIHtbcmVnZXhwCS1p bmRpY2VzIHsoZGVmfGNsYXNzKVsgXHRdKyhbYS16QS1aMC05X10rKX0gJHRleHQgZHVtbXkg ZHVtbXkwCXBuYW1lXX0Jew0JCQlzZXQJaTEgW2V4cHIgW2xpbmRleCAkcG5hbWUJMF0JKyAk c3RhcnRdDQkJCXNldAlpMglbZXhwciBbbGluZGV4ICRwbmFtZSAxXQkrICRzdGFydCArIDFd DQkJCXNldAl3b3JkICBbZ2V0VGV4dCAkaTEgJGkyXQ0JCQlzZXQJdG1wCVtjb25jYXQJJGkx CSRpMl0NIyBhc3NlbWJsZSB0aGUgbWFya2VyIG5hbWUgd2l0aCB0aGUgZGVmIGVsZW1lbnQg Zmlyc3QsIGZvbGxvd2VkIGJ5IGFueSBjbGFzcyBuYW1lDQkJCXNldCBvbF93b3JkIFsgam9p biBbY29uY2F0ICR3b3JkICIgIiAkY2xhc3Nub20gIiJdIF0NCQkJc2V0IGluZHMoJG9sX3dv cmQpICR0bXANCQl9DQ0JDQkJc2V0IHBvcyAkZW5kDQl9DQlpZiB7W2luZm8gZXhpc3RzIGlu ZHNdfSB7DSAgICAgIGZvcmVhY2ggZiBbbHNvcnQgLWlnbm9yZSBbYXJyYXkgbmFtZXMgaW5k c11dIHsNCQkJc2V0IHJlcyAkaW5kcygkZikNCQkJc2V0TmFtZWRNYXJrICRmIFtsaW5lU3Rh cnQgW2xpbmRleCAkcmVzIDBdXSBbbGluZGV4ICRyZXMgMF0gW2xpbmRleCAkcmVzIDFdDQkJ fQ0JfQ19DQ0jIHRoaXMgYnVpbGRzIHRoZSB7fSBtZW51IGFsb25nIHNpbWlsYXIgbGluZXMs IGJ1dCB0aGlzIHRpbWUgd2l0aCBqdXN0IGNsYXNzIGRlZmluaXRpb25zDXByb2MgUHl0aDo6 cGFyc2VGdW5jcyB7fSB7DQlnbG9iYWwgUHl0aG1vZGVWYXJzDQlzZXQgcG9zIFttaW5Qb3Nd DQkNCXdoaWxlIHshW2NhdGNoIHtzZWFyY2ggLXMgLWYgMSAtciAxIC1tIDAgLWkgMSAkUHl0 aG1vZGVWYXJzKGZ1bmNFeHByKSAkcG9zfSByZXNdfSB7DQkJc2V0IHN0YXJ0IFtsaW5kZXgg JHJlcyAwXQ0JCXNldCBlbmQgW3Bvczo6bWF0aCBbbGluZGV4ICRyZXMgMV0gKyAxXQ0JCXNl dCB0ZXh0IFtnZXRUZXh0ICRzdGFydCAkZW5kXQ0JCQ0JCWlmIHtbcmVnZXhwCS1pbmRpY2Vz IHsoY2xhc3MpWyBcdF0rKFthLXpBLVowLTlfXSspfSAkdGV4dCBkdW1teSBkdW1teTAJcG5h bWVdfSB7DQkJICAgIHNldAlpMSBbZXhwciBbbGluZGV4ICRwbmFtZQkwXQkrICRzdGFydF0N CQkgICAgc2V0CWkyCVtleHByIFtsaW5kZXggJHBuYW1lIDFdCSsgJHN0YXJ0ICsgMV0NCQkg ICAgc2V0CXdvcmQgIFtnZXRUZXh0ICRpMSAkaTJdDQkJICAgIHNldAl0bXAJW2NvbmNhdAkk aTEJJGkyXQ0JCSAgICBzZXQgaW5kcygkd29yZCkgJHRtcA0JCX0NCQlzZXQgcG9zICRlbmQN CX0NCXNldCBydG5SZXMge30NICAgIA0JaWYge1tpbmZvIGV4aXN0cyBpbmRzXX0gew0JICAg IGZvcmVhY2ggZiBbbHNvcnQgLWlnbm9yZSBbYXJyYXkgbmFtZXMgaW5kc11dIHsNCQlzZXQg bmV4dCBbbmV4dExpbmVTdGFydCAkaW5kcygkZildDQkJbGFwcGVuZCBydG5SZXMgJGYgJG5l eHQNCSAgICB9DQl9DQlyZXR1cm4gJHJ0blJlcyANfQ0NcHJvYyBQeXRoOjppbmRlbnRMaW5l IHt9IHsNICAgICMgZ2V0IGRldGFpbHMgb2YgY3VycmVudCBsaW5lDSAgICBzZXQgYmVnIFts aW5lU3RhcnQgW2dldFBvc11dDSAgICBzZXQgdGV4dCBbZ2V0VGV4dCAkYmVnIFtuZXh0TGlu ZVN0YXJ0ICRiZWddXQ0gICAgcmVnZXhwICJeXFsgXHRcXSoiICR0ZXh0IHdoaXRlDSAgICBz ZXQgbGVuIFtzdHJpbmcgbGVuZ3RoICR3aGl0ZV0NICAgIHNldCBlcG9zIFtwb3M6Om1hdGgg JGJlZyArICRsZW5dDSAgICANICAgICMgRmluZCBsYXN0IHByZXZpb3VzIG5vbi1jb21tZW50 IGxpbmUgYW5kIGdldCBpdHMgbGVhZGluZyB3aGl0ZXNwYWNlDSAgICBzZXQgcG9zICRiZWcN ICAgIHdoaWxlIDEgew0JaWYge1tjYXRjaCB7c2VhcmNoIC1zIC1mIDAgLXIgMSAtaSAwIC1t IDAgIl5cWyBcdFxdKlxbXiBcdFxyXG5cXSIgW3Bvczo6bWF0aCAkcG9zIC0gMV19IGxzdF19 IHsNCSAgICAjIHNlYXJjaCBmYWlsZWQgYXQgdG9wIG9mIGZpbGUNCSAgICBzZXQgbGluZSAi IyINCSAgICBzZXQgbHdoaXRlIDANCSAgICBicmVhaw0JfQ0JaWYgeyFbY2F0Y2gge3RleHQ6 OmluQ29tbWVudEJsb2NrIFtsaW5kZXggJGxzdCAwXX0gcmVzXX0gew0JICAgIHNldCBwb3Mg W2xpbmRleCAkcmVzIDBdDQl9IGVsc2Ugew0JICAgIHNldCBsaW5lIFtnZXRUZXh0IFtsaW5k ZXggJGxzdCAwXSBbcG9zOjptYXRoIFtuZXh0TGluZVN0YXJ0IFtsaW5kZXggJGxzdCAwXV0g LSAxXV0NCSAgICBzZXQgbHdoaXRlIFtwb3NYIFtwb3M6Om1hdGggW2xpbmRleCAkbHN0IDFd IC0gMV1dCQ0JICAgIGJyZWFrDQl9DSAgICB9DSMgd2UgbmVlZCAoc3ludGFjdGljYWxseSkg dG8gaW5jcmVhc2UgdGhlIHRhYnMgYnkgMSwgc28gZmlyc3QgZG8gdGhpcyB1c2luZw0jIHNw YWNlcywgYW5kIHRoZW4gY29udmVydCB0aGUgc3BhY2VzIHRvIGEgdGFiLiBUaGlzIGlzIG5v dCBlbGVnYW50LCBidXQgaXQgd29ya3MhICAgDSAgICBpZiB7W3JlZ2V4cCAiOlxbIFx0XF0q JCIgJGxpbmVdfSB7DQlnZXRXaW5JbmZvIGENCXNldCBwcyAkYSh0YWJzaXplKQ0JaW5jciBs d2hpdGUgJHBzDSAgICB9DSAgICBzZXQgbHdoaXRlIFt0ZXh0OjppbmRlbnRPZiAkbHdoaXRl XQ0gICAgaWYgeyR3aGl0ZSAhPSAkbHdoaXRlfSB7DQlyZXBsYWNlVGV4dCAkYmVnICRlcG9z ICRsd2hpdGUNCXNlbGVjdCAkYmVnIFskYmVnICsgW3N0cmluZyBsZW5ndGggJGx3aGl0ZV1d DQlzcGFjZXNUb1RhYnMNICAgIH0NICAgIGdvdG8gW3Bvczo6bWF0aCAkYmVnICsgW3N0cmlu ZyBsZW5ndGggJGx3aGl0ZV1dDX0N --MS_Mac_OE_3021664768_7267989_MIME_Part-- From stank005@tc.umn.edu Sat Oct 2 16:51:14 1999 From: stank005@tc.umn.edu (Kimlynnae Pleticha) Date: Sat, 2 Oct 1999 10:51:14 -0500 Subject: [Pythonmac-SIG] "A GUI Test Session" from Learning Python Crashes In-Reply-To: References: Message-ID: At 2:58 PM -0700 10/1/99, Joseph J. Strout wrote: >At 4:00 PM -0500 10/01/99, Brian J. Stankiewicz wrote: > >>Okay, I have done some more testing ont he problem and here are some more >>symptoms that I am finding. If I run one of the Demos >>(Demo:tkinter:Matt:Canvas-demo-sipmple.py) from the IDE I get the tk window >>displayed, but when I hit the "quit" button the Python completely freezes. >>However, if I run the same program by simply double-clicking on the .py >>file and running it in the Python interpretor only, it runs just fine and >>will quit gracefully. > >This is not too surprising. The IDE has its own menu bar. Tk has >its own menu bar. When you run a Tk program from within the IDE, >Tk's menu bar clobbers that of the IDE. When the Tk program quits, >there is no longer a valid menu bar, and the Mac goes off in search >of one and never comes back. ;) (Actually, it probably just shoots >itself.) Hmmm. I have to admit that this IS surprising to me. The IDE is a great environment to help debug code in, but it seems to me that it should be a bit more stable. Is there a way to create Tk code so that it doesn't clobber the IDE menu bar when it quits? Or is there a way to change the code in the IDE so that when running other Tk code the menu bar will not get clobbered? What methods have others used for writing Python Tk code? Thanks, -Brian From joe@strout.net Sat Oct 2 20:53:10 1999 From: joe@strout.net (Joseph J. Strout) Date: Sat, 2 Oct 1999 12:53:10 -0700 Subject: [Pythonmac-SIG] "A GUI Test Session" from Learning Python Crashes In-Reply-To: References: Message-ID: At 8:51 AM -0700 10/2/99, Kimlynnae Pleticha wrote: >Hmmm. I have to admit that this IS surprising to me. The IDE is a great >environment to help debug code in, but it seems to me that it should be a >bit more stable. Technically, this isn't an instability in the IDE -- it's a design limitation, but not "instability" when you run code that deliberately clobbers it (e.g., by overwriting its menus). In my experience, it's Tk that's instable. But I confess it's been a while since I tried it. >Is there a way to create Tk code so that it doesn't >clobber the IDE menu bar when it quits? I don't know. Tk on the Mac is pretty nasty no matter how you look at it, I think. > Or is there a way to change the code in the IDE so that when running >other Tk >code the menu bar will not get clobbered? Running Tk will probably always be hazardous, but I do wish you could more easily write stand-alone Mac programs in Python with the IDE. For this to work, you'd have to do something like what the codewarrior IDE does: launch the program as a separate process, and communicate with it via AppleEvents. Seems like it wouldn't be that hard to add... we could put a "Run Separately" option in the pop-up menu next to "Run As Main". When checked, it would launch a slave app, and pass it the code. The really hard part would be the debugger, though... hard to see how that would work. > What methods have others used for writing Python Tk code? You could use the BBEdit "Run As Python" plug-in with BBEdit or BBEdit Lite. This used to be included with MacPython; I'm not sure if it's still there or not. But why are you so determined to use Tk? If your objective is to learn Python, this is a painful way to do it. What is it you really want to do? If it's just to play around with graphics, I'd suggest you try PIDDLE instead; it works perfectly well within the IDE. (http://www.strout.net/python/piddle/) Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From jack@oratrix.nl Mon Oct 4 14:13:39 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 04 Oct 1999 15:13:39 +0200 Subject: [Pythonmac-SIG] MacPython and Tk In-Reply-To: Message by "Brian J. Stankiewicz" , Fri, 1 Oct 1999 16:00:21 -0500 , Message-ID: <19991004131340.2E06436E440@snelboot.oratrix.nl> Hmm. As various people have noted recently the quality-control on Tkinter with MacPython leaves quite a lot to be desired: - The installer doesn't install _tkinter in the right place - Tkinter programs do not work from the IDE - Simple Tk programs from "Learning Python" hang your system. Of all these only the second one (Tk and IDE don't like each other) is a known problem, and I think it is documented (but Just isn't around, or he'd know). The general problem is that Just and me are the main people responsible for MacPython, and neither of us uses Tkinter anymore (at least, not on the mac). Combine this with the fact that we're both really so busy that even getting out Python distributions in the first place is a problem and it becomes clear why the Tk part of the distribution doesn't have the quality it should. This is especially bad because Tk is used in early examples, and so it'll be something that is exposed to people new to MacPython in a rather early stage (thereby making MacPython as a whole look bad). What I'd really like is if someone stepped in and volunteered to maintain the mac version of the whole Tk stuff, ideally someone who uses Tkinter a lot anyway, so bugs are bound to show up quickly. And, of course, you'd need CodeWarrior to build the stuff, etc. Is anyone willing to take up Tkinter maintainance? -- 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 Mon Oct 4 14:21:33 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 04 Oct 1999 15:21:33 +0200 Subject: [Pythonmac-SIG] "A GUI Test Session" from Learning Python Crashes In-Reply-To: Message by "Joseph J. Strout" , Fri, 1 Oct 1999 14:58:20 -0700 , Message-ID: <19991004132134.1F87E36E440@snelboot.oratrix.nl> > This is not too surprising. The IDE has its own menu bar. Tk has > its own menu bar. When you run a Tk program from within the IDE, > Tk's menu bar clobbers that of the IDE. When the Tk program quits, > there is no longer a valid menu bar, and the Mac goes off in search > of one and never comes back. ;) (Actually, it probably just shoots > itself.) This is fixable, I did it for twit (the now-retired debugger of which some ideas have survived in IDE). Just keep two menu bars around, one to be installed when the user program runs and one for when IDE runs. IDE knows when it goes to user code (and when it comes back) so it can swap them at the right moment: def switch_to_app(self): self.dbg_menu_bar = Menu.GetMenuBar() Menu.SetMenuBar(self.app_menu_bar) Menu.DrawMenuBar() def switch_to_dbg(self): self.app_menu_bar = Menu.GetMenuBar() Menu.SetMenuBar(self.dbg_menu_bar) Menu.DrawMenuBar() Now, if an application (like a Tkinter app) messes with the menu bar that shouldn't influence operation of IDE. If anyone puts such code into the IDE please report back, -- 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 joe@strout.net Mon Oct 4 18:07:44 1999 From: joe@strout.net (Joseph J. Strout) Date: Mon, 4 Oct 1999 10:07:44 -0700 Subject: [Pythonmac-SIG] update to PyAdvancedEditor Message-ID: I've updated PyAdvancedEditor.py again. This update fixes a limitation in the selection of a quoted string by double-clicking one of the quotation marks; adds support for launching a URL by holding command+option while clicking; adds a little dictionary at the top of the file which defines what the modifier keys do, so you can easily change them; and also adds more color constants there so you can customize the syntax coloring. To install, grab PyAdvancedEditor.py from http://strout.net/python/mac/, put it in your Mac:Tools:IDE folder, and re-run BuildIDE.py. I still haven't changed the interface to the function look-up, but I probably will at some point as per Jack's suggestion. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From dozier@abs.net Mon Oct 4 19:30:25 1999 From: dozier@abs.net (Bill Dozier) Date: Mon, 04 Oct 1999 14:30:25 -0400 Subject: [Pythonmac-SIG] JPython and the IDE Message-ID: <199910041834.OAA11887@vwww1.abs.net> Hi, I've pretty much decided on using JPython on the Mac so that I can do GUIs without having to learn and wrap PowerPlant or wait for wxMac and hope that it is complete and as easy to use. The one catch that I run into is debugging. If I do straight Java, I can use CW's debugger, if I do straight Python, I can use Just's IDE. However, I want to use JPython.... Do you sirs think that using the IDE with JPython is doable? (I just tried running it with JPython and it immediately complains about not finding the MacOS module...I can't find it either...where is it?) If someone that knows how the IDE is put together (Just, Joe, ...?) gives me a hint or two, I'll try to make it work and then let everyone else in on how. Thanks! Bill From cbarker@jps.net Mon Oct 4 21:46:09 1999 From: cbarker@jps.net (Chris Barker) Date: Mon, 04 Oct 1999 13:46:09 -0700 Subject: [Pythonmac-SIG] Writing a Stand Alone GUI program with the IDE References: <199910030501.BAA18436@python.org> Message-ID: <37F91211.BE219A37@jps.net> Hi, As the discussion has shown, there are people that would like to be able to use the IDE to develop stand alone Python programs. It was pointed out the Tk has a lot of other limitations on the Mac, but I'd like to see any alteration of the IDE allow ANY gui toolkit. Personally, I'm holding out for WxPython. It is a pretty nice framework. By the way, is anyone putting any effort into improving the basic interpreter window? If it worked well, I would be a lot happier working without the IDE. When I use Python on Linux, I usually edit the code in emacs, and run it in the interpretter. I end up using "execfile" a lot. Specific things: Command line recall and editing!!! cut and paste to the command line. I'd love to see readline and rlcompeter functioning as well -Chris -- Christopher Barker, Ph.D. cbarker@jps.net --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ From draayer@door.net Tue Oct 5 07:40:39 1999 From: draayer@door.net (Dean E.Draayer) Date: Tue, 5 Oct 99 01:40:39 -0500 Subject: [Pythonmac-SIG] AskString dialog id error Message-ID: <19991005064738727.AAA44@mail.door.net@[208.247.125.80]> In EasyDialogs.py in the definition of AskString, the following line should be deleted: Line 75: id = 257 Evidently, the id parameter is being initialized with a default argument, so this line will clobber any user-supplied value for this argument. Dean Draayer From jack@oratrix.nl Tue Oct 5 09:49:37 1999 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 05 Oct 1999 10:49:37 +0200 Subject: [Pythonmac-SIG] JPython and the IDE In-Reply-To: Message by "Bill Dozier" , Mon, 04 Oct 1999 14:30:25 -0400 , <199910041834.OAA11887@vwww1.abs.net> Message-ID: <19991005084938.2859A35BB1E@snelboot.oratrix.nl> > Hi, > > I've pretty much decided on using JPython on the Mac so that I can do GUIs > without having to learn and wrap PowerPlant or wait for wxMac and hope that > it is complete and as easy to use. > > The one catch that I run into is debugging. If I do straight Java, I can use > CW's debugger, if I do straight Python, I can use Just's IDE. However, I > want to use JPython.... Forget about using the IDE: it is firmly embedded in the MacOS world, and none of the MacOS GUI calls are available in Java (and, hence in JPython). Your best bet is to look at what other people use to debug JPython. After all, Java pretends to be a machine architecture, so debugging should be the same no matter whether your virtual machine runs on Mac, Windows or Unix. Idle is also out, I think, as it uses Tk for windowing, but there must be something out there that uses Java windowing code... -- 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 Oct 5 09:52:27 1999 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 05 Oct 1999 10:52:27 +0200 Subject: [Pythonmac-SIG] Writing a Stand Alone GUI program with the IDE In-Reply-To: Message by Chris Barker , Mon, 04 Oct 1999 13:46:09 -0700 , <37F91211.BE219A37@jps.net> Message-ID: <19991005085228.0516035BB1E@snelboot.oratrix.nl> > By the way, is anyone putting any effort into improving the basic > interpreter window? If it worked well, I would be a lot happier working > without the IDE. When I use Python on Linux, I usually edit the code in > emacs, and run it in the interpretter. I end up using "execfile" a lot. One of the reasons Just started with the IDE is that the interpreter output window is so lousy. And fixing it was easier in Python than in C. -- 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 dmccarthy@ou.edu Wed Oct 6 15:34:14 1999 From: dmccarthy@ou.edu (David McCarthy) Date: Wed, 06 Oct 1999 14:34:14 +0000 Subject: [Pythonmac-SIG] Formerly stable app crashes my computer under 1.5.2 Message-ID: <37FB5DE1.9689343C@ou.edu> I have made an application that uses tkinter. It was pretty stable when run in the 1.5.1 interpreter but it now causes my computer to crash when I run it in 1.5.2. The application itself seems stable but the computer crashes after I quit python and open a new application or bring up a window from another currently active application. I have MacsBug installed and it gives me a message like the following: PowerPC unmapped memory exception at FFDBE458 NQDFillCRect+00184 I have also had problems with the popup menus in my application when the Appearance control panel is turned on under 1.5.1. Does anyone have a clue as to what might be going on? I'm assuming it might be a problem with tkinter Thanks Dave McCarthy From jhrsn@pop.pitt.edu Wed Oct 6 21:57:56 1999 From: jhrsn@pop.pitt.edu (Jim Harrison) Date: Wed, 6 Oct 1999 16:57:56 -0400 Subject: [Pythonmac-SIG] IDE class/method popup? Message-ID: <199910062055.QAA20754@post-ofc06.srv.cis.pitt.edu> The popup menu at the bottom left of my IDE script window lists methods and classes with popout arrows next to the class names, presumably for their contained methods. However, no menus pop out from these arrows. I presume that this is a "feature to be implemented," but I'm just checking to make sure I don't have a problem with my installation (system 8.6, Powerbook G3 "Wallstreet"). Jim Harrison ________________________________________________________________________ James H. Harrison, Jr., MD, PhD Associate Director of Pathology Informatics, Department of Pathology Faculty Member in Residence, Center for Biomedical Informatics University of Pittsburgh Health System C920 PUH, 200 Lothrop Street Pittsburgh, PA 15213 jhrsn@pop.pitt.edu | voice: 412-647-5529 | fax: 412-647-9588 "If you want sense, you'll have to make it yourself!!"-Norton Juster ________________________________________________________________________ From joe@strout.net Wed Oct 6 22:03:50 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 6 Oct 1999 14:03:50 -0700 Subject: [Pythonmac-SIG] IDE class/method popup? In-Reply-To: <199910062055.QAA20754@post-ofc06.srv.cis.pitt.edu> References: <199910062055.QAA20754@post-ofc06.srv.cis.pitt.edu> Message-ID: At 4:57 PM -0400 10/06/99, Jim Harrison wrote: >The popup menu at the bottom left of my IDE script window lists methods >and classes with popout arrows next to the class names, presumably for >their contained methods. Yep. > However, no menus pop out from these arrows. I >presume that this is a "feature to be implemented"... Nope, it's a feature that's been implemented for several versions now (as long as I've been using the IDE, I think). I have noticed that sometimes the method menus don't appear. This happens rarely, and I haven't been able to spot any particular pattern to it. I wonder if it has to do with low-memory conditions? Jim, if you increase your memory allocation to PythonIDE, does the problem disappear? Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From PClaerhout@CREO.BE Thu Oct 7 07:59:25 1999 From: PClaerhout@CREO.BE (Pieter Claerhout) Date: Thu, 7 Oct 1999 08:59:25 +0200 Subject: [Pythonmac-SIG] IDE class/method popup? Message-ID: <2B1262E83448D211AE4B00A0C9D61B03688563@MSGEURO1> Hello, I just had the same problem this week, and check if you use spaces instead of tabs for indentation. If you use spaces, the IDE will not show the methods for the classes If you use tabs, it will show them. I replaced all spaces in my script files with tabs and it worked for me (Python 1.5.2b1). Kind regards, 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 -----Original Message----- From: Joseph J. Strout [mailto:joe@strout.net] Sent: Wednesday, October 06, 1999 11:04 PM To: Jim Harrison; Python-SIG Subject: Re: [Pythonmac-SIG] IDE class/method popup? At 4:57 PM -0400 10/06/99, Jim Harrison wrote: >The popup menu at the bottom left of my IDE script window lists methods >and classes with popout arrows next to the class names, presumably for >their contained methods. Yep. > However, no menus pop out from these arrows. I >presume that this is a "feature to be implemented"... Nope, it's a feature that's been implemented for several versions now (as long as I've been using the IDE, I think). I have noticed that sometimes the method menus don't appear. This happens rarely, and I haven't been able to spot any particular pattern to it. I wonder if it has to do with low-memory conditions? Jim, if you increase your memory allocation to PythonIDE, does the problem disappear? Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://www.python.org/mailman/listinfo/pythonmac-sig From jhrsn@pop.pitt.edu Thu Oct 7 13:41:01 1999 From: jhrsn@pop.pitt.edu (Jim Harrison) Date: Thu, 7 Oct 1999 08:41:01 -0400 Subject: [Pythonmac-SIG] IDE class/method popup? Message-ID: <199910071238.IAA28025@post-ofc05.srv.cis.pitt.edu> >I just had the same problem this week, and check >if you use spaces instead of tabs for indentation. >If you use spaces, the IDE will not show the >methods for the classes If you use tabs, it will >show them. I replaced all spaces in my script files >with tabs and it worked for me (Python 1.5.2b1). That did it, thanks (version 1.5.2c1). This will make editing Linux python scripts interesting. Jim ________________________________________________________________________ James H. Harrison, Jr., MD, PhD Associate Director of Pathology Informatics, Department of Pathology Faculty Member in Residence, Center for Biomedical Informatics University of Pittsburgh Health System C920 PUH, 200 Lothrop Street Pittsburgh, PA 15213 jhrsn@pop.pitt.edu | voice: 412-647-5529 | fax: 412-647-9588 "If you want sense, you'll have to make it yourself!!"-Norton Juster ________________________________________________________________________ From cmann@pobox.com Thu Oct 7 15:08:29 1999 From: cmann@pobox.com (Chris,Mann) Date: Thu, 07 Oct 1999 10:08:29 -0400 Subject: [Pythonmac-SIG] Build Application/Applet Message-ID: <19991007140829.41F5B2F7AE@smtp.pobox.com> Hi- I wrote a little script to parse email digests into a tab delimited format. If I save the script as an applet from the IDE everything is fine. but if i use either the Build Application or Build Applet tools, I get a error saying there's a syntax error in my script (this happens when the tool is writing __main__). any ideas on where to look for the problem? I'm assuming if I can get Build Application to work, then people I give the script to won't have to have Python installed, correct? thanks -chris From joe@strout.net Thu Oct 7 15:44:41 1999 From: joe@strout.net (Joseph J. Strout) Date: Thu, 7 Oct 1999 07:44:41 -0700 Subject: [Pythonmac-SIG] IDE class/method popup? In-Reply-To: <199910071238.IAA28025@post-ofc05.srv.cis.pitt.edu> References: <199910071238.IAA28025@post-ofc05.srv.cis.pitt.edu> Message-ID: At 8:41 AM -0400 10/07/99, Jim Harrison wrote: > >I just had the same problem this week, and check > >if you use spaces instead of tabs for indentation. > >That did it, thanks (version 1.5.2c1). This will make editing Linux >python scripts interesting. You know, this issue has come up before. It occurs to me that the IDE has a "scripts" menu in which you can place any Python script you want to be easily accessible. Couldn't you write "Tabify" and "Detabify" scripts, and place them in this menu? They'd be designed to act on the frontmost window (if you need help getting a reference this window or its data, I can probably help). So when you suck your space-indented file down, you'd just "Tabify" it, and when you're ready to upload to Linux, you'd "Detabify" it (if you really feel the need -- personally, I just leave the tabs in). HTH, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From jack@oratrix.nl Thu Oct 7 16:51:25 1999 From: jack@oratrix.nl (Jack Jansen) Date: Thu, 07 Oct 1999 17:51:25 +0200 Subject: [Pythonmac-SIG] Build Application/Applet In-Reply-To: Message by "Chris,Mann" , Thu, 07 Oct 1999 10:08:29 -0400 , <19991007140829.41F5B2F7AE@smtp.pobox.com> Message-ID: <19991007155232.E033E35BB1E@snelboot.oratrix.nl> > Hi- > I wrote a little script to parse email digests into a tab delimited > format. If I save the script as an applet from the IDE everything is fine. > but if i use either the Build Application or Build Applet tools, I get a > error saying there's a syntax error in my script (this happens when the tool > is writing __main__). any ideas on where to look for the problem? Well, a good place would be the line where it reports the syntax error:-) Seriously: I assume that you don't get that info, for some reason. Try running your script with the interpreter (in stead of with the IDE), maybe it'll fail there too (and then, hopefully, with a linenumber). > I'm assuming if I can get Build Application to work, then people I give the > script to won't have to have Python installed, correct? Right. -- 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 cmann@pobox.com Thu Oct 7 18:07:28 1999 From: cmann@pobox.com (Chris,Mann) Date: Thu, 07 Oct 1999 13:07:28 -0400 Subject: [Pythonmac-SIG] Build Application/Applet Message-ID: <19991007170730.A97D22F7B0@smtp.pobox.com> > Well, a good place would be the line where it reports the syntax error:-) > > Seriously: I assume that you don't get that info, for some reason. Try running > your script with the interpreter (in stead of with the IDE), maybe it'll fail > there too (and then, hopefully, with a linenumber). nope. runs fine in both the IDE and the interpreter. Even saves fine as an applet from the IDE. But won't be converted into an applet or application by the two tools. Just get the error message, "Syntax error in script 'Data:Tools:parse_digest.py'" The .out window has a list of unused modules and then says, 'Adding "__main__"' when I get this error. Should I try running the Build_Application.py file in debug? -chris From cmann@pobox.com Thu Oct 7 20:37:25 1999 From: cmann@pobox.com (Chris,Mann) Date: Thu, 07 Oct 1999 15:37:25 -0400 Subject: [Pythonmac-SIG] Build Application/Applet Message-ID: <19991007193725.88E142F7F1@smtp.pobox.com> >> Hi- >> I wrote a little script to parse email digests into a tab delimited >> format. If I save the script as an applet from the IDE everything is fine. >> but if i use either the Build Application or Build Applet tools, I get a >> error saying there's a syntax error in my script (this happens when the tool >> is writing __main__). any ideas on where to look for the problem? I figured out what the problem was. One of the lines in my script had a tab after the text but before the linefeed. Once I removed that tab, everything built fine. Should this really affect building the application? -chris From draayer@door.net Fri Oct 8 08:02:54 1999 From: draayer@door.net (Dean E.Draayer) Date: Fri, 8 Oct 99 02:02:54 -0500 Subject: [Pythonmac-SIG] BBEdit "Run As Python" plug-in? Message-ID: <19991008071025864.AAA299@mail.door.net@[208.247.125.122]> >You could use the BBEdit "Run As Python" plug-in with BBEdit or BBEdit >Lite. This used to be included with MacPython; I'm not sure if it's still >there or not. I couldn't find it in my MacPython installation. Does anybody know where to find this plug-in? Dean Draayer From jack@oratrix.nl Fri Oct 8 10:47:27 1999 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 08 Oct 1999 11:47:27 +0200 Subject: [Pythonmac-SIG] BBEdit "Run As Python" plug-in? In-Reply-To: Message by "Dean E.Draayer" , Fri, 8 Oct 99 02:02:54 -0500 , <19991008071025864.AAA299@mail.door.net@[208.247.125.122]> Message-ID: <19991008094728.45E4B35BB1E@snelboot.oratrix.nl> > > >You could use the BBEdit "Run As Python" plug-in with BBEdit or BBEdit > >Lite. This used to be included with MacPython; I'm not sure if it's still > >there or not. > > I couldn't find it in my MacPython installation. Does anybody know where > to find this plug-in? Just discontinued it, as the IDE is supposed to do everything it did, and more. I think the sources can still be found in the Mac:Contrib folder, but I'm not sure. -- 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 Fri Oct 8 10:50:56 1999 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 08 Oct 1999 11:50:56 +0200 Subject: [Pythonmac-SIG] Build Application/Applet In-Reply-To: Message by "Chris,Mann" , Thu, 07 Oct 1999 15:37:25 -0400 , <19991007193725.88E142F7F1@smtp.pobox.com> Message-ID: <19991008095148.8385735BB1E@snelboot.oratrix.nl> > >> Hi- > >> I wrote a little script to parse email digests into a tab delimited > >> format. If I save the script as an applet from the IDE everything is fine. > >> but if i use either the Build Application or Build Applet tools, I get a > >> error saying there's a syntax error in my script (this happens when the tool > >> is writing __main__). any ideas on where to look for the problem? > > I figured out what the problem was. One of the lines in my script had a tab > after the text but before the linefeed. Once I removed that tab, everything > built fine. Should this really affect building the application? No, it definitely shouldn't. I've tried to reproduce the problem, but however many tabs I put after lines BuildApplet doesn't seem to care, so could you send me your sourcefile so I can have a look? Please send it binhexed, not straight ascii, as in this case we want to file to come across verbatim. -- 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 Fri Oct 8 11:28:27 1999 From: orla_redbird@crosswinds.net (Gordon Worley) Date: Fri, 8 Oct 1999 06:28:27 -0400 (EDT) Subject: [Pythonmac-SIG] Accessing front window in IDE Message-ID: Joesph Strout wrote: >>> to act on the frontmost window (if you need help getting a reference this window or its data, I can probably help). So when you suck your <<< Could you please write a short example of how to do this. I've tried in the past, but wasn't able to get very far. I'm sure others have had or are having a problem with this, so some help would be much appreciated. - Gordon Worley http://www.crosswinds.net/~orla_redbird/ mailto:orla_redbird@crosswinds.net From joe@strout.net Fri Oct 8 16:30:32 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 8 Oct 1999 08:30:32 -0700 Subject: [Pythonmac-SIG] Accessing front window in IDE In-Reply-To: References: Message-ID: At 6:28 AM -0400 10/08/99, Gordon Worley wrote: >Could you please write a short example of how to [get the frontmost window]. OK, here's a script that, when run, adds "# Spam!" to the end of the frontmost window if that's an editor window. You'll note a couple of simpler demos, which simply inspect the window or the editor object, commented out. Place this in your IDE Scripts folder, and get the IDE to rescan this folder with the "Python > Preferences > Set Scripts Folder" menu command. ---------------------------------------------------------------------- """ This script illustrates how to access the contents of the frontmost window in the Python IDE. Handy for making little utilities for the "Scripts" menu, like text reformatters and such. """ import W import Win import PyEdit import Res import PyAdvancedEditor # get a reference to the Python object corresponding to the frontmost window wid = Win.FrontWindow() if wid and W._application._windows.has_key(wid): window = W._application._windows[wid] else: window = None # now, see if that's an editor window... if window and isinstance(window, PyEdit.Editor): # yep, we have an editor window... do something with (or to) it! # demo 1: just inspect the window #inspect(window) # demo 2: inspect the actual editor #editor = window.editgroup.editor #inspect(editor) # demo 3: grab the text, and operate on it editor = window.editgroup.editor selStart, selEnd = editor.ted.WEGetSelection() text = editor.get() text = text + "\r# Spam!" editor.set(text) editor.ted.WESetSelection(selStart, selEnd) if isinstance(editor, PyAdvancedEditor.PyAdvancedEditor): editor.markDirty(0, len(text)) ---------------------------------------------------------------------- In the place where I've done "text = text + "\r# Spam!"", you could instead do any manipulation on the text you want -- it's the full text in the editor, with lines separated by '\r' characters. You could tabify, detabify, etc. Or you could leave the text alone, and do something with the window -- e.g., if you're good with AppleEvents, you could write us a "Reveal in Finder" script that switches to the Finder and selects the file corresponding to this editor window. If you do any of these, please post them here or on a web page so the rest of us can enjoy them too! Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From jack@oratrix.nl Fri Oct 8 16:53:13 1999 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 08 Oct 1999 17:53:13 +0200 Subject: [Pythonmac-SIG] Accessing front window in IDE In-Reply-To: Message by "Joseph J. Strout" , Fri, 8 Oct 1999 08:30:32 -0700 , Message-ID: <19991008155313.605A635BB1E@snelboot.oratrix.nl> > At 6:28 AM -0400 10/08/99, Gordon Worley wrote: > > >Could you please write a short example of how to [get the frontmost window]. > > OK, here's a script that, when run, adds "# Spam!" to the end of the > frontmost window if that's an editor window. Hmm, it would be nice to have a bit of an API for this that IDE extension scripts could use. If there was an easier interface than mucking around with the Window, PyEdit and waste internals that might prompt more people to write nifty little utilities. -- 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 joe@strout.net Fri Oct 8 17:01:41 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 8 Oct 1999 09:01:41 -0700 Subject: [Pythonmac-SIG] Accessing front window in IDE In-Reply-To: <19991008155313.605A635BB1E@snelboot.oratrix.nl> References: <19991008155313.605A635BB1E@snelboot.oratrix.nl> Message-ID: At 5:53 PM +0200 10/08/99, Jack Jansen wrote: >Hmm, it would be nice to have a bit of an API for this that IDE extension >scripts could use. If there was an easier interface than mucking around with >the Window, PyEdit and waste internals that might prompt more people to write >nifty little utilities. That's a good point. Seems like most of the time, you'd want to either change the text, or change the selection (e.g., if doing some sort of automatic search thing), or both. That's pretty easy. But then, what if somebody wants to write the "Reveal In Finder" script? That requires access to the window path; text and selection range aren't enough. So we add access to the path too; but what if there are other things we haven't thought of? Still, I guess we could do better than the current state of things. Maybe something like this: --------------------- hypothetical test code begins --------------------- from FrontWinAPI import FrontWinAPI # instantiate a front-window API object... automatically grabs text, # selection range, path, etc. win = FrontWinAPI() # insert "Spam!" to the top, and also move the selection range accordingly spam = "# Spam!\r" win.text = spam + win.text win.selStart = win.selStart + len(spam) win.selEnd = win.selEnd + len(spam) # that's it -- when win object dies, the front window is updated automagically --------------------- hypothetical test code ends --------------------- Is that the sort of thing you had in mind? Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From cbarker@jps.net Fri Oct 8 19:33:59 1999 From: cbarker@jps.net (Chris Barker) Date: Fri, 08 Oct 1999 11:33:59 -0700 Subject: [Pythonmac-SIG] tab vs spaces: Linux and mac References: <199910080502.BAA26631@python.org> Message-ID: <37FE3917.87B945C7@jps.net> This is a multi-part message in MIME format. --------------CF330202E61B206B95B49730 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, I confronted this probelm, as I develop python on both Linux and the Mac. My solution was to just stick with using ONLY tabs in all my python code, on both platforms. I did this because using spaces on the mac is a real pain, as most editors won't do anything automatically for you. Frankly, I think is a major shame that Python can use a mixture of spaces and tabs, as that can be a real nightmare, and doesn't fit at all with the "what you see is what you get" philosphy of making indentation part of the syntax , as what you see is only what you get if a tab equals 8 spaces. Anyway, Emacs python mode can be set to use only tabs, and I got a handy script from someone that will convert Python code to use any legal combination of spaces and tabs. I've enclosed it here. -have fun, -Chris -- Christopher Barker, Ph.D. cbarker@jps.net --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ --------------CF330202E61B206B95B49730 Content-Type: text/plain; charset=us-ascii; name="tabcleaner.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tabcleaner.py" #!/usr/bin/python import tokenize import string TABSONLY = 'TABSONLY' SPACESONLY = 'SPACESONLY' MIXED = 'MIXED' class PyText: def __init__(self, fnm, optdict): self.optdict = optdict self.fnm = fnm self.txt = open(self.fnm, 'r').readlines() self.indents = [(0, 0, )] self.lnndx = 0 self.indentndx = 0 def getline(self): if self.lnndx < len(self.txt): txt = self.txt[self.lnndx] self.lnndx = self.lnndx + 1 else: txt = '' return txt def tokeneater(self, type, token, start, end, line): if type == tokenize.INDENT: (lvl, s) = self.indents[-1] self.indents[-1] = (lvl, s, start[0]-1) self.indents.append((lvl+1, start[0]-1,)) elif type == tokenize.DEDENT: (lvl, s) = self.indents[-1] self.indents[-1] = (lvl, s, start[0]-1) self.indents.append((lvl-1, start[0]-1,)) elif type == tokenize.ENDMARKER: (lvl, s) = self.indents[-1] self.indents[-1] = (lvl, s, len(self.txt)) def split(self, ln): content = string.lstrip(ln) if not content: return ('', '\n') lead = ln[:len(ln) - len(content)] lead = string.expandtabs(lead) return (lead, content) def process(self): style = self.optdict.get('style', SPACESONLY) indent = string.atoi(self.optdict.get('indent', '4')) tabsz = string.atoi(self.optdict.get('tabs', '8')) print 'file %s -> style %s, tabsize %d, indent %d' % (self.fnm, style, tabsz, indent) tokenize.tokenize(self.getline, self.tokeneater) #import pprint #pprint.pprint(self.indents) new = [] for (lvl, s, e) in self.indents: if s >= len(self.txt): break if s == e: continue oldlead, content = self.split(self.txt[s]) #print "oldlead", len(oldlead), `oldlead` if style == TABSONLY: newlead = '\t'*lvl elif style == SPACESONLY: newlead = ' '*(indent*lvl) else: sz = indent*lvl t,spcs = divmod(sz, tabsz) newlead = '\t'*t + ' '*spcs new.append(newlead + content) for ln in self.txt[s+1:e]: lead, content = self.split(ln) #print "lead:", len(lead) new.append(newlead + lead[len(oldlead):] + content) self.save(new) #print "---", self.fnm #for ln in new: # print ln, #print def save(self, txt): bakname = os.path.splitext(self.fnm)[0]+'.bak' print "backing up", self.fnm, "to", bakname #print os.getcwd() try: os.rename(self.fnm, bakname) except os.error: os.remove(bakname) os.rename(self.fnm, bakname) open(self.fnm, 'w').writelines(txt) def test(): tc = PyText('test1.py') tc.process() tc = PyText('test1.py') tc.process(style=TABSONLY) tc = PyText('test1.py') tc.process(style=MIXED, indent=4, tabs=8) tc = PyText('test1.py') tc.process(style=MIXED, indent=2, tabs=8) def cleanfile(fnm, d): if os.path.isdir(fnm) and not os.path.islink(fnm): names = os.listdir(fnm) for name in names: fullnm = os.path.join(fnm, name) if (os.path.isdir(fullnm) and not os.path.islink(fullnm)) or \ os.path.normcase(fullnm[-3:]) == ".py": cleanfile(fullnm, d) return tc = PyText(fnm, d) tc.process() usage="""\ %s [options] [path...] options -T : reformat to TABS ONLY -S : reformat to SPACES ONLY ( -i option is important) -M : reformat to MIXED SPACES / TABS ( -t and -i options important) -t : tab is worth characters -i : indents should be characters -h : print this text path is file or directory """ if __name__ == '__main__': import sys, getopt, os opts, args = getopt.getopt(sys.argv[1:], "TSMht:i:") d = {} #print `opts` for opt in opts: if opt[0] == '-T': d['style'] = TABSONLY elif opt[0] == '-S': d['style'] = SPACESONLY elif opt[0] == '-M': d['style'] = MIXED elif opt[0] == '-t': d['tabs'] = opt[1] elif opt[0] == '-i': d['indent'] = opt[1] elif opt[0] == '-h': print usage % sys.argv[0] sys.exit(0) if not args: print usage % sys.argv[0] for arg in args: cleanfile(arg, d) --------------CF330202E61B206B95B49730-- From steele@cs.brandeis.edu Fri Oct 8 21:06:03 1999 From: steele@cs.brandeis.edu (Oliver Steele) Date: Fri, 8 Oct 1999 16:06:03 -0400 Subject: [Pythonmac-SIG] RE: IDE class/method popup? References: <199910080502.BAA26631@python.org> Message-ID: <008301bf11c8$9cab59f0$d22d70d8@lexeme.com> Pieter Claerhout: >I just had the same problem this week, and check >if you use spaces instead of tabs for indentation. Jim Harrison: >That did it, thanks (version 1.5.2c1). This will make editing Linux >python scripts interesting. Joe Strout: > You know, this issue has come up before. It occurs to me that the > IDE has a "scripts" menu in which you can place any Python script you > want to be easily accessible. Couldn't you write "Tabify" and > "Detabify" scripts, and place them in this menu? They'd be designed > to act on the frontmost window (if you need help getting a reference > this window or its data, I can probably help). So when you suck your > space-indented file down, you'd just "Tabify" it, and when you're > ready to upload to Linux, you'd "Detabify" it (if you really feel the > need -- personally, I just leave the tabs in). has a IDE patch called PyIDESpacesToTabsPatch.py: "make the IDE change spaces to tabs when it opens a file, and back to spaces when it writes it out". There are installation instructions at the top of the file. I've been using this with earlier versions of MacPython 1.5.2bx, to view and edit files from linux and the rest of the world. I haven't yet tested it with 1.5.2c1, or updated it to use Joe Strout's patch excellent mechanism. It assumes 4 spaces per tab stop. From steele@cs.brandeis.edu Sat Oct 9 12:09:40 1999 From: steele@cs.brandeis.edu (Oliver Steele) Date: Sat, 09 Oct 1999 07:09:40 -0400 Subject: [Pythonmac-SIG] line endings Message-ID: <199910091109.HAA00141@life.ai.mit.edu> Joseph J. Strout writes: >>OK, here's a patch (at http://www.strout.net/python/mac/) which >>extends the IDE's editor in a couple of ways: Jim Harrison writes: > For newbies like me--remember to change the line endings to Mac after the > files are downloaded, at least when downloading by dragging out of the > Navigator window. BBedit or BBedit Lite works well for this. Bad things > happen if you run these patches with unix line endings. The 1.5.2c1 PythonIDE can also do this. (It incorporates the PythonIDE-crlf-patch.txt patch I sent mail about a few months ago.) Open a UNIX or DOS-style file with the IDE, and it will ask whether to convert the line separators. Confirm, and then save the file. says that the StdCLib shared library has been changed for MacOS 9, such that "fgets now recognizes line endings for Mac, DOS, and UNIX files." I wonder if MacPython will inherit this behavior? (I don't know have access to MacOS 9, and I haven't read the Python sources to see where file.readline() is coming from, and whether the compiler uses this.) If it does, then UNIX/DOS-originated source files should compile under MacOS 9 (and anything else that uses readline should start working on foreign text files too). The editor will still need special casing to treat foreign line separator sequences as line separators, but if readline() and the compiler treat them the same, then the editor should be changed to do the conversion silently a la BBEdit, Alpha, and the Metrowerks IDE. From hung_jung_lu@adventure.com Sat Oct 9 17:21:56 1999 From: hung_jung_lu@adventure.com (Hung Jung Lu) Date: Sat, 9 Oct 1999 09:21:56 -0700 Subject: [Pythonmac-SIG] Folder alias, time offset Message-ID: <775C7FB8CE24D31195930008C745F54301CDE3@hermes.adventure.com> Hi, I am new here. Sorry if this has been asked before. I have two questions regarding Mac Python (1.5.1). (1) How can one make a folder alias? I know that macostools.mkalias(src, dst) makes a file alias, but it does not work for folders. (2) I consistently see that there is a mismatch between MacOS filesystem time and the operating system time. To be precise, they mismatch by around 4 years. Does that have something to do with MacIntosh's definition of epoch? (I believe that it is 1904/1/1, right?) Is this a know bug, or is there a reason behind it all? If this is an intended feature, then is there a standard way of converting time back and forth? (I typically get a filetime by using t=os.stat(filename)[8], it can then be views in formatted ASCII time by using print time.ctime(t), and I see that the printed time is 4 years younger.) regards, Hung Jung From richard@richardgordon.net Sat Oct 9 19:50:59 1999 From: richard@richardgordon.net (Richard Gordon) Date: Sat, 9 Oct 1999 14:50:59 -0400 Subject: [Pythonmac-SIG] How do you use macfs.FInfo? Message-ID: A friend of mine asked me to do an AppleScript droplet for him that would change the creator code of his gifs & jpegs from that of FireWorks or PhotoShop to the code for Picture Viewer. I know how to do that in AppleScript and probably know how to do it in MacPerl, but I decided to use Python instead because it's cool, etc. Anyway, naturally I'm now stuck. I gathered that what I wanted to use was macfs.FInfo, but I have yet to figure it out. The Python documentation deals with this in Sec. 7.3 and says that the FInfo Objects include: Creator The 4-character creator code of the file. That's all well and good, but when I try to use this, I just get >>> macfs.FInfo(thefile) so I guess that I am missing the point here. I'd appreciate any explanations about this and, while we're at it, what's the deal with FInfoType? Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) From bsayer@home.msen.com Sun Oct 10 02:45:29 1999 From: bsayer@home.msen.com (Ben Sayer) Date: Sat, 9 Oct 1999 21:45:29 -0400 Subject: [Pythonmac-SIG] How do you use macfs.FInfo? Message-ID: <19991009214529.026125@home.msen.com> On Sat, Oct 9, 1999, Richard Gordon wrote: >Anyway, naturally I'm now stuck. I gathered that what I wanted to use >was macfs.FInfo, but I have yet to figure it out. The Python >documentation deals with this in Sec. 7.3 and says that the FInfo >Objects include: > >Creator > The 4-character creator code of the file. > >That's all well and good, but when I try to use this, I just get > >>>> macfs.FInfo(thefile) > You need to use the macfs module, create an FSSpec object for the file, then use the SetCreatorType method of the file's FSSpec object. For example: import macfs offs = macfs.FSSpec('sample.jpg') offs.SetCreatorType('JVWR', 'JPEG') >I'd appreciate any explanations about this and, while we're at it, >what's the deal with FInfoType? My documentation states that the Finfo method creates a zero-filled FInfo object. This is clearly not what you want. I'm not sure what one would use the FInfo object type for, but I'm new to Mac programming too. --Ben From maccgi@bellsouth.net Sun Oct 10 04:23:30 1999 From: maccgi@bellsouth.net (Richard Gordon) Date: Sat, 9 Oct 1999 23:23:30 -0400 Subject: [Pythonmac-SIG] How do you use macfs.FInfo? In-Reply-To: <19991009214529.026125@home.msen.com> References: <19991009214529.026125@home.msen.com> Message-ID: At 21:45 -0400 10/09/1999, Ben Sayer wrote: >You need to use the macfs module, create an FSSpec object for the file, >then use the SetCreatorType method of the file's FSSpec object. For example: Thanks. Somebody previously sent me some offlist help along the same lines and I also ran across FixCreator.py in the distribution which was readily adaptable to what I wanted to do. Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) From jack@oratrix.nl Mon Oct 11 10:33:11 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 11 Oct 1999 11:33:11 +0200 Subject: [Pythonmac-SIG] Accessing front window in IDE In-Reply-To: Message by "Joseph J. Strout" , Fri, 8 Oct 1999 09:01:41 -0700 , Message-ID: <19991011093312.1527A35BB1E@snelboot.oratrix.nl> > >Hmm, it would be nice to have a bit of an API for this that IDE extension > >scripts could use. If there was an easier interface than mucking around with > >the Window, PyEdit and waste internals that might prompt more people to write > >nifty little utilities. > > That's a good point. Seems like most of the time, you'd want to > either change the text, or change the selection (e.g., if doing some > sort of automatic search thing), or both. That's pretty easy. > > But then, what if somebody wants to write the "Reveal In Finder" > script? That requires access to the window path; text and selection > range aren't enough. So we add access to the path too; but what if > there are other things we haven't thought of? More-or-less. I'm thinking along the lines of how other applications export functionality through AppleEvents. We would do it through Python objects, of course, but with a similar functionality. The object hierarchy would be something like IDE_application frontwindow() -> IDE_window getwindowbyname(name) -> IDE_window openwindow(filename) -> IDE_window ... IDE_window getselection() -> IDE_text gettextrange(from, to) ->IDE_text setselection(from, to) ... IDE_text get() -> string set(string) setcolor(r, g, b) ... -- 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 Mon Oct 11 10:44:58 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 11 Oct 1999 11:44:58 +0200 Subject: [Pythonmac-SIG] line endings In-Reply-To: Message by "Oliver Steele" , Sat, 09 Oct 1999 07:09:40 -0400 , <199910091109.HAA00141@life.ai.mit.edu> Message-ID: <19991011094458.E77CF35BB1E@snelboot.oratrix.nl> > says that the StdCLib > shared library has been changed for MacOS 9, such that "fgets now recognizes > line endings for Mac, DOS, and UNIX files." I wonder if MacPython will > inherit this behavior? Not directly, as MacPython uses the Metrowerks C library. I wouldn't be surprised if MW will nclude this behaviour as well, though, when StdCLib does. -- 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 Mon Oct 11 10:50:16 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 11 Oct 1999 11:50:16 +0200 Subject: [Pythonmac-SIG] Folder alias, time offset In-Reply-To: Message by Hung Jung Lu , Sat, 9 Oct 1999 09:21:56 -0700 , <775C7FB8CE24D31195930008C745F54301CDE3@hermes.adventure.com> Message-ID: <19991011095016.8FD9935BB1E@snelboot.oratrix.nl> > (1) How can one make a folder alias? I know that > macostools.mkalias(src, dst) > makes a file alias, but it does not work for folders. I'm surprised, I didn't know it didn't work for folders. If anyone has a patch please forward it to me too for inclusion in the source tree. > (2) I consistently see that there is a mismatch between MacOS > filesystem time and the operating system time. To be precise, > they mismatch by around 4 years. Does that have something > to do with MacIntosh's definition of epoch? > (I believe that it is 1904/1/1, right?) Is this a know bug, or is > there a reason behind it all? If this is an intended feature, then > is there a standard way of converting time back and forth? > (I typically get a filetime by using t=os.stat(filename)[8], it can > then be views in formatted ASCII time by using > print time.ctime(t), > and I see that the printed time is 4 years younger.) Aw, grmpf. Metrowerks keeps changing their idea of how to represent date/time, and MacPython gets hit by it time and again. There have been three epochs in use in the software MacPython uses: - The Mac epoch (1/1/1904, visible with GetFInfo() and such calls) - The Metrowerks C library epoch (1/1/1900) - The CWGUSI epoch. Apparently I've messed up in the conversion again (or maybe I should simply take out my workaround for MW's messup in a previous release). I'll have a look. -- 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 Mon Oct 11 10:54:49 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 11 Oct 1999 11:54:49 +0200 Subject: [Pythonmac-SIG] How do you use macfs.FInfo? In-Reply-To: Message by Ben Sayer , Sat, 9 Oct 1999 21:45:29 -0400 , <19991009214529.026125@home.msen.com> Message-ID: <19991011095449.9022D35BB1E@snelboot.oratrix.nl> > On Sat, Oct 9, 1999, Richard Gordon wrote: > > >Anyway, naturally I'm now stuck. I gathered that what I wanted to use > >was macfs.FInfo, but I have yet to figure it out. The Python > >documentation deals with this in Sec. 7.3 and says that the FInfo > >Objects include: > > > >Creator > > The 4-character creator code of the file. > > > >That's all well and good, but when I try to use this, I just get > > > >>>> macfs.FInfo(thefile) > > > > You need to use the macfs module, create an FSSpec object for the file, > then use the SetCreatorType method of the file's FSSpec object. For example: > > import macfs > > offs = macfs.FSSpec('sample.jpg') > offs.SetCreatorType('JVWR', 'JPEG') That works, but that doesn't use a FInfo object. It is the old method of setting creator/type, and while I would love to depracate it in favor of using FInfo it is used too often by too many people (including me:-) > >I'd appreciate any explanations about this and, while we're at it, > >what's the deal with FInfoType? > > My documentation states that the Finfo method creates a zero-filled FInfo > object. This is clearly not what you want. I'm not sure what one would > use the FInfo object type for, but I'm new to Mac programming too. A FInfo object holds all Finder Information of a file: not only creator and type but also icon position, flags, etc. The calls are fsspec.GetFInfo() -> FInfo object for the file fsspec.SetFInfo(finfo) Sets finder info Since occasionaly you need an empty finder info object there's also the FInfo() call to create an empty one. All the finder information is in attributes of the finfo object. -- 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 maccgi@bellsouth.net Mon Oct 11 15:23:36 1999 From: maccgi@bellsouth.net (Richard Gordon) Date: Mon, 11 Oct 1999 10:23:36 -0400 Subject: [Pythonmac-SIG] How do you use macfs.FInfo? In-Reply-To: <19991011095449.9022D35BB1E@snelboot.oratrix.nl> References: <19991011095449.9022D35BB1E@snelboot.oratrix.nl> Message-ID: --============_-1272470664==_ma============ Content-Type: text/plain; charset="us-ascii" ; format="flowed" At 11:54 +0200 10/11/1999, Jack Jansen wrote: >That works, but that doesn't use a FInfo object. It is the old method of >setting creator/type, and while I would love to depracate it in favor of using >FInfo it is used too often by too many people (including me:-) Well, I got past this stuff by butchering FixCreator.py from the distribution, but now I've got a slight mystery that I think has to do with recursive functions. When a search folder is selected, any subfolders within it are processed as well and I suppose that this would go on as deeply as they may be nested. That's fine, but I'm having trouble keeping a cumulative total of the files that have been analyzed to display in a dialog at the end of everything, e.g.: # import various things # set some variables for file types- we're converting gifs, etc, to PictureViewer ("ogle") def walktree(name, change): if os.path.isfile(name): fs = macfs.FSSpec(name) cur_cr, cur_tp = fs.GetCreatorType() if (cur_cr != NEW) and (cur_tp == GIF or JPEG or TIFF): fs.SetCreatorType(NEW, cur_tp) macostools.touched(fs) elif os.path.isdir(name): files = os.listdir(name) global lcounter lcounter = 0 for f in files: walktree(os.path.join(name, f), change) lcounter = lcounter + 1 def run(change): fss, ok = macfs.GetDirectory('Folder to search:') if not ok: sys.exit(0) start = time.time() walktree(fss.as_pathname(), change) stop = time.time() runtime = stop - start if runtime <= 1: theString = 'Finished analyzing %d files in 1 second. Pretty cool.' % runtime else: theString = 'Finished analyzing %d files in %d seconds. Pretty cool.' % (lcounter, runtime) # forgive the wrapping in Eudora EasyDialogs.Message(theString) if __name__ == '__main__': run(1) # EOF Because walktree keeps calling itself every time a new folder is encountered, the lcounter variable keeps being reset to 0, so the final dialog just says how many files happen to have been in the last folder processed. I've tried to park the current count in another variable, but if it's at the top level, it isn't seen for some reason and if it's set up as a global within walktree and initialized to 0, it keeps going back to 0 even tho I try to accumulate in it with something like totcounter = totcounter + lcounter. So, my question is where do you hide a cumulative counter when a function is recursive? Or do I need to take this whole thing apart and split walktree into 2 functions so it's no longer recursive in nature? Thanks. Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) --============_-1272470664==_ma============ Content-Type: text/enriched; charset="us-ascii" At 11:54 +0200 10/11/1999, Jack Jansen wrote: That works, but that doesn't use a FInfo object. It is the old method of setting creator/type, and while I would love to depracate it in favor of using FInfo it is used too often by too many people (including me:-) Well, I got past this stuff by butchering FixCreator.py from the distribution, but now I've got a slight mystery that I think has to do with recursive functions. When a search folder is selected, any subfolders within it are processed as well and I suppose that this would go on as deeply as they may be nested. That's fine, but I'm having trouble keeping a cumulative total of the files that have been analyzed to display in a dialog at the end of everything, e.g.: # import various things # set some variables for file types- we're converting gifs, etc, to PictureViewer ("ogle") def BFFF,0000,0000walktree(name, change): if os.path.isfile(name): fs = macfs.FSSpec(name) cur_cr, cur_tp = fs.GetCreatorType() if (cur_cr != NEW) and (cur_tp == GIF or JPEG or TIFF): fs.SetCreatorType(NEW, cur_tp) macostools.touched(fs) elif os.path.isdir(name): files = os.listdir(name) global lcounter lcounter = 0 for f in files: walktree(os.path.join(name, f), change) lcounter = lcounter + 1 defBFFF,0000,0000 run(change): fss, ok = macfs.GetDirectory(0000,7FFF,0000'Folder to search:') if not ok: sys.exit(0) start = time.time() walktree(fss.as_pathname(), change) stop = time.time() runtime = stop - start if runtime <<= 1: theString = 0000,7FFF,0000'Finished analyzing %d files in 1 second. Pretty cool.' % runtime else: theString = 0000,7FFF,0000'Finished analyzing %d files in %d seconds. Pretty cool.' % (lcounter, runtime) # forgive the wrapping in Eudora EasyDialogs.Message(theString) if __name__ == 0000,7FFF,0000'__main__': run(1) # EOF Because walktree keeps calling itself every time a new folder is encountered, the lcounter variable keeps being reset to 0, so the final dialog just says how many files happen to have been in the last folder processed. I've tried to park the current count in another variable, but if it's at the top level, it isn't seen for some reason and if it's set up as a global within walktree and initialized to 0, it keeps going back to 0 even tho I try to accumulate in it with something like totcounter = totcounter + lcounter. So, my question is where do you hide a cumulative counter when a function is recursive? Or do I need to take this whole thing apart and split walktree into 2 functions so it's no longer recursive in nature? Thanks. Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) --============_-1272470664==_ma============-- From jack@oratrix.nl Mon Oct 11 15:46:48 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 11 Oct 1999 16:46:48 +0200 Subject: [Pythonmac-SIG] How do you use macfs.FInfo? In-Reply-To: Message by Richard Gordon , Mon, 11 Oct 1999 10:23:36 -0400 , Message-ID: <19991011144649.45B1835BB1E@snelboot.oratrix.nl> That's fairly easy to fix: move the initialization of lcounter to outside the function and move your global statement to the top of the function (I'm not sure whether the latter is really needed, but everyone puts global statements at the top of their functions). And, while you're at it, in your first print statement replace "runtime" by "lcounter". In general, by the way, once you need global variables you're on the road to making your program more complex and it's better to use objects and classes. This program would become something like: class Walker: def __init__(self): self.lcounter = 0 def run(self, change): self.change = change .... self.walktree(fss.as_pathname) .... def walktree(self, name): ... # Replace change with self.change, walktree with # self.walktree, lcounter with self.lcounter if __name__ == '__main__': Walker().run(1) -- 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 maccgi@bellsouth.net Mon Oct 11 16:06:11 1999 From: maccgi@bellsouth.net (Richard Gordon) Date: Mon, 11 Oct 1999 11:06:11 -0400 Subject: [Pythonmac-SIG] How do you use macfs.FInfo? In-Reply-To: <19991011144649.45B1835BB1E@snelboot.oratrix.nl> References: <19991011144649.45B1835BB1E@snelboot.oratrix.nl> Message-ID: At 16:46 +0200 10/11/1999, Jack Jansen wrote: >That's fairly easy to fix: move the initialization of lcounter to outside the >function and move your global statement to the top of the function (I'm not >sure whether the latter is really needed, but everyone puts global statements >at the top of their functions). Thanks. I'll play with that and see what happens. >And, while you're at it, in your first print statement replace "runtime" by >"lcounter". Yeah, I saw that after I posted. The actual script is okay and I think that this got screwed up as I was editing the message. >In general, by the way, once you need global variables you're on the road to >making your program more complex and it's better to use objects and classes. >This program would become something like: Hmm, this will take a while to absorb, but thanks a lot. Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) From joe@strout.net Mon Oct 11 18:52:28 1999 From: joe@strout.net (Joseph J. Strout) Date: Mon, 11 Oct 1999 10:52:28 -0700 Subject: [Pythonmac-SIG] Accessing front window in IDE In-Reply-To: <19991011093312.1527A35BB1E@snelboot.oratrix.nl> References: <19991011093312.1527A35BB1E@snelboot.oratrix.nl> Message-ID: At 11:33 AM +0200 10/11/99, Jack Jansen wrote: >More-or-less. I'm thinking along the lines of... >IDE_application > frontwindow() -> IDE_window > getwindowbyname(name) -> IDE_window > openwindow(filename) -> IDE_window > ... >IDE_window > getselection() -> IDE_text > gettextrange(from, to) ->IDE_text > setselection(from, to) > ... >IDE_text > get() -> string > set(string) > setcolor(r, g, b) > ... But then, how is this any different from mucking about with IDE widgets, which is what I thought we wanted to avoid? The IDE objects already have methods like those above; apart from the names, I don't see much difference. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From joe@strout.net Mon Oct 11 19:10:49 1999 From: joe@strout.net (Joseph J. Strout) Date: Mon, 11 Oct 1999 11:10:49 -0700 Subject: [Pythonmac-SIG] How do you use macfs.FInfo? In-Reply-To: References: <19991011095449.9022D35BB1E@snelboot.oratrix.nl> Message-ID: At 10:23 AM -0400 10/11/99, Richard Gordon wrote: >So, my question is where do you hide a cumulative counter when a >function is recursive? You return it. E.g.: def process(spam): "process spam and all sub-spams, and return a total" total = 0 ... do some processing that increments localTotal... ... and now, for sub-spams: for subspam in subspams(spam): total = total + process(subspam) # all done! return the grand total return total See how the total is a sum of any local increments, plus all the totals of the sub-spams? Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From jpaint@sculpin.com Tue Oct 12 00:17:19 1999 From: jpaint@sculpin.com (Jay Painter) Date: Mon, 11 Oct 1999 16:17:19 -0700 (PDT) Subject: [Pythonmac-SIG] New OSAm + StuffIt Python Plugins Message-ID: I've uploaded a very revamped version of the OSAm module which fixes various memory problems, and other nastyness. This module allows you to execute AppleScript from within Python (it also allows you to compile and save scripts, and run pre-compiled scripts). There's also a new module I wrote, StuffIt, which uses the StuffIt SDK to expand/stuff .sit files as well as HQX encode and MacBin files. Unfortunatly, the licencing on the SDK is such that I cannot distribute a binary. If you want to use this, you'll have to download the StuffIt SDK and compile the my code aginst their headers and stub library. I had to write this module because StuffIt's AppleScript interface is very broken, and will crash the machine if you access it to many times. Both these modules can be found at: ftp://sculpin.com/python Regards, Jay Painter From hung_jung_lu@adventure.com Tue Oct 12 00:45:25 1999 From: hung_jung_lu@adventure.com (Hung Jung Lu) Date: Mon, 11 Oct 1999 16:45:25 -0700 Subject: [Pythonmac-SIG] Folder alias, time offset Message-ID: <775C7FB8CE24D31195930008C745F54301CDE7@hermes.adventure.com> Hmm... it does not seem trivial to create a folder alias. There is something special about the Alias Info, and Apple really does not want people to play with aliases from anything other than the Finder itself. (I have played with changing alias creator to 'MACS' and type to 'fdrp' and setting the alias bit in file info, and do everything else just like a file alias, but it does not work.) Hung Jung -----Original Message----- From: Jack Jansen [mailto:jack@oratrix.nl] Sent: Monday, October 11, 1999 2:50 AM To: Hung Jung Lu Cc: 'pythonmac-sig@python.org' Subject: Re: [Pythonmac-SIG] Folder alias, time offset > (1) How can one make a folder alias? I know that > macostools.mkalias(src, dst) > makes a file alias, but it does not work for folders. I'm surprised, I didn't know it didn't work for folders. If anyone has a patch please forward it to me too for inclusion in the source tree. From savageb@pacbell.net Tue Oct 12 01:54:28 1999 From: savageb@pacbell.net (savageb) Date: Mon, 11 Oct 1999 17:54:28 -0700 Subject: [Pythonmac-SIG] Python 1.5.2c says mxDateTime "too new"? Message-ID: <0FJG00647T6VXS@mta1.snfc21.pbi.net> Hello, I am having a hard time getting mxDateTime to run with Python 1.5.2c1. Joe, I seem to remember getting an error like this before, but I looked back through the sig archives and didn't see any mention of it. I'm hoping you or someone else knows what this means: Python 1.5.2c1 (#56, Apr 12 1999, 14:19:52) [CW PPC w/GUSI w/MSL] Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import DateTime Traceback (innermost last): File "", line 1, in ? File "Henrietta:Utilities:Python 1.5.2c1:Extensions:DateTime:DateTime.py", line 8, in ? from mxDateTime import * File "Henrietta:Utilities:Python 1.5.2c1:Extensions:DateTime:__init__.py", line 7, in ? __package_info__ = """ ImportError: PythonCore: An import library was too new for a client. >>> -thx, Bob From orla_redbird@crosswinds.net Tue Oct 12 11:05:28 1999 From: orla_redbird@crosswinds.net (Gordon Worley) Date: Tue, 12 Oct 1999 06:05:28 -0400 (EDT) Subject: IDE API [was Re: [Pythonmac-SIG] Accessing front window in IDE] Message-ID: Joseph J. Strout wrote: >>> But then, how is this any different from mucking about with IDE widgets, which is what I thought we wanted to avoid? The IDE objects already have methods like those above; apart from the names, I don't see much difference. <<< Instead of developing a new API, why not just add some documentation to the current code. I know this really is Just's deal, but I for one would very much like to see the W modules get some better descriptions. Trying to figure out what args that the callbacks on each type of widget takes is quite a nusance to me, so even if we have to develop a wrapper module for W and basic IDE functions, I think that it would be worth it for both the hope of getting code documented and some easier to read function, class, and method names (not that they aren't already pretty easy to read compared to some modules in a few of those *other* languages). - Gordon Worley http://www.crosswinds.net/~orla_redbird/ mailto:orla_redbird@crosswinds.net From just@letterror.com Tue Oct 12 14:04:00 1999 From: just@letterror.com (Just van Rossum) Date: Tue, 12 Oct 1999 15:04:00 +0200 Subject: [Pythonmac-SIG] Various IDE answers, comments Message-ID: Sorry I didn't mix in with the discussions earlier: I was away from my email for two weeks. I've tried to digest all traffic, but I'm sure I've missed a couple of points. Please email me privately if I failed to address some issues. 1. Class/method popup Currently it indeed only works for files that use tabs for indentation. This can easily be fixed separately from Oliver Steele's stuff, and I probably will very soon. But... 2. Non-tab indentation I might prefer to solve this as a file read/write filter which will transform any indentation into tab based indentation upon read and transform to the original style of indentation upon write. I would leave any non-indenting whitespace as it is. Would this be acceptable or would Oliver Steele's approach be preferred? 3. Printing Although I appreciate the efforts to add printing code to the IDE, I will not put those mods in the distribution until it supports the page setup and print records properly. Most notably: paper size and from/to page number fields. 4. Syntax coloring Similarly, as long as the code isn't solid (like IDLE's) I won't put it into the distribution, since it will be confusing for newbies if it screws up. Also, there needs to be a user interface for setting the various font/color properties. I meant to look into both issues long ago, but have not been able to do so. Don't get me wrong: I think syntax coloring is very important, and it's high on my wish list. I still hope to look into it deeper soon-ish. 5. IDE API There should indeed be a standard way to get to the frontmost script editor. I think this is best done through the application object, something like: import W app = W.getapplication() # this already works e = app.getfronteditor() 6. W documentation I admit that W is poorly documented. My collegue Erik has built some documentation for/from it for our RoboFog project. Please have a look at http://www.petr.nl/robofog/reference/index.html (click "module W" in the modules frame, other modules are RoboFog-specific) and let us know whether it's any good. Besides that, I will attempt to add more docstrings. Just From jimmy@cs.cofc.edu Tue Oct 12 17:23:27 1999 From: jimmy@cs.cofc.edu (James B. Wilkinson) Date: Tue, 12 Oct 1999 12:23:27 -0400 Subject: [Pythonmac-SIG] Is the menu enabled? Message-ID: Is there a way to get the toolbox to tell me whether a given menu is enabled or not at a given time. I'd prefer not to have to redraw the menu bar if I haven't actually made any changes in that property. Right now the only thing I can think of is to keep an instance variable in the application that gets set every time the enabled/disabled status of a menu changes. That would probably work, but I worry about having the variable somehow get out of step with what it's supposed to be tracking, and I'd prefer to have direct access to the real truth. I see that the Menu module implements the GetMenuHandle() function, but I have no idea how to use it in Python. In C, I think I could use the handle to get to the MenuInfo record and look at the enableFlags. How to do that in Python is beyond me, and I don't know how to learn anything beyond what I've done: type "import Menu" and "dir(Menu)". That tells me that GetMenuHandle() is there, but not how to use it. Is there a good way to answer questions like this, or do you just have to know? Thanks. ------------------------------------------------------------- Jimmy Wilkinson | Perfesser of Computer Science jimmy@cs.CofC.edu | The College of Charleston (843) 953-8160 | Charleston SC 29424 If there is one word to describe me, that word would have to be "profectionist". From joe@strout.net Tue Oct 12 17:51:06 1999 From: joe@strout.net (Joseph J. Strout) Date: Tue, 12 Oct 1999 09:51:06 -0700 Subject: [Pythonmac-SIG] Is the menu enabled? In-Reply-To: References: Message-ID: At 12:23 PM -0400 10/12/99, James B. Wilkinson wrote: >I see that the Menu module implements the GetMenuHandle() function, but I >have no idea how to use it in Python. In C, I think I could use the handle >to get to the MenuInfo record and look at the enableFlags. How to do that >in Python is beyond me, and I don't know how to learn anything beyond what >I've done: type "import Menu" and "dir(Menu)". That tells me that >GetMenuHandle() is there, but not how to use it. Is there a good way to >answer questions like this, or do you just have to know? Go it a step further. Start with "inspect(Menu)" rather than "dir(Menu)", as you'll have easy access to the docstrings for each function this way. Then do "foo = GetMenuHandle()" (passing whatever it needs passed to get this step to work), and then "inspect(foo)", which will show you the methods and members of foo. Now, foo is a resource object (resources and handles are the same thing in MacPython, for some odd reason). You can get its data (it's just a member, IIRC). That data is of the same format as documented in your favorite toolbox reference (i.e., whatever a MenuHandle refers to). You can use the struct module to unpack this and get whatever you need out of it. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From savageb@pacbell.net Tue Oct 12 19:06:20 1999 From: savageb@pacbell.net (Bob Savage) Date: Tue, 12 Oct 1999 11:06:20 -0700 Subject: [Pythonmac-SIG] W & Piddle (was Re: IDE API) Message-ID: <199910121806.LAA07011@smtp2.Stanford.EDU> >From: Gordon Worley >even if we have to develop a wrapper module for W >and basic IDE functions, I think that it would be worth it for both the >hope of getting code documented and some easier to read function, class, >and method names (not that they aren't already pretty easy to read compared >to some modules in a few of those *other* languages). > If some work went into a wrapper for W, would that lead to the ability to use PiddleQD w/out the IDE? -Bob From joe@strout.net Tue Oct 12 19:20:42 1999 From: joe@strout.net (Joseph J. Strout) Date: Tue, 12 Oct 1999 11:20:42 -0700 Subject: [Pythonmac-SIG] W & Piddle (was Re: IDE API) In-Reply-To: <199910121806.LAA07011@smtp2.Stanford.EDU> References: <199910121806.LAA07011@smtp2.Stanford.EDU> Message-ID: At 11:06 AM -0700 10/12/99, Bob Savage wrote: >If some work went into a wrapper for W, would that lead to the ability to >use PiddleQD w/out the IDE? Not the sort of wrapper we were thinking of before. It's probably quite possible to make piddleQD work without the IDE; but what we need isn't wrappers of existing code, so much as encapsulation. The IDE classes, W classes, and Framework classes seem to be a bit intertwined, and it's not clear to me how to separate them. What we'd need to do is load the Framework, and possible W, classes that are needed, and construct the piddleQD window on those. But I'm curious: what are you doing with piddleQD that isn't more convenient to do in the IDE anyway? Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From jpaint@sculpin.com Wed Oct 13 00:55:42 1999 From: jpaint@sculpin.com (Jay Painter) Date: Tue, 12 Oct 1999 16:55:42 -0700 (PDT) Subject: [Pythonmac-SIG] OSAm Binary Message-ID: I uploaded a new ftp://sculpin.com/python/OSAm.hqx which has a built plugin for Python 1.5.2c and a utility script (ascript.py) which is a useful Python wrapper for the plugin, and also serves as an example for using it. Regards, Jay Painter From A.M.INGRALDI@larc.nasa.gov Wed Oct 13 16:29:04 1999 From: A.M.INGRALDI@larc.nasa.gov (Anthony M. Ingraldi) Date: Wed, 13 Oct 1999 11:29:04 -0400 Subject: [Pythonmac-SIG] gnuplot on MacOS? Message-ID: <199910131529.LAA26491@express.larc.nasa.gov> On Thursday, September 30, 1999, Anthony M. Ingraldi wrote: > > I'll probably contact the author of the Gnuplot package to see if he would > be interested in incorporating the small mods into the Gnuplot distribution. > The author of Gnuplot has incorporated my changes to allow the package to run on Mac OS. They will be included in the next release. -- Tony Ingraldi A.M.INGRALDI@LaRC.NASA.GOV Phone : (757) 864-3039 Fax : (757) 864-7892 From joe@strout.net Wed Oct 13 21:51:05 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 13 Oct 1999 13:51:05 -0700 Subject: [Pythonmac-SIG] [pythonpiddle] Re: bug in piddlePIL ? or PIL 1.0 final In-Reply-To: References: Message-ID: At 11:31 AM -0700 10/13/99, Robert Kern wrote: >This is a known problem (Well, at least I knew it). PIL's function >arguments changed between the writing of piddlePIL and the release of PIL >1.0. piddlePIL will have to be rewritten for PIL 1.0. Ugh. This is a problem, because the version of PIL that comes with MacPython (the only flavor I really have access to) is 1.0b1. Apparently these function arguments changed between b1 and 1.0 final, because the test cases work just fine for me. I'm CC'ing this to the Mac-Python list, hoping Jack or Just will tell me that they've got PIL 1.0 final for the Mac just about ready to go and will send it out next week. Barring that, any ideas on how we can fix this in a way that will work on both 1.0 beta and 1.0 final (and presumably any version in between)? At worst, we could check the version and have alternate code. Chris wrote: >I made one change to the end of piddlePIL's drawLine() flattening the >tuples into one sequence: > > self._pen.line( (x1,y1),(x2,y2) ) -> self._pen.line((x1,y1,x2,y2)). To which I say, "Hmm." This doesn't look like it addresses the traceback you found before, which was on "ink = self.im.draw_ink(ink)". And you say that with this change, it all works except for the strings test -- what goes wrong with that one? Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From jack@oratrix.nl Thu Oct 14 10:08:57 1999 From: jack@oratrix.nl (Jack Jansen) Date: Thu, 14 Oct 1999 11:08:57 +0200 Subject: [Pythonmac-SIG] [pythonpiddle] Re: bug in piddlePIL ? or PIL 1.0 final In-Reply-To: Message by "Joseph J. Strout" , Wed, 13 Oct 1999 13:51:05 -0700 , Message-ID: <19991014090858.5E08F35BB1E@snelboot.oratrix.nl> > I'm CC'ing this to the Mac-Python list, hoping Jack or Just will tell > me that they've got PIL 1.0 final for the Mac just about ready to go > and will send it out next week. Sorry, I won't have any time for this for (at least) the next month or so. But: everything is under CVS, so dropping in the new PIL distribution, building it and doing a distribution of that isn't all that much work.... -- 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 steele@cs.brandeis.edu Thu Oct 14 11:24:11 1999 From: steele@cs.brandeis.edu (Oliver Steele) Date: Thu, 14 Oct 1999 06:24:11 -0400 Subject: [Pythonmac-SIG] space indented files Message-ID: <199910141024.GAA16626@life.ai.mit.edu> Just van Rossum writes: > 2. Non-tab indentation > I might prefer to solve this as a file read/write filter which will > transform any indentation into tab based indentation upon read and > transform to the original style of indentation upon write. I would leave > any non-indenting whitespace as it is. Would this be acceptable or would > Oliver Steele's approach be preferred? Let's call the approach that recognizes space-runs as equivalent to tabs, "space recognition". Let's call the approach that translates space-based indentation into tab-based indentation, and back, "space translation". "Space recognition" is what emacs does, and it's what you call "Oliver Steele's approach" above. "Space translation" is the method that you "might prefer to solve this as". I've actually implemented both. SpaceTranslationPatch.py implements space TRANSLATION: it "makes the IDE change spaces in space-indented files to tabs when it opens them, and back to spaces when it saves a file that was converted this way." PythonSpaceEditor.py implements space RECOGNITION: it "makes the IDE work with space-indented source files, by changing its indentation-related commands to recognize that a sequence of spaces is equivalent to a tab." After using them both, I prefer the space translation approach, in SpaceTranslationPatch.py. (This is the same preference as Just's.) I initially implemented space recognition because I thought it would be good to stick to a known design -- that is, to copy what emacs does, because it works -- and because it's guaranteed to preserve the contents of the file (opening and then saving a file with the space transformation approach may change some spaces to tabs, if a file has both). But it's too annoying on a Mac to click in what looks like a tab stop and find yourself in the middle of a set of spaces, or to use the left or right arrows or the backspace to move what looks like one tab and find yourself moving only a space. These problems could be fixed with additional work, but at that point the text presentation has diverged from the underlying data so much that I think it's better just to change the underlying data instead, and keep the connection between it and its presentation direct. (Emacs users live with these problems, but they seem worse in a Mac environment, maybe because I'm used to a higher standard for direct manipulation) SpaceTranslationPatch.py's algorithm is this: (1) When an editor window is opened for a file, detect whether it contains the string '\r ' (a line that starts with four spaces). (2) If it does, assume that it's a space-indented file. If the file was saved with Python font preferences, read the tab width from that. Otherwise if there are lines that start after eight spaces but not after four, assume the tab stop is at 8 spaces. Otherwise assume it's at four. (3) Set the editor tab width to this. (4) Replace all runs of tabstop*n spaces at the beginning of a line, with n tabs. Also, set a flag on the editor window, that marks that the conversion was performed. (5) When an editor window is saved, if this flag is set, replace all runs or n tabs at the beginning of a line with tabstop*n spaces. This eases interoperability with other platforms that uses spaces to indent. Remaining work: - recognize files indented with a mixture of tabs and spaces - test the heuristics on more files - add a user indication and user control for the translation (I probably won't do this one, but if it gets added to the IDE someone might want to do this) From steele@cs.brandeis.edu Sat Oct 16 16:54:02 1999 From: steele@cs.brandeis.edu (Oliver Steele) Date: Sat, 16 Oct 1999 11:54:02 -0400 Subject: [Pythonmac-SIG] CommandHistoryPatch Message-ID: <199910161554.LAA18933@life.ai.mit.edu> CommandHistoryPatch.py adds to the Python Interactive window of MacPython 1.5.2c1 IDE two features that I've found useful in command shells and in other IDEs. (It probably works with earlier versions of MacPython, but I haven't tested it with any versions other than 1.5.2c1.) (1) Option-p (pi) replaces the current input text (everything after the ">>> " or "... " prompt) with the previous input text (the line or lines after the previous ">>> " or "... " prompt). Typing option-p repeatedly cycles through all the previous inputs, from last to first, and then from last to first again. (2) Pressing the Return key to execute the entire input text, no matter where in the text the selection is positioned. For example, typing Return when the insertion point is between the "+" and the "2" in the line >>> 1+2 prints the result "3", instead of ignoring the "2", asking for a continuation line, and then displaying a message about a syntax error. The patch can be downloaded from . I recommend we think about including this in the IDE at some point, but it's probably useful for folks to play around with it and weigh in on how well it works for them first. In particular, I'm unsure about option-p for the "previous" command (it keeps you from typing pi, and the natural pair for "next", option-n, doesn't easily produce a capturable keystroke), although each alternative has its own issues (for example, cmd-p would work, but then cmd-n is already taken...). From joe@strout.net Sat Oct 16 20:04:48 1999 From: joe@strout.net (Joseph J. Strout) Date: Sat, 16 Oct 1999 12:04:48 -0700 Subject: [Pythonmac-SIG] CommandHistoryPatch In-Reply-To: <199910161554.LAA18933@life.ai.mit.edu> Message-ID: At 8:54 AM -0700 10/16/99, Oliver Steele wrote: >I recommend we think about including this in the IDE at some point, but it's >probably useful for folks to play around with it and weigh in on how well it >works for them first. This sounds very cool. I think this key mapping is similar to what MCL uses, though I wouldn't swear by it -- I also wouldn't claim it's the best possible. Is it possible to detect control-up and control-down? Or maybe page up/down or home/end? Or control-p and control-n? >each alternative has its own issues (for example, cmd-p would work, but then >cmd-n is already taken...). Yeah, and cmd-p usually means "print" (as it does, for example, with the printing patch installed). Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From savageb@pacbell.net Mon Oct 18 06:15:30 1999 From: savageb@pacbell.net (savageb) Date: Sun, 17 Oct 1999 22:15:30 -0700 Subject: [Pythonmac-SIG] CommandHistoryPatch Message-ID: <0FJS00A739A02G@mta3.snfc21.pbi.net> > > This sounds very cool. I think this key mapping is similar to what MCL > uses, though I wouldn't swear by it -- I also wouldn't claim it's the best > possible. Is it possible to detect control-up and control-down? Or maybe > page up/down or home/end? Or control-p and control-n? > Yes, TCSH seems to respond to simply using the up/down keys, but I think ctrl-up/ctrl-down seems logical. Bob From cbarker@jps.net Mon Oct 18 18:45:32 1999 From: cbarker@jps.net (Chris Barker) Date: Mon, 18 Oct 1999 10:45:32 -0700 Subject: [Pythonmac-SIG] space indented files References: <199910150501.BAA25996@python.org> Message-ID: <380B5CBC.E6CA3F83@jps.net> This is a multi-part message in MIME format. --------------1B1EF91C859852EFAA66EB3D Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Oliver Steele wrote: **************************************** Remaining work: - recognize files indented with a mixture of tabs and spaces - test the heuristics on more files - add a user indication and user control for the translation (I probably won't do this one, but if it gets added to the IDE someone might want to do this) **************************************** This sounds great! I don't know if it will be helpful, but I've enclosed a script I got from someone that does tab-space-tab+space translation for you (I'd love to credit the author, but s/he did't put a name in the file, and I don't remember who i got it from). I suppose the tricky part is to figure out what format was orignally used. I have to say, though, that I'd be just as happy if tab+spaces was NOT preserved! using the two together is a great way to invite problems. Note also, that if the file uses a mixture of tabs and spaces, you have to use a tabstop of 8 spaces, as this is what Python assumes. -- Christopher Barker, Ph.D. cbarker@jps.net --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ --------------1B1EF91C859852EFAA66EB3D Content-Type: text/plain; charset=us-ascii; name="tabcleaner.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tabcleaner.py" #!/usr/bin/python import tokenize import string TABSONLY = 'TABSONLY' SPACESONLY = 'SPACESONLY' MIXED = 'MIXED' class PyText: def __init__(self, fnm, optdict): self.optdict = optdict self.fnm = fnm self.txt = open(self.fnm, 'r').readlines() self.indents = [(0, 0, )] self.lnndx = 0 self.indentndx = 0 def getline(self): if self.lnndx < len(self.txt): txt = self.txt[self.lnndx] self.lnndx = self.lnndx + 1 else: txt = '' return txt def tokeneater(self, type, token, start, end, line): if type == tokenize.INDENT: (lvl, s) = self.indents[-1] self.indents[-1] = (lvl, s, start[0]-1) self.indents.append((lvl+1, start[0]-1,)) elif type == tokenize.DEDENT: (lvl, s) = self.indents[-1] self.indents[-1] = (lvl, s, start[0]-1) self.indents.append((lvl-1, start[0]-1,)) elif type == tokenize.ENDMARKER: (lvl, s) = self.indents[-1] self.indents[-1] = (lvl, s, len(self.txt)) def split(self, ln): content = string.lstrip(ln) if not content: return ('', '\n') lead = ln[:len(ln) - len(content)] lead = string.expandtabs(lead) return (lead, content) def process(self): style = self.optdict.get('style', SPACESONLY) indent = string.atoi(self.optdict.get('indent', '4')) tabsz = string.atoi(self.optdict.get('tabs', '8')) print 'file %s -> style %s, tabsize %d, indent %d' % (self.fnm, style, tabsz, indent) tokenize.tokenize(self.getline, self.tokeneater) #import pprint #pprint.pprint(self.indents) new = [] for (lvl, s, e) in self.indents: if s >= len(self.txt): break if s == e: continue oldlead, content = self.split(self.txt[s]) #print "oldlead", len(oldlead), `oldlead` if style == TABSONLY: newlead = '\t'*lvl elif style == SPACESONLY: newlead = ' '*(indent*lvl) else: sz = indent*lvl t,spcs = divmod(sz, tabsz) newlead = '\t'*t + ' '*spcs new.append(newlead + content) for ln in self.txt[s+1:e]: lead, content = self.split(ln) #print "lead:", len(lead) new.append(newlead + lead[len(oldlead):] + content) self.save(new) #print "---", self.fnm #for ln in new: # print ln, #print def save(self, txt): bakname = os.path.splitext(self.fnm)[0]+'.bak' print "backing up", self.fnm, "to", bakname #print os.getcwd() try: os.rename(self.fnm, bakname) except os.error: os.remove(bakname) os.rename(self.fnm, bakname) open(self.fnm, 'w').writelines(txt) def test(): tc = PyText('test1.py') tc.process() tc = PyText('test1.py') tc.process(style=TABSONLY) tc = PyText('test1.py') tc.process(style=MIXED, indent=4, tabs=8) tc = PyText('test1.py') tc.process(style=MIXED, indent=2, tabs=8) def cleanfile(fnm, d): if os.path.isdir(fnm) and not os.path.islink(fnm): names = os.listdir(fnm) for name in names: fullnm = os.path.join(fnm, name) if (os.path.isdir(fullnm) and not os.path.islink(fullnm)) or \ os.path.normcase(fullnm[-3:]) == ".py": cleanfile(fullnm, d) return tc = PyText(fnm, d) tc.process() usage="""\ %s [options] [path...] options -T : reformat to TABS ONLY -S : reformat to SPACES ONLY ( -i option is important) -M : reformat to MIXED SPACES / TABS ( -t and -i options important) -t : tab is worth characters -i : indents should be characters -h : print this text path is file or directory """ if __name__ == '__main__': import sys, getopt, os opts, args = getopt.getopt(sys.argv[1:], "TSMht:i:") d = {} #print `opts` for opt in opts: if opt[0] == '-T': d['style'] = TABSONLY elif opt[0] == '-S': d['style'] = SPACESONLY elif opt[0] == '-M': d['style'] = MIXED elif opt[0] == '-t': d['tabs'] = opt[1] elif opt[0] == '-i': d['indent'] = opt[1] elif opt[0] == '-h': print usage % sys.argv[0] sys.exit(0) if not args: print usage % sys.argv[0] for arg in args: cleanfile(arg, d) --------------1B1EF91C859852EFAA66EB3D-- From cbarker@jps.net Mon Oct 18 18:48:22 1999 From: cbarker@jps.net (Chris Barker) Date: Mon, 18 Oct 1999 10:48:22 -0700 Subject: [Pythonmac-SIG] CommandHistoryPatch References: <199910170501.BAA25937@python.org> Message-ID: <380B5D66.46BD581F@jps.net> Another great addition form Oliver Steele! I've been waiting desperately for this! Why not bind "previous command" to the "up arrow"? That's how it is at the Unix command line, and it's very handy, and easy. I can't imagine what else you would want the up arrow for. -Chris -- Christopher Barker, Ph.D. cbarker@jps.net --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ From joe@strout.net Mon Oct 18 18:54:08 1999 From: joe@strout.net (Joseph J. Strout) Date: Mon, 18 Oct 1999 10:54:08 -0700 Subject: [Pythonmac-SIG] CommandHistoryPatch In-Reply-To: <380B5D66.46BD581F@jps.net> References: <199910170501.BAA25937@python.org> <380B5D66.46BD581F@jps.net> Message-ID: At 10:48 AM -0700 10/18/99, Chris Barker wrote: >Why not bind "previous command" to the "up arrow"? >That's how it is at the Unix command line, and it's very handy, and >easy. I can't imagine what else you would want the up arrow for. You use the up arrow for moving the cursor up, e.g., in combination with the shift key to select text for copying and such. Granted, this isn't a terribly useful thing to do (compared to command history), and probably nobody would miss it too much. But the console window is a text-editing window, like any other, and it might be hard to muck with its cursor interface in such a fundamental way. Just guessing here, though. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From cbarker@jps.net Mon Oct 18 21:04:22 1999 From: cbarker@jps.net (Chris Barker) Date: Mon, 18 Oct 1999 13:04:22 -0700 Subject: [Pythonmac-SIG] "Build Applet" not Drag and drop anymore? References: <199910170501.BAA25937@python.org> Message-ID: <380B7D46.B718ABE4@jps.net> Hi, I'm using what I think is the latest version of MacPython (1.5.2c1) BuildApplet and BuildApplication don't seem to be drag and dropable anymore. I miss that. Is there a way I can change them to make it work? (I do have argv emulation enabled) -Chris -- Christopher Barker, Ph.D. cbarker@jps.net --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ From maccgi@bellsouth.net Mon Oct 18 21:19:25 1999 From: maccgi@bellsouth.net (Richard Gordon) Date: Mon, 18 Oct 1999 16:19:25 -0400 Subject: [Pythonmac-SIG] "Build Applet" not Drag and drop anymore? In-Reply-To: <380B7D46.B718ABE4@jps.net> References: <199910170501.BAA25937@python.org> <380B7D46.B718ABE4@jps.net> Message-ID: At 13:04 -0700 10/18/1999, Chris Barker wrote: >Hi, > >I'm using what I think is the latest version of MacPython (1.5.2c1) > >BuildApplet and BuildApplication don't seem to be drag and dropable >anymore. I miss that. Is there a way I can change them to make it work? >(I do have argv emulation enabled) They are working for me, so I would assume that something is hosed with your local setup. I can't imagine what that would be and will look to the list gurus for a reasonable guess about what's wrong. Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) From joe@strout.net Mon Oct 18 21:33:32 1999 From: joe@strout.net (Joseph J. Strout) Date: Mon, 18 Oct 1999 13:33:32 -0700 Subject: [Pythonmac-SIG] "Build Applet" not Drag and drop anymore? In-Reply-To: References: <199910170501.BAA25937@python.org> <380B7D46.B718ABE4@jps.net> Message-ID: At 4:19 PM -0400 10/18/99, Richard Gordon wrote: >They are working for me, so I would assume that something is hosed >with your local setup. I can't imagine what that would be and will >look to the list gurus for a reasonable guess about what's wrong. Have you tried rebuilding the desktop? Often drag-and-drop apps that won't accept drops just means tha the Finder needs a kick in the pants... Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From savageb@pacbell.net Tue Oct 19 02:02:55 1999 From: savageb@pacbell.net (savageb) Date: Mon, 18 Oct 1999 18:02:55 -0700 Subject: [Pythonmac-SIG] CommandHistoryPatch Message-ID: <199910190102.SAA13420@mail-gw5.pacbell.net> >From: Chris Barker >Subject: [Pythonmac-SIG] CommandHistoryPatch >Date: Mon, Oct 18, 1999, 10:48 AM > > Another great addition form Oliver Steele! I agree. > > Why not bind "previous command" to the "up arrow"? > That's how it is at the Unix command line, and it's very handy, and > easy. I can't imagine what else you would want the up arrow for. Hmmm...well at the moment I tend to use the up arrow to move the cursor around (I know, "Get a mouse!"), but perhaps I wouldn't be as inclined to do that if I had a command history, since that is a big part of why I do it in the first place. Would it really be so bad to make it ctrl-up/ctrl-down? Bob From maccgi@bellsouth.net Tue Oct 19 04:29:12 1999 From: maccgi@bellsouth.net (Richard Gordon) Date: Mon, 18 Oct 1999 23:29:12 -0400 Subject: [Pythonmac-SIG] A General Thank You Message-ID: I just wanted to take a minute to offer a general thank you to everyone who is providing patches for the IDE and MacPython in general (OSAm is pretty cool if you are an applescript kind of guy, btw). This stuff has helped me a lot in day to day work and I am hoping that it will get even better. Of course, thanks are also due to Just, Jack, and Guido, but I suppose that is implicit in thanking anyone else. So, that's my good deed for the day, now back to evil.... Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) From jack@oratrix.nl Tue Oct 19 11:22:40 1999 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 19 Oct 1999 12:22:40 +0200 Subject: [Pythonmac-SIG] CommandHistoryPatch In-Reply-To: Message by "savageb" , Mon, 18 Oct 1999 18:02:55 -0700 , <199910190102.SAA13420@mail-gw5.pacbell.net> Message-ID: <19991019102241.5B04535BB1E@snelboot.oratrix.nl> > > Why not bind "previous command" to the "up arrow"? > > That's how it is at the Unix command line, and it's very handy, and > > easy. I can't imagine what else you would want the up arrow for. > > Hmmm...well at the moment I tend to use the up arrow to move the cursor > around (I know, "Get a mouse!"), but perhaps I wouldn't be as inclined to do > that if I had a command history, since that is a big part of why I do it in > the first place. Would it really be so bad to make it ctrl-up/ctrl-down? I think in this case we can have our cake and eat it. Mark Hammond's PythonWin does more-or-less what you say here: with the arrow keys you can walk to a certain line. If you are on any line and you start typing[*] the line is copied to the bottom line of the screen (minus any prompts prefixing it), along with your cursor and your edits are being done. And, of course, if you want to use the mouse in stead of the cursor keys to position the cursor that also works. [*] I think that you have to hit an extra return in PythonWin to do the copying, but I don't see a good reason for copying that behaviour. -- 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 Tue Oct 19 16:48:33 1999 From: managan@llnl.gov (Rob Managan) Date: Tue, 19 Oct 1999 08:48:33 -0700 Subject: [Pythonmac-SIG] CommandHistoryPatch In-Reply-To: <19991019102241.5B04535BB1E@snelboot.oratrix.nl> References: <19991019102241.5B04535BB1E@snelboot.oratrix.nl> Message-ID: > >I think in this case we can have our cake and eat it. Mark Hammond's PythonWin >does more-or-less what you say here: with the arrow keys you can walk to a >certain line. If you are on any line and you start typing[*] the line is >copied to the bottom line of the screen (minus any prompts prefixing it), >along with your cursor and your edits are being done. And, of course, if you >want to use the mouse in stead of the cursor keys to position the cursor that >also works. > >[*] I think that you have to hit an extra return in PythonWin to do the >copying, but I don't see a good reason for copying that behaviour. >-- >Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ >Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ The plotting program Igor does something similar. The up arrow selects a line at a time in the command history. Then an Enter copies any selection to the input line. Just another idea on what may work. *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan LLNL ph: 925-423-0903 P.O. Box 808, L-095 FAX: 925-422-3389 Livermore, CA 94551-0808 From cbarker@jps.net Tue Oct 19 18:26:00 1999 From: cbarker@jps.net (Chris Barker) Date: Tue, 19 Oct 1999 10:26:00 -0700 Subject: [Pythonmac-SIG] Re: "Build Applet" not Drag and drop anymore? References: <199910190502.BAA13814@python.org> Message-ID: <380CA9A8.D2A74BDB@jps.net> Hi folks, >>They are working for me, so I would assume that something is hosed >>with your local setup. I can't imagine what that would be and will >>look to the list gurus for a reasonable guess about what's wrong. >Have you tried rebuilding the desktop? Often drag-and-drop apps that >won't accept drops just means tha the Finder needs a kick in the >pants... Bingo! I guess dispite what Apple wants you to think, there really is a lot of tricky little stuff you have to learn on a Mac. -Chris -- Christopher Barker, Ph.D. cbarker@jps.net --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ From jack@oratrix.nl Tue Oct 19 23:12:21 1999 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 20 Oct 1999 00:12:21 +0200 Subject: [Pythonmac-SIG] Re: "Build Applet" not Drag and drop anymore? In-Reply-To: Message by Chris Barker , Tue, 19 Oct 1999 10:26:00 -0700 , <380CA9A8.D2A74BDB@jps.net> Message-ID: <19991019221227.E3DDDEA119@oratrix.oratrix.nl> Recently, Chris Barker said: > >Have you tried rebuilding the desktop? Often drag-and-drop apps that > >won't accept drops just means tha the Finder needs a kick in the > >pants... > > Bingo! I guess dispite what Apple wants you to think, there really is a > lot of tricky little stuff you have to learn on a Mac. I think I am to blame for this, because I see this problem (having to rebuild the desktop to get an applet to work) a lot more with Python than with anything else. I think I don't fully understand either how to kick the finder after BuildApplet has created a new application or exactly how BNDL resources, the Inited finfo bit and all these other thingies work together. So if someone wants to have a look at BuildApplet and friends and make a fool of me in public: by all means, be my guest:-) -- 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 joe@strout.net Wed Oct 20 01:10:14 1999 From: joe@strout.net (Joseph J. Strout) Date: Tue, 19 Oct 1999 17:10:14 -0700 Subject: [Pythonmac-SIG] "import library too new"? Message-ID: I remember this came up before... but I can't remember the answer. Can somebody please tell me what this means: >>> import QDRotate Traceback (innermost last): File "", line 1, in ? ImportError: PythonCore: An import library was too new for a client. I thought maybe it meant I have to rebuild the QDRotate shared lib, but I did that and still get this error. It worked fine in 1.5.2b1, but 1.5.2c1 gives me this. Can somebody give me a clue? Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From maccgi@bellsouth.net Wed Oct 20 02:22:17 1999 From: maccgi@bellsouth.net (Richard Gordon) Date: Tue, 19 Oct 1999 21:22:17 -0400 Subject: [Pythonmac-SIG] "import library too new"? In-Reply-To: References: Message-ID: At 17:10 -0700 10/19/1999, Joseph J. Strout wrote: >I thought maybe it meant I have to rebuild the QDRotate shared lib, >but I did that and still get this error. It worked fine in 1.5.2b1, >but 1.5.2c1 gives me this. Can somebody give me a clue? I don't know that it's much of a clue, but you aren't the only one to run into this lately, viz.: At 17:54 -0700 10/11/1999, savageb wrote: >I am having a hard time getting mxDateTime to run with Python 1.5.2c1. Joe, >I seem to remember getting an error like this before, but I looked back >through the sig archives and didn't see any mention of it. I'm hoping you or >someone else knows what this means: > >Python 1.5.2c1 (#56, Apr 12 1999, 14:19:52) [CW PPC w/GUSI w/MSL] >Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> import DateTime >Traceback (innermost last): > File "", line 1, in ? > File "Henrietta:Utilities:Python 1.5.2c1:Extensions:DateTime:DateTime.py", >line 8, in ? > from mxDateTime import * > File "Henrietta:Utilities:Python 1.5.2c1:Extensions:DateTime:__init__.py", >line 7, in ? > __package_info__ = """ >ImportError: PythonCore: An import library was too new for a client. > >>> > >-thx, Bob Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) From jack@oratrix.nl Wed Oct 20 09:28:14 1999 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 20 Oct 1999 10:28:14 +0200 Subject: [Pythonmac-SIG] "import library too new"? In-Reply-To: Message by "Joseph J. Strout" , Tue, 19 Oct 1999 17:10:14 -0700 , Message-ID: <19991020082815.2F65435BB1E@snelboot.oratrix.nl> > I remember this came up before... but I can't remember the answer. > Can somebody please tell me what this means: > > >>> import QDRotate > Traceback (innermost last): > File "", line 1, in ? > ImportError: PythonCore: An import library was too new for a client. > > > I thought maybe it meant I have to rebuild the QDRotate shared lib, > but I did that and still get this error. That should have worked. If QDRotate was linked against PythonCore 1.5.2b1 and you re-link it against 1.5.2c1 it should now work. Are you sure (a) you're importing the relinked version and (b) you relinked against the new PythonCore? As you apparently have CodeWarrior, could you try running it under the debugger? The debugger log window shows which code fragments are loaded in which order, maybe this gives a clue... -- 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 joe@strout.net Wed Oct 20 16:47:59 1999 From: joe@strout.net (Joseph J. Strout) Date: Wed, 20 Oct 1999 08:47:59 -0700 Subject: [Pythonmac-SIG] "import library too new"? In-Reply-To: <19991020082815.2F65435BB1E@snelboot.oratrix.nl> References: <19991020082815.2F65435BB1E@snelboot.oratrix.nl> Message-ID: At 10:28 AM +0200 10/20/99, Jack Jansen wrote: > > I thought maybe it meant I have to rebuild the QDRotate shared lib, > > but I did that and still get this error. > >That should have worked... You're right, it does. I'd run into a bug in CodeWarrior Pro 5.2 -- I still don't understand it; it was looking in the wrong place for the PythonCore library. Even after I deleted the old one, and removed and re-added the new one (to the project) a few dozen times, making sure it was in the path, etc., CodeWarrior remained hopelessly confused and gave me mysterious internal errors. I finally found a work-around, which was to copy PythonCore into the project folder. Why this works, yet another location also in the project paths does not, I have no idea. But I finally got QDRotate rebuilt with the correct shlb and it now works under 1.5.2c1. Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From savageb@pacbell.net Wed Oct 20 17:36:37 1999 From: savageb@pacbell.net (Bob Savage) Date: Wed, 20 Oct 1999 09:36:37 -0700 Subject: [Pythonmac-SIG] "import library too new"? In-Reply-To: Message-ID: >>> I thought maybe it meant I have to rebuild the QDRotate shared lib, >>> but I did that and still get this error. >> >> That should have worked... > > You're right, it does. Joe, is there a chance you could work some of that same magic on the mxDateTime shared library? I'ld like to be able to use it with the new version of MacPython. Bob From patrick@swdev.com Thu Oct 21 06:11:32 1999 From: patrick@swdev.com (Patrick Curtain) Date: Wed, 20 Oct 1999 22:11:32 -0700 Subject: [Pythonmac-SIG] Curriculum, Course Outlines? Message-ID: <380EA078.4E30A82B@swdev.com> Hi All! I'm in the middle of putting together a course outline for teaching programming and I'm wanting to use Python. Does anyone have any materials? Course suggestions? Thanks for any help! --p -- Patrick Curtain, Husband & Father ( i also write software ) 503 781 6199 patrick@swdev.com http://www.swdev.com/ From jack@oratrix.nl Thu Oct 21 11:16:58 1999 From: jack@oratrix.nl (Jack Jansen) Date: Thu, 21 Oct 1999 12:16:58 +0200 Subject: [Pythonmac-SIG] Curriculum, Course Outlines? In-Reply-To: Message by Patrick Curtain , Wed, 20 Oct 1999 22:11:32 -0700 , <380EA078.4E30A82B@swdev.com> Message-ID: <19991021101659.41CEF35BB1E@snelboot.oratrix.nl> > I'm in the middle of putting together a course outline for teaching > programming and I'm wanting to use Python. > > Does anyone have any materials? Course suggestions? Patrick, unless you want to teach only Mac-specific things, which I can't imagine, I think you should also ask this in a general forum like python-list@python.org. There should be very little machine-dependent in a Python course, except for the first lesson (which will probably focus on IDE for the Mac, PythonWin for Windows and Emacs for unix). -- 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 michael.wolff@strath.ac.uk Thu Oct 21 11:51:49 1999 From: michael.wolff@strath.ac.uk (m wolff) Date: Thu, 21 Oct 1999 11:51:49 +0100 Subject: [Pythonmac-SIG] Zope et al In-Reply-To: <19991021101659.41CEF35BB1E@snelboot.oratrix.nl> References: Message by Patrick Curtain , Wed, 20 Oct 1999 22:11:32 -0700 , <380EA078.4E30A82B@swdev.com> Message-ID: Hello. Are there any initiatives to implement Zope on MacOS? michael right hemisphere spirit trapped inside a left brain mind. From jack@oratrix.nl Thu Oct 21 13:16:36 1999 From: jack@oratrix.nl (Jack Jansen) Date: Thu, 21 Oct 1999 14:16:36 +0200 Subject: [Pythonmac-SIG] Zope et al In-Reply-To: Message by m wolff , Thu, 21 Oct 1999 11:51:49 +0100 , Message-ID: <19991021121636.C679535BB1E@snelboot.oratrix.nl> > Hello. > > Are there any initiatives to implement Zope on MacOS? As far as I know Zope heavily depends on thread support, so for the moment it is impossible to implement under MacPython. -- 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 jhrsn@pop.pitt.edu Thu Oct 21 14:46:35 1999 From: jhrsn@pop.pitt.edu (Jim Harrison) Date: Thu, 21 Oct 1999 09:46:35 -0400 Subject: [Pythonmac-SIG] Curriculum, Course Outlines? In-Reply-To: <380EA078.4E30A82B@swdev.com> Message-ID: on 10/21/99 1:11 AM, Patrick Curtain at patrick@swdev.com wrote: > I'm in the middle of putting together a course outline for teaching > programming and I'm wanting to use Python. > > Does anyone have any materials? Course suggestions? Patrick- If you haven't already, I'd recommend you take a look at Guido van Rossum's proposal "Computer Programming for Everybody" . He and collaborators propose to create a curriculum and tools for teaching beginning programming in secondary schools and college, using Python. The proposal has been funded by DARPA and work is beginning this fall. It's possible you could collaborate, or at least get some direction from the materials they are developing. Best wishes, Jim Harrison ________________________________________________________________________ James H. Harrison, Jr., MD, PhD University of Pittsburgh Health System C920 PUH, 200 Lothrop Street Pittsburgh, PA 15213 jhrsn@pop.pitt.edu | voice: 412-647-5529 | fax: 412-647-9588 "If you want sense, you'll have to make it yourself!!"-Norton Juster ________________________________________________________________________ From joe@strout.net Thu Oct 21 19:19:24 1999 From: joe@strout.net (Joseph J. Strout) Date: Thu, 21 Oct 1999 11:19:24 -0700 Subject: [Pythonmac-SIG] change in cPickle format? Message-ID: I'm having trouble with a pickle file which was created under MacPython 1.5.2b1. I can't seem to load it now, as shown here: >>> f = open(_fontprefix + ":metrics.dat") >>> cPickle.load(f) Traceback (innermost last): File "", line 1, in ? EOFError: Has the cPickle format changed? Or has this file simply gotten corrupted somehow? PIDDLE users: is piddlePIL working for you? If you comment out the except block at line 48 (substituting a dummy "finally" block instead), do you get an error like the above when you run the code? Thanks for any insight in pinning this down... -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From cmann@pobox.com Thu Oct 21 20:02:12 1999 From: cmann@pobox.com (chris mann) Date: Thu, 21 Oct 1999 15:02:12 -0400 Subject: [Pythonmac-SIG] problems with smtplib? Message-ID: I'm having problems with the smtplib module on Mac. if I run the following code on windows or linux it works fine, but fails on mac: import smtplib s = smtplib.SMTP('smtp.myhost.com') s.helo() i get the following error: Traceback (innermost last): File "", line 1, in ? File "Dev:Scripting:Python 1.5.2c1:Lib:smtplib.py", line 290, in helo name=socket.gethostbyaddr(socket.gethostname())[0] error: host not found any ideas why this is only failing on Mac? thanks -chris From just@letterror.com Thu Oct 21 20:00:58 1999 From: just@letterror.com (Just van Rossum) Date: Thu, 21 Oct 1999 21:00:58 +0200 Subject: [Pythonmac-SIG] change in cPickle format? In-Reply-To: Message-ID: At 11:19 AM -0700 10/21/99, Joseph J. Strout wrote: >I'm having trouble with a pickle file which was created under >MacPython 1.5.2b1. I can't seem to load it now, as shown here: > > >>> f = open(_fontprefix + ":metrics.dat") > >>> cPickle.load(f) > Traceback (innermost last): > File "", line 1, in ? > EOFError: > >Has the cPickle format changed? Or has this file simply gotten >corrupted somehow? Erm, shouldn't you open that file in binary mode? Just From joe@strout.net Thu Oct 21 20:20:15 1999 From: joe@strout.net (Joseph J. Strout) Date: Thu, 21 Oct 1999 12:20:15 -0700 Subject: [Pythonmac-SIG] change in cPickle format? In-Reply-To: References: Message-ID: At 9:00 PM +0200 10/21/99, Just van Rossum wrote: > > >>> f = open(_fontprefix + ":metrics.dat") > > >>> cPickle.load(f) >Erm, shouldn't you open that file in binary mode? Ah. Umm. You may have a point there. I used to always use pickle, which stores its data in text files, and so I always open in text mode. Converting to cPickle, I neglected to change this. That probably explains the problem (though since the file was generated in text mode as well, the damage is probably already done -- I'll have to rebuild the file). Thanks Just! Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From just@letterror.com Thu Oct 21 20:37:25 1999 From: just@letterror.com (Just van Rossum) Date: Thu, 21 Oct 1999 21:37:25 +0200 Subject: [Pythonmac-SIG] problems with smtplib? In-Reply-To: Message-ID: At 3:02 PM -0400 10/21/99, chris mann wrote: >I'm having problems with the smtplib module on Mac. > >if I run the following code on windows or linux it works fine, but fails on >mac: >import smtplib >s = smtplib.SMTP('smtp.myhost.com') >s.helo() > >i get the following error: >Traceback (innermost last): > File "", line 1, in ? > File "Dev:Scripting:Python 1.5.2c1:Lib:smtplib.py", line 290, in helo > name=socket.gethostbyaddr(socket.gethostname())[0] >error: host not found > >any ideas why this is only failing on Mac? Works for me. Can it be your network setup? Firewall? Can you see which of the two socket calls fail? Just From cmann@pobox.com Thu Oct 21 20:54:07 1999 From: cmann@pobox.com (chris mann) Date: Thu, 21 Oct 1999 15:54:07 -0400 Subject: [Pythonmac-SIG] problems with smtplib? In-Reply-To: Message-ID: on 10/21/99 3:37 PM, Just van Rossum at just@letterror.com wrote: > At 3:02 PM -0400 10/21/99, chris mann wrote: >> I'm having problems with the smtplib module on Mac. >> >> if I run the following code on windows or linux it works fine, but fails on >> mac: >> import smtplib >> s = smtplib.SMTP('smtp.myhost.com') >> s.helo() >> >> i get the following error: >> Traceback (innermost last): >> File "", line 1, in ? >> File "Dev:Scripting:Python 1.5.2c1:Lib:smtplib.py", line 290, in helo >> name=socket.gethostbyaddr(socket.gethostname())[0] >> error: host not found >> >> any ideas why this is only failing on Mac? > > Works for me. Can it be your network setup? Firewall? > Can you see which of the two socket calls fail? Could be the firewall. Or it could be the network setup, but not sure why it would work on Windows, but not Mac. They both get their ip address via DHCP (the linux box has a static ip address) It's failing in the socket.gethostbyaddr() call. The socket.gethostname() call returns the ip address of the machine. thanks -chris From doug@sonosphere.com Thu Oct 21 22:44:56 1999 From: doug@sonosphere.com (Doug Wyatt) Date: Thu, 21 Oct 1999 17:44:56 -0400 Subject: [Pythonmac-SIG] problems with smtplib? In-Reply-To: References: Message-ID: At 21:37 +0200 10/21/99, Just van Rossum wrote: > At 3:02 PM -0400 10/21/99, chris mann wrote: >>I'm having problems with the smtplib module on Mac. >> >>if I run the following code on windows or linux it works fine, but fails on >>mac: >>import smtplib >>s = smtplib.SMTP('smtp.myhost.com') >>s.helo() >> >>i get the following error: >>Traceback (innermost last): >> File "", line 1, in ? >> File "Dev:Scripting:Python 1.5.2c1:Lib:smtplib.py", line 290, in helo >> name=socket.gethostbyaddr(socket.gethostname())[0] >>error: host not found >> >>any ideas why this is only failing on Mac? > > Works for me. Can it be your network setup? Firewall? > Can you see which of the two socket calls fail? I have the same problem. >>> socket.gethostname() '10.9.8.81' >>> socket.gethostbyaddr(socket.gethostname()) Traceback (innermost last): File "", line 1, in ? error: host not found My machine does not have a name known to the outside world because, indeed, I am behind an IP masquerading firewall. So I changed smtplib.ehlo() as follows: name = socket.gethostname() try: name = socket.gethostbyaddr(name)[0] except: pass Sorry, I should have posted this fix when I made it. Doug -- Doug Wyatt doug@sonosphere.com http://www.sonosphere.com/ From jack@oratrix.nl Thu Oct 21 23:05:12 1999 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 22 Oct 1999 00:05:12 +0200 Subject: [Pythonmac-SIG] problems with smtplib? In-Reply-To: Message by chris mann , Thu, 21 Oct 1999 15:54:07 -0400 , Message-ID: <19991021220518.DD9FFEA119@oratrix.oratrix.nl> As Doug explained the problem is that your IP address doesn't have a reverse mapping in the DNS database. While it is probably a good idea to submit a bugfix to Guido, as it isn't smtplib's primary task to play Internet Police, it is something you should get your sysadmin to fix. There are lots of SMTP servers who will do a lookup/reverse lookup on the hostname you pass with HELO and treat your messages as spam if the reverse lookup fails or doesn't match. There are also lots of other problems you'll probably experience from your machine (like not being able to connect to ftp.cwi.nl to get the latest version of MacPython:-). -- 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 patrick@swdev.com Fri Oct 22 08:32:45 1999 From: patrick@swdev.com (Patrick Curtain) Date: Fri, 22 Oct 1999 00:32:45 -0700 Subject: [Pythonmac-SIG] Curriculum, Course Outlines? References: Message-ID: <381012DF.3879CBC1@swdev.com> Thanks Jim! (And the others who wrote!) Jim Harrison wrote: > If you haven't already, I'd recommend you take a look at Guido van Rossum's > proposal "Computer Programming for Everybody" > . I definitely did! That was a big part of how I drove the decision for using Python to bring in the fundamental concepts. > It's possible you could collaborate, or at least get some direction from the > materials they are developing. Now that would be ideal. I didn't really think before sending this to the Mac list, sorry about that! Just the list I follow most, myself. :) I'll check to see if it's being discussed on the c.l.p list and then post there as well. Thanks All! --p -- Patrick Curtain, Husband & Father ( i also write software ) 503 781 6199 patrick@swdev.com http://www.swdev.com/ From jeffrey@Digicool.com Fri Oct 22 15:31:22 1999 From: jeffrey@Digicool.com (Jeffrey P Shell) Date: Fri, 22 Oct 1999 10:31:22 -0400 Subject: [Pythonmac-SIG] Zope et al In-Reply-To: <19991021121636.C679535BB1E@snelboot.oratrix.nl> Message-ID: on 10/21/99 8:16 AM, Jack Jansen at jack@oratrix.nl wrote: > As far as I know Zope heavily depends on thread support, so for the moment it > is impossible to implement under MacPython. Doesn't Thread support in the MacOS continue to improve? I would think that it's especially part of Carbon. What blocks Python threads for MacOS? As far as Zope goes, we'd love to see an initiative to build it. I personally have had a hard enough time getting it to compile on MacOS X Server, but that is mostly due to my lack of knowledge of the proper way of compiling Python to do shared libraries in OpenStep. (BTB, on Stepwise (www.stepwise.com), they have a binary of Python 1.5.2. No threads, and I doubt it does shared library). Doing it on Mac OS X DP1's unix-side didn't work at all because Python wouldn't compile the way I wanted it to (none of the configure scripts ever expected the 'uname' command to return "mac os" :-) -- Jeffrey P Shell, jeffrey@Digicool.com http://www.zope.org/ From jimmy@CS.cofc.EDU Fri Oct 22 16:41:21 1999 From: jimmy@CS.cofc.EDU (James B. Wilkinson) Date: Fri, 22 Oct 1999 11:41:21 -0400 Subject: [Pythonmac-SIG] Accessing front window in IDE Message-ID: <199910221541.LAA21424@stono.cs.cofc.edu> From savageb@pacbell.net Fri Oct 22 19:31:21 1999 From: savageb@pacbell.net (savageb) Date: Fri, 22 Oct 1999 11:31:21 -0700 Subject: [Pythonmac-SIG] Zope et al In-Reply-To: Message-ID: Jeffrey P Shell > > (BTB, on Stepwise > (www.stepwise.com), they have a binary of Python 1.5.2. No threads, and I > doubt it does shared library). Hmmm...Well, it's a start. :) I do think the issue of MOSX is looming larger. I understand Jack and Just have every intention of maintaining Carbon compliance, but what about some of the low-level modules, e.g. macfs and QD? From what I have read, both Standard File Services (meaning things like StandardGetFile), and QuickDraw are going away (to be replaced by "Navigation Services" and "Quartz" respectivly). Bob (It's a big scary world out there) From dillera@isc.upenn.edu Fri Oct 22 19:56:22 1999 From: dillera@isc.upenn.edu (Andrew Diller) Date: Fri, 22 Oct 1999 14:56:22 -0400 Subject: [Pythonmac-SIG] C module creation on MacPython In-Reply-To: Message-ID: Subject: C module creation on MacPython Hello: Can I get some pointers on how C modules are created for MacPython? Specifically, I'm looking to use the sgmlop module from the madscientist (www.pythonware.com/madscientist) and its only available as c source. What is needed to create a c module in MacPython? Any help would be appreciated. From doug@sonosphere.com Fri Oct 22 20:31:19 1999 From: doug@sonosphere.com (Doug Wyatt) Date: Fri, 22 Oct 1999 15:31:19 -0400 Subject: [Pythonmac-SIG] C module creation on MacPython In-Reply-To: References: Message-ID: At 14:56 -0400 10/22/99, Andrew Diller wrote: > Subject: C module creation on MacPython > > Hello: > > Can I get some pointers on how C modules are created for MacPython? > > Specifically, I'm looking to use the sgmlop module from the madscientist > (www.pythonware.com/madscientist) and its only available as c source. > > What is needed to create a c module in MacPython? > > Any help would be appreciated. Brief recipe: Start with xxmodule.c (in the Modules directory in the source distribution). Modify as needed to define your module's functions and data types (refer to the embedding/extending docs). Build a CodeWarrior shared library project that includes xxmodule.c and the PythonCore shared library from your system folder. Name the output shared library "xx.ppc.slb". Put it somewhere in the module search path. In xxmodule.c, export the function "initxx" (where xx is the module name). This is most simply done by bracketing it with #pragma export. #pragma export on extern "C" void // I'm using C++ so extern "C" is neede initxx() { ... } #pragma export off Hope I didn't forget anything :) Doug -- Doug Wyatt doug@sonosphere.com http://www.sonosphere.com/ From cwebster@nevada.edu Fri Oct 22 23:02:02 1999 From: cwebster@nevada.edu (Corran Webster) Date: Fri, 22 Oct 1999 15:02:02 -0700 (PDT) Subject: [Pythonmac-SIG] C module creation on MacPython In-Reply-To: Message-ID: > Hello: > > Can I get some pointers on how C modules are created for MacPython? > > Specifically, I'm looking to use the sgmlop module from the madscientist > (www.pythonware.com/madscientist) and its only available as c source. > > What is needed to create a c module in MacPython? Doug Wyatt gave some pointers for compiling with CodeWarrior. If you don't have CodeWarrior, you can download MPW from Apple's ftp site for free and compile using that. You'll need to extract the Include files from the standard mac distribution (do a custom install from the Installer) or from the source distribution. You can then compile and link from the MPW command line, or for more complex projects, set up a Makefile to build for you. Typical compilation commands for a single-file module might look like: set Python "your path to python folder" MrC "mymodule.c" -o mymodule.c.x -w off -i "{Python}Mac:Include:" -i "{Python}Include:" PPCLink -o mymodule.ppc.slb "mymodule.c.x" -t 'shlb' -c 'Pyth' -xm s "{SharedLibraries}InterfaceLib" "{SharedLibraries}MathLib" "{SharedLibraries}StdCLib" "{PPCLibraries}StdCRuntime.o" "{PPCLibraries}PPCCRuntime.o" "{PPCLibraries}PPCToolLibs.o" "{Python}PythonCore" -export initMyModule (you can break lines with the partial derivative symbol option-d) You may need to include other libraries, or not include some of the ones I've included, depedning on what your module does. I think there should be an option to turn off certain warnings in the second command, too, but I'm too lazy to look it up. Anyway, presuming correct compilation, you will then have a compiled module that you can place somewhere that Mac Python will find it, and then you can import it like any other module. I'm sort of a newbie at this, so I hope I haven't left anything out - I just hacked around until I got things to work with MPW. Regards, Corran From cwebster@nevada.edu Fri Oct 22 23:25:16 1999 From: cwebster@nevada.edu (Corran Webster) Date: Fri, 22 Oct 1999 15:25:16 -0700 (PDT) Subject: [Pythonmac-SIG] Pyml for Macintosh and related thoughts Message-ID: I've been playing with David Konerding's Pyml modules which provide acces to Mathematica from Python and seem to have it compiling and working on the mac (Python 1.5.2 with Mathematica 4.0). Not wanting to duplicate effort, has anyone else done this previously? And if not, is there interest in making the compiled module available for others to download (I'd need to get in touch with the author to find the best way to do this)? This raises a more general point: should there be a repository of extension modules compiled for Mac Python. Some modules aren't going to be compilable - like some of the Zope stuff which requires threads - but an archive of those which can be, would be a boon for the community, and aid in compatibility between platforms. I guess ideally, the module authors would maintain mac versions, but that's probably unrealsitic given that most work in a Unix/Windows world. Any thoughts? Regards, Corran From jimmy@cs.cofc.edu Sat Oct 23 04:10:09 1999 From: jimmy@cs.cofc.edu (James B. Wilkinson) Date: Fri, 22 Oct 1999 23:10:09 -0400 Subject: [Pythonmac-SIG] parameters to Scrap.GetScrap( ??, ??) Message-ID: I'm trying to call Scrap.GetScrap, and I'm having trouble giving it parameters that it likes. I want the second parameter to be 'TEXT', but I can't find a way to tell it that. I'm passing None for the first parameter, thinking that that might give me the result of passing NIL (Inside Mac V 1). It's not complaining about that, so maybe it's ok. Inside Mac says the second parameter should be ResType, a 4-byte string. I've tried giving it 'TEXT', and I've tried converting those four bytes to the equivalent integer. I don't know what to try next. Can somebody give me a clue? Here's what I get when I try it: length, offset = Scrap.GetScrap(None, 'TEXT') TypeError: Resource required Thanks. ------------------------------------------------------------- Jimmy Wilkinson | Perfesser of Computer Science jimmy@cs.CofC.edu | The College of Charleston (843) 953-8160 | Charleston SC 29424 If there is one word to describe me, that word would have to be "profectionist". From joe@strout.net Sat Oct 23 04:52:29 1999 From: joe@strout.net (Joseph J. Strout) Date: Fri, 22 Oct 1999 20:52:29 -0700 Subject: [Pythonmac-SIG] parameters to Scrap.GetScrap( ??, ??) In-Reply-To: Message-ID: At 8:10 PM -0700 10/22/99, James B. Wilkinson wrote: > length, offset = Scrap.GetScrap(None, 'TEXT') >TypeError: Resource required I think it's your first resource that's the problem. It should be a resource handle -- I don't think Python's GetScrap supports the behavior of peeking at the scrap without getting it. So do hdl = Res.Resource('') length, offset = Scrap.GetScrap(hdl, 'TEXT') or something like that (typing from memory here). Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From steele@cs.brandeis.edu Sat Oct 23 12:58:36 1999 From: steele@cs.brandeis.edu (Oliver Steele) Date: Sat, 23 Oct 1999 07:58:36 -0400 Subject: [Pythonmac-SIG] suggestion: use Internet Config for file creation types Message-ID: I think MacPython (both the IDE and the interpreter) should use Internet Config, to compute the type and creator of files that they create. This would mean that double-clicking on a *.html file produced by a Python script would open it with Netscape Navigator or IE, depending on how your IC database is configured -- this is what I always want from scripts I run, and I imagine it's desirable for most other people and appropriate for most scripts as well. It also means that files created by a Python script on a foreign system and then copied to the Mac with Anarchie, IE, or PC Exchange, have the same type and creator as files created by running that same script on a Mac, which I think is a useful and intuitive invariant. An alternative would be to change each script that creates a file to set the type and creator, but (1) this distributes the work everywhere, and (2) ghettoizes the Mac by (2a) making Mac programmers write scripts that are unnecessarily OS-dependent, and (2b) keeping scripts from other platforms from working as well on the Mac (as well as Mac-specific scripts, and as well as those scripts do on platforms such as Windows, which use the file extension to encode the type and creator). I probably won't ever implement this (I swore off C some years ago, and I hope to stay on the wagon), but I'm hoping that if this strikes anyone else as a good idea, maybe someone will give a go at implementing it. From steele@cs.brandeis.edu Sat Oct 23 12:58:37 1999 From: steele@cs.brandeis.edu (Oliver Steele) Date: Sat, 23 Oct 1999 07:58:37 -0400 Subject: [Pythonmac-SIG] CommandHistoryPatch update Message-ID: Thanks for your suggestions, everyone! I've changed the previous history key to ctl-uparrow (option-p was indeed a holdover from my MCL days); added ctl-downarrow for next history; and added the feature where typing on a previous line appends that line to the current input. Enter/Return just appends the text of the line the selection is on (so press Return twice to execute it). Any other non-navigation key appends the text, repositions the selection, and then types the key. This sounds complicated, but I think it works well; try it, and tell me what you think. The new patch is available from , as . PatchUtils.py does the right thing, so you can just drop CommandHistoryPatch.py on the interpreter, and it will ask you if you want to update the old one. By the way, I extended (by subclassing) PatchUtils.Patch with a ReplaceLines command, since I needed to replace multiple lines. I wouldn't mind if this code were moved into PatchUtils.py. From joe@strout.net Sat Oct 23 14:36:05 1999 From: joe@strout.net (Joseph J. Strout) Date: Sat, 23 Oct 1999 06:36:05 -0700 Subject: [Pythonmac-SIG] CommandHistoryPatch update In-Reply-To: Message-ID: At 4:58 AM -0700 10/23/99, Oliver Steele wrote: >Thanks for your suggestions, everyone! I've changed the previous history >key to ctl-uparrow (option-p was indeed a holdover from my MCL days); added >ctl-downarrow for next history; and added the feature where typing on a >previous line appends that line to the current input. Sounds super! I can't wait to try it! >By the way, I extended (by subclassing) PatchUtils.Patch with a ReplaceLines >command, since I needed to replace multiple lines. I wouldn't mind if this >code were moved into PatchUtils.py. Makes perfect sense to me -- I just added patching functions in there on an "as needed" basis. I'll roll that code in ASAP. But I have relatives visiting this weekend, and shortly after they leave I'm off to Switzerland for a few days, so it might be a week or two before I get to it. Just ping me again if I seem to forget. Thanks for the cool patch, Oliver! Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From jimmy@cs.cofc.edu Sun Oct 24 04:12:00 1999 From: jimmy@cs.cofc.edu (James B. Wilkinson) Date: Sat, 23 Oct 1999 23:12:00 -0400 Subject: [Pythonmac-SIG] parameters to Scrap.GetScrap( ??, ??) In-Reply-To: References: Message-ID: Joe Strout opined: >At 8:10 PM -0700 10/22/99, James B. Wilkinson wrote: > >> length, offset = Scrap.GetScrap(None, 'TEXT') >>TypeError: Resource required > >I think it's your first resource that's the problem. It should be a >resource handle -- I don't think Python's GetScrap supports the behavior of >peeking at the scrap without getting it. So do > > hdl = Res.Resource('') > length, offset = Scrap.GetScrap(hdl, 'TEXT') > >or something like that (typing from memory here). Pretty good memory, I reckon. I just cut that and pasted it in. Bingo! Well, after I had the presence of mind to import Res. Right proud of that, I am. Is there some place I should be able to find stuff like that for myself? I didn't see anything like that in libmac.pdf, and I haven't found any other docs for MacPython. Another question, just in case the answer to the last one is "No": Here's the end of the traceback I get if I start up the program right after zeroing the scrap: TE.TEFromScrap() Mac OS Error: (-102, 'No object of that type in scrap') This looks like the relevant line in macerrors.py: noTypeErr = -102 #No object of that type in scrap My code at that point is try: TE.TEFromScrap() except macerrors.noTypeErr: print "Caught it!" #For debugging pass If I change the except line to just "except:", then the program prints "Caught it!" and keeps on running ok. So I've gotten myself mystified again. I'd much prefer to have the specific error named in the except line so I'll hear about it if some other error comes along sometime. Unfortunately, I can't figure out what to call this error that I want to catch. noTypeErr seems to be the obvious thing, and it don't work. Guidance gratefully received. ------------------------------------------------------------- Jimmy Wilkinson | Perfesser of Computer Science jimmy@cs.CofC.edu | The College of Charleston (843) 953-8160 | Charleston SC 29424 If there is one word to describe me, that word would have to be "profectionist". From jack@oratrix.nl Mon Oct 25 11:30:43 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 25 Oct 1999 12:30:43 +0200 Subject: [Pythonmac-SIG] C module creation on MacPython In-Reply-To: Message by Corran Webster , Fri, 22 Oct 1999 15:02:02 -0700 (PDT) , Message-ID: <19991025103044.F358335BB1E@snelboot.oratrix.nl> > > What is needed to create a c module in MacPython? > > Doug Wyatt gave some pointers for compiling with CodeWarrior. If you > don't have CodeWarrior, you can download MPW from Apple's ftp site for > free and compile using that. Corran, I'm very surprised that your recipe works, as it mixes MPW libraries (in the extension module) with CodeWarrior libraries (in PythonCore). I would expect all sort of trouble with I/O, malloc/free, and possibly loads of other places. If you're actually using this method, could you post a bit of information on what works, what doesn't work and whether there are specific things you should do (like calling printf, I can imagine)? -- 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 Mon Oct 25 12:52:19 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 25 Oct 1999 13:52:19 +0200 Subject: [Pythonmac-SIG] suggestion: use Internet Config for file creation types In-Reply-To: Message by Oliver Steele , Sat, 23 Oct 1999 07:58:36 -0400 , Message-ID: <19991025115219.E778735BB1E@snelboot.oratrix.nl> > I think MacPython (both the IDE and the interpreter) should use Internet > Config, to compute the type and creator of files that they create. I thought about this at some point in the past, but decided against it. It tightly couples extensions to filetypes, as is done on Windows, and I think this is a bad thing in general. What I could live with is if you did this optionally. I.e. if you do import autotyper autotyper.install() somewhere in your script you get this behaviour. If you want to implement this I'll gladly accept it and add it to the distribution. Note, by the way, that you don't need to write any C for this: there is in Internet config interface available, and you can hook into the standard open call with something like import __builtin__ _builtin_open = __builtin__.open def _open_with_typer(*args): rv = apply(_builtin_open, args) # do typer magic return rv def install(): __builtin__.open = _open_with_typer -- 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 Mon Oct 25 12:56:01 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 25 Oct 1999 13:56:01 +0200 Subject: [Pythonmac-SIG] parameters to Scrap.GetScrap( ??, ??) In-Reply-To: Message by "James B. Wilkinson" , Sat, 23 Oct 1999 23:12:00 -0400 , Message-ID: <19991025115602.2091335BB1E@snelboot.oratrix.nl> > Is there some place I should be able to find stuff like that for myself? I > didn't see anything like that in libmac.pdf, and I haven't found any other > docs for MacPython. If someone wants to pick up working on MacPython documentation: please, be my guest. I know the docs are very incomplete and outdated, but I don't have time to work on it.... > Here's the end of the traceback I get if I start up the program right after > zeroing the scrap: > > TE.TEFromScrap() > Mac OS Error: (-102, 'No object of that type in scrap') > > This looks like the relevant line in macerrors.py: > noTypeErr = -102 #No object of that type in scrap > > My code at that point is > > try: > TE.TEFromScrap() > except macerrors.noTypeErr: > print "Caught it!" #For debugging > pass The values in macerrors.py are the values you will be passed in the *argument* to the exception. The exception you get for all (or, at least, almost all) toolbox errors is MacOS.Error. This exception is also known as TE.Error, Res.Error, etc etc etc. -- 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 dillera@isc.upenn.edu Mon Oct 25 15:48:38 1999 From: dillera@isc.upenn.edu (Andrew Diller) Date: Mon, 25 Oct 1999 10:48:38 -0400 (EDT) Subject: [Pythonmac-SIG] C module creation on MacPython In-Reply-To: <19991025103044.F358335BB1E@snelboot.oratrix.nl> Message-ID: Wow- I'm hoping that I can get MPW to work. We only have one copy of Codewarrior here, and I was hoping to be able to use MPW to do some things. I was able to get sgmlop compiled and linked w/ codewarrior, now I'm going to download MPW and give it a go. I'll let the list know what happens. thanks for the input. -andy - - - - - - - - - - - - - - - - - - - Andrew Diller dillera@isc.upenn.edu Information Systems and Computing University of Pennsylvania v: 3-7360 f: 8-9348 On Mon, 25 Oct 1999, Jack Jansen wrote: > > > > What is needed to create a c module in MacPython? > > > > Doug Wyatt gave some pointers for compiling with CodeWarrior. If you > > don't have CodeWarrior, you can download MPW from Apple's ftp site for > > free and compile using that. > > Corran, > I'm very surprised that your recipe works, as it mixes MPW libraries (in the > extension module) with CodeWarrior libraries (in PythonCore). I would expect > all sort of trouble with I/O, malloc/free, and possibly loads of other places. > > If you're actually using this method, could you post a bit of information on > what works, what doesn't work and whether there are specific things you should > do (like calling printf, I can imagine)? > -- > 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 maccgi@bellsouth.net Mon Oct 25 15:58:30 1999 From: maccgi@bellsouth.net (Richard Gordon) Date: Mon, 25 Oct 1999 10:58:30 -0400 Subject: [Pythonmac-SIG] Gadfly SQL on Mac? Message-ID: I just ran across Aaron Watters' Gadfly (http://www.chordate.com/kwParsing/gadfly.html) while looking for something else and am interested in playing with it, but thought I'd ask if anyone happens to know if this runs ok on Mac or not? Also, it's the only SQL engine that I've come across that seems to be entirely ram-based and while that should make it amazingly fast, I wonder how practical it would be to use unless you had hordes of memory to allocate to MacPython? Thanks. Richard Gordon -------------------- Gordon Consulting & Design Database Design/Scripting Languages mailto:richard@richardgordon.net http://www.richardgordon.net 770.971.6887 (voice) 770.216.1829 (fax) From savageb@pacbell.net Mon Oct 25 20:55:42 1999 From: savageb@pacbell.net (Bob Savage) Date: Mon, 25 Oct 1999 12:55:42 -0700 Subject: [Pythonmac-SIG] Gadfly SQL on Mac? In-Reply-To: Message-ID: Richard Gordon > I just ran across Aaron Watters' Gadfly > (http://www.chordate.com/kwParsing/gadfly.html) while looking for > something else and am interested in playing with it, but thought I'd > ask if anyone happens to know if this runs ok on Mac or not? Also, > it's the only SQL engine that I've come across that seems to be > entirely ram-based and while that should make it amazingly fast, I > wonder how practical it would be to use unless you had hordes of > memory to allocate to MacPython? Thanks. Richard, I did some work with Gadfly on my Mac this past year. I found it to run perfectly fine with one caveat: eventually the in-RAM model came back to bite me. I had four tables, each with about 35,000 rows which gave me an out-of-memory error. I might have been able to tweak it so that it still worked by dividing the databse up into four databases (one for each table) but that would have limited my ability to fashion Queries on my data. Still haven't come up with a good alternative. Also Aaron gave me an experimental patch to use a B-tree lookup table, but, again, that really restricted my ability to do queries (it worked great for "where somerow is 'something'" type searches but not on inexact matches like greater than, or max, etc.) I would say you should consider how much information you are going to throw at it. If the number of total rows in the DB are going to approach (or exceed) 140,000, you will probably need a different solution. If you can structure your data so that it never gets near that amount, I would say Gadfly is a pleasure to use. Bob Savage From cwebster@nevada.edu Tue Oct 26 00:02:54 1999 From: cwebster@nevada.edu (Corran Webster) Date: Mon, 25 Oct 1999 16:02:54 -0700 (PDT) Subject: [Pythonmac-SIG] C module creation on MacPython In-Reply-To: <19991025103044.F358335BB1E@snelboot.oratrix.nl> Message-ID: > > > What is needed to create a c module in MacPython? > > > > Doug Wyatt gave some pointers for compiling with CodeWarrior. If you > > don't have CodeWarrior, you can download MPW from Apple's ftp site for > > free and compile using that. FWIW, in my original post, I forgot to mention that you need to change the :Mac:Include:config.h file to add support for forward static declarations if you are using MrC in MPW: #ifdef __MRC__ #define BAD_STATIC_FORWARD #endif needs to be added at the appropriate point. > Corran, > I'm very surprised that your recipe works, as it mixes MPW libraries (in the > extension module) with CodeWarrior libraries (in PythonCore). I would expect > all sort of trouble with I/O, malloc/free, and possibly loads of other places. I hadn't considered this possibility - and yes, there ar warnings about symbols appearing in PythonCore plus some other library, but I had been ignoring them for the large part, assuming that MPW would choose sensibly between possible options. As I said, I basically hacked around until I got stuff to compile and run. I haven't really pushed these compiled modules to the limits, so I wouldn't have noticed slow memory leaks or the like which would result from malloc/free not working properly. > If you're actually using this method, could you post a bit of information on > what works, what doesn't work and whether there are specific things you should > do (like calling printf, I can imagine)? The main things I've tried have been pretty much pure C modules like Marc-Andre Lemburg's various mx modules, so I/O and so forth haven't been major issues. I just did a quick check with printf, and it appears that the order that MPW links is important - if PythonCore is linked before StdCLib, then printf appears to work fine; if linked in the other order then it simply does nothing - no error, nothing printed to standard output, etc. which makes sense because MPW StdCLib wouldn't know about SIOUX and would be trying to use SIOW or the like, although it is interesting that it didn't cause a crash. Testing in the IDE, nothing appears either way - whether it was run in the interactive window or as a script. StdCLib only appears to be required for linking by MPW if you are using input/output in your module, so most of the modules I worked with weren't using it at all, and so were using Python's versions of things like malloc and free. I'm going to have to look at this a bit more closely, but my guess is that you probably want PythonCore linked first so that you're using the same versions of the basic C libraries. The only other multiply defined symbols between PythonCore and the standard MPW libraries are the cursor utilities, and only Mac-specific modules would be using that. So I suspect that most other modules will compile and run fine as long as they aren't relying on OS specific features. The long and the short of it is that you seem to be able to get basic stuff to work fine in MPW, but there may be subtle bugs in extreme situations; stuff which requires I/O seems trickier, but with the right linking order can probably be made to work. I hope all this makes sense. I'd be more than interested in what more experienced people have to say - my Macintosh coding experience is limited. Regards, Corran From jack@oratrix.nl Tue Oct 26 10:34:46 1999 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 26 Oct 1999 11:34:46 +0200 Subject: [Pythonmac-SIG] C module creation on MacPython In-Reply-To: Message by Corran Webster , Mon, 25 Oct 1999 16:02:54 -0700 (PDT) , Message-ID: <19991026093446.7FDC535BB1E@snelboot.oratrix.nl> Wow, I'm really impressed that building extensions with MrC seems to work so well! What I would really like is to extend the plugins.html document to include instructions for building plugins using MrC, and having a Makefile for xxmodule. The only point is that plugins.html uses the long-useless and untestable InterSLIP as its example. If someone could take the plugins documentation and rewrite it around an example interface that actually works on all Macintoshes that would be very helpful. Something like (parts of) the Shutdown Manager, or tGetDateTime or some such comes to mind. -- 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 doug@sonosphere.com Wed Oct 27 11:07:18 1999 From: doug@sonosphere.com (Doug Wyatt) Date: Wed, 27 Oct 1999 06:07:18 -0400 Subject: [Pythonmac-SIG] macglue.h In-Reply-To: <19991026093446.7FDC535BB1E@snelboot.oratrix.nl> References: <19991026093446.7FDC535BB1E@snelboot.oratrix.nl> Message-ID: I'm embedding Python in a Mac app and had to make a small tweak. macglue.h isn't C++ aware, so I get link errors in my C++ app when trying to link to the C functions declared in the header. Of course #ifdef __cplusplus extern "C" { #endif around the function prototypes solves everything. Doug who earlier spent 90 minutes learning the hard way that Py_None must be INCREF'd before returning it from a C function :) -- Doug Wyatt doug@sonosphere.com http://www.sonosphere.com/ From cwebster@nevada.edu Wed Oct 27 19:39:13 1999 From: cwebster@nevada.edu (Corran Webster) Date: Wed, 27 Oct 1999 11:39:13 -0700 (PDT) Subject: [Pythonmac-SIG] C module creation on MacPython In-Reply-To: <19991026093446.7FDC535BB1E@snelboot.oratrix.nl> Message-ID: > Wow, I'm really impressed that building extensions with MrC seems to work so > well! > > What I would really like is to extend the plugins.html document to include > instructions for building plugins using MrC, and having a Makefile for > xxmodule. Since there seems to be interest in this, I've written a HOWTO. It's currently available at: http://www.nevada.edu/~cwebster/Python/MPWHOWTO/MPWHOWTO.html with associated files (including a makefile for xxmodule) in the same directory. You can download the whole lot as: http://www.nevada.edu/~cwebster/Python/MPWHOWTO/MPWHOWTO.sit.hqx I invite comments and corrections; this is a first draft. In particular, I'm going to need to investigate further how GUSI connects in (I have not been using it, but it has the potential to make porting from Unix significantly easier if it can be linked in correctly). I'm also likely to fiddle with the xxmodule make file - currently it's just what CreateMake spits out, modified as described in the HOWTO; but it would make more sense to re-write it by hand to illustrate how one might write one from scratch. If this, or a modified version, is appropriate to add to the documentation for MacPython, I'd have no problem with that (in fact it'd be sorta cool to contibute). Regards, Corran From cbarker@jps.net Thu Oct 28 21:10:50 1999 From: cbarker@jps.net (Chris Barker) Date: Thu, 28 Oct 1999 13:10:50 -0700 Subject: [Pythonmac-SIG] Creator of text files created by Python scripts References: <199907220503.BAA21467@python.org> Message-ID: <3818ADCA.345FC440@jps.net> Hi, I've found that when I create a new text file in a script that I'm running from the IDE, it gets created with creator type "PYTH". If I run the same script by dropping it on the Python interpreter, it gets created with creator "ttxt", which is not ideal, but is a better option. having various text files around that are not python scripts, but have creator type "PYTH" is a pain. Can I change this behavioe in the IDE? -Thanks, -Chris -- Christopher Barker, Ph.D. cbarker@jps.net --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ From savageb@pacbell.net Fri Oct 29 06:38:06 1999 From: savageb@pacbell.net (savageb) Date: Thu, 28 Oct 1999 22:38:06 -0700 Subject: [Pythonmac-SIG] Creator of text files created by Python scripts In-Reply-To: <3818ADCA.345FC440@jps.net> Message-ID: Chris, you can do a few things. For one, if you are using the Interpretor and you prefer something other than 'ttxt' you can change that by using the edit python prefs app (click the "default startup options" button to find it). If your python script is usable as a "double-clickable" script (or perhaps something that you trigger through drag&drop) then you can actually drop the script applet onto the edit python prefs and that should give you the ability to change the creator and type codes for just that instance of the interpretor - you can use this method to change the IDE as well. Finally if you didn't want to screw up the default settings (like if you want your scripts to still open in the IDE by default) you can set the creator and type codes as part of the script using the macfs module (you can look at mac/scripts/fixfiletypes.py as an example). Good luck with it, Bob Chris Barker > I've found that when I create a new text file in a script that I'm > running from the IDE, it gets created with creator type "PYTH". If I run > the same script by dropping it on the Python interpreter, it gets > created with creator "ttxt", which is not ideal, but is a better option. > > having various text files around that are not python scripts, but have > creator type "PYTH" is a pain. Can I change this behavioe in the IDE?