From peter.sommerfeld@gmx.de Sat May 1 03:22:38 1999 From: peter.sommerfeld@gmx.de (Peter Sommerfeld) Date: Sat, 1 May 1999 04:22:38 +0200 Subject: [Pythonmac-SIG] RefCount ? Message-ID: I have some objects which contain elements with direkt references back to the object. It would be possible to avoid any danger if I could decrement the refcount of the object at assignment. There is sys.getrefcount but is there somewhere it's counterpart, set refount ? This seems to be possible on C-level only. Or is there somewhere a hidden backdoor or dirty hack to accomplish this ? thanx -- Peter From just@letterror.com Sat May 1 10:22:03 1999 From: just@letterror.com (Just van Rossum) Date: Sat, 1 May 1999 11:22:03 +0200 Subject: [Pythonmac-SIG] RefCount ? In-Reply-To: Message-ID: At 4:22 AM +0200 5/1/99, Peter Sommerfeld wrote: >I have some objects which contain elements with direkt references >back to the object. It would be possible to avoid any danger if I could >decrement the refcount of the object at assignment. There is sys.getrefcount >but is there somewhere it's counterpart, set refount ? This seems to be >possible on C-level only. Or is there somewhere a hidden backdoor or dirty >hack to accomplish this ? You *really* don't want to do this. Either provide a close() method that breaks the circular refs (which you'll have to call explicitly) or reconsider your design: right now I'm working on a fairly large library in which I prevent the problem by passing the parent object as an extra argument to certain method calls. This works real nice for me. Although the circular references problem seems awkward, it kindof makes you more aware of how your objects interact. It's not the first time my *design* improved by trying use as few references as possible. Disclaimer: I'm not an OO expert, so it may be all rubbish what I'm saying. Just From peter.sommerfeld@gmx.de Sat May 1 12:23:49 1999 From: peter.sommerfeld@gmx.de (Peter Sommerfeld) Date: Sat, 1 May 1999 13:23:49 +0200 Subject: [Pythonmac-SIG] RefCount ? In-Reply-To: References: Message-ID: Just van Rossun wrote: >At 4:22 AM +0200 5/1/99, Peter Sommerfeld wrote: >>I have some objects which contain elements with direkt references >>back to the object. It would be possible to avoid any danger if I could >>decrement the refcount of the object at assignment. There is sys.getrefcount >>but is there somewhere it's counterpart, set refount ? This seems to be >>possible on C-level only. Or is there somewhere a hidden backdoor or dirty >>hack to accomplish this ? > >You *really* don't want to do this. > >Either provide a close() method that breaks the circular refs (which you'll >have to call explicitly) or reconsider your design: right now I'm working >on a fairly large library in which I prevent the problem by passing the >parent object as an extra argument to certain method calls. This works real >nice for me. Yes, I'm aware of this possibilities. But these add some unneccesary complexity. It would really be very nice to make __del__ "closing" the object automaticly. To decrement the refcount would *really* be the least dangerous, fastest and most reliable solution. >Disclaimer: I'm not an OO expert, so it may be all rubbish what I'm saying. > >Just Me too. But I will become one if I continue to redesign the design ;) -- Peter (still hoping to avoid C-level while prototyping) From llatz@stuttgart.netsurf.de Sun May 2 23:56:27 1999 From: llatz@stuttgart.netsurf.de (tomtom) Date: Mon, 03 May 1999 00:56:27 +0200 Subject: [Pythonmac-SIG] newbie stuff Message-ID: <372CD819.75449293@stuttgart.netsurf.de> i just downloaded and installed the python 152 beta and tried the examples first, many of which didnīt run for some reasons. also i tried to run the IDLE applet, which told me it wouldnīt run because there aint no tk module. there is however a tkinter sharedlib in the plugins folder. should this do or am i supposed to do a tcl-tk install? confused, lukas ps: btw i didnīt try to run the various examples in the mac folder from the ide, rather i doubleclicked them. was that the wrong approach? do they expect args maybe? the movie and picture examples worked, most others didnt. From peter.sommerfeld@gmx.de Mon May 3 01:57:33 1999 From: peter.sommerfeld@gmx.de (Peter Sommerfeld) Date: Mon, 3 May 1999 02:57:33 +0200 Subject: [Pythonmac-SIG] newbie stuff In-Reply-To: <372CD819.75449293@stuttgart.netsurf.de> Message-ID: Lukas wrote: >i just downloaded and installed the python 152 beta and tried the examples >first, many of which didnīt run for some reasons. also i tried to run the IDLE >applet, which told me it wouldnīt run because there aint no tk module. >there is however a tkinter sharedlib in the plugins folder. should this do or >am i supposed to do a tcl-tk install? Lukas, forget TKinter presently, and IDLE too :( It has been reported that TK 8.x doesn't run properly yet (yes, you have to install tk first). Take the IDE, that's definitly the way to go on mac (dont use debugger breakpoints presently, will be fixed at 1.5.2). BTW: there is a german mailinglist too. Somewhere at regards -- Peter PS: Hey, auch'n Nachtarbeiter :-) From jack@oratrix.nl Mon May 3 14:51:38 1999 From: jack@oratrix.nl (Jack Jansen) Date: Mon, 03 May 1999 15:51:38 +0200 Subject: [Pythonmac-SIG] RefCount ? In-Reply-To: Message by Peter Sommerfeld , Sat, 1 May 1999 13:23:49 +0200 , Message-ID: <19990503135139.08AA9303121@snelboot.oratrix.nl> > It would really be very nice to make __del__ "closing" the object automaticly. > To decrement the refcount would *really* be the least dangerous, fastest and > most reliable solution. Believe Just (and me:-): you _really_ don't want to do this. Maybe some future version of Python will provide something like soft references, and then its fine, but currently things will break rather spectacularly if you decref an object and keep a reference around. What you really want to do is go from object B to object A without keeping a refcounted reference to A in B. Just suggested one way to do this, another is to use indirection through a dictionary. Something like this (typed in here, so untested): class ObjectKeeper: def __init__(self): self.dict = {} self.counter = 0 def register(self, object): self.counter = self.counter + 1 self.dict[self.counter] = object return self.counter def unregister(self, key): del self.dict[key] def get(self, key): return self.dict[key] objectkeeper = ObjectKeeper() Now in de parent __init__ you register and remember the key. Store the key in the children, and when you need the parent you use objectkeeper.get() to obtain it. In the parent __del__ do an unregister. And, of course, ObjectKeeper can have lots of bells and whistles like __getitem__ methods, the objectkeeper object can be kept as a class attribute in the parent class, 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 rcohen@llnl.gov Mon May 3 17:15:50 1999 From: rcohen@llnl.gov (Ron Cohen - MFE Theory) Date: Mon, 03 May 1999 09:15:50 -0700 Subject: [Pythonmac-SIG] Re: Query about Amsterdam References: <19990503135139.08AA9303121@snelboot.oratrix.nl> Message-ID: <372DCBB6.C799CFDA@llnl.gov> To all you folks with the .nl addresses: I am a regular reader and occasional poster to this email group, and have an off-the-subject query now. My family and I will be visiting Amsterdam this summer, and we've heard about boats on the canals that operate as lodgings. Do any of you know how I might get a list of such places, or have recommendations? I am looking for four nights starting July 11. (I have already been in contact with Amstel Botel, but I'm told there are other options.) Thank you. Ron Cohen From jeffrey@Digicool.com Mon May 3 17:59:16 1999 From: jeffrey@Digicool.com (Jeffrey P Shell) Date: Mon, 03 May 1999 12:59:16 -0400 Subject: [Pythonmac-SIG] MacOS X Server, round 2 (long-ish) Message-ID: <199905031659.MAA06155@python.org> First a quick question: is this an appropriate place to talk about Python on MacOS X Server ? I got Python 1.5.2 working with threads and managed (finally) to get Zope running with ZServer. There was some minor trickery involved and I'm not sure if how "right" i did everything. I saw a message from someone who works in the MacOS X Server tools group who said they had 1.5.2b2 building succesfully and want to know what they did. To get it working with so that Zope (which seems to prefer having shared libraries, which i prefer anyways) would work, i configured it with the following: ./configure --with-threads --with-dyld --with-next-framework --prefix=/usr/local/python152 An initial problem with this was that make install and friends would install, naturally, in to (prefix)/lib/python1.5 However, enabling --with-next-framework works under the assumption (which is probably logical) that Python is going into a .framework directory, which takes care of versioning on its own, and creates the default sys.path to be like "['.../lib', '.../lib/lib-dynload']", etc, instead of lib/python1.5, lib/python1.5/lib-dynload, etcetera. Not knowing enough about OpenStep's .framework setup, I wanted everything to go into /usr/local/python152 like normal. So I modified the C code that doesn't add the python1.5/ to the path when being built for NeXT frameworks. I don't know how right this was. But, this did work for my purposes. Furthermore, when configured --with-next-framework, it seems most (or all) of the executable code is actually put into "libpython1.5.dylib", which didn't seem to get picked up by "make install". If i put a copy of libpython1.5.dylib into /usr/lib, running Python works fine. But it had to be done manually. Again, I don't know if this was the right thing to do. Now what happened from this is that the C code to figure out the path/name of the Python executable (in sys.executable) points to "/usr/lib/libpython1.5.dylib". Zope builder scripts use sys.executable for a couple of purposes, expecting a value that's the path to the executable (ie, "/usr/local/bin/python1.5"). I manually changed the Zope scripts to use the real python instead of using sys.executable, but this would only work on my machine. I think running configure with no options set created a static python just fine. I've had problems running it with just the --with-dyld option set. But Zope wanted to work with .so files, and compiling with --with-next-framework seems to be the only way to get that working properly. (Another issue with this is, the Makefile.pre.in that gets installed in lib/python1.5/config/ doesn't save the LDLIBRARY which the --with-next-framework needs, and therefor compiling Zope couldn't link properly until I added the following line in the Makefile.pre.in::) LDLIBRARY=/usr/lib/libpython($VERSION).dylib I think building/installing into a Framework is what I need to do, but I don't want to trip over or cause any problems with Objective Everything's Python installation (which is in /Local/Library/Frameworks/Python.framework). When I get back into MacOS X Server (my Bluebox doesn't seem to work, i don't know if it's memory issues or something else, so right now I'm dual booting with MacOS 8.5.1) FWIW: Objective Everything will work with Carbon! Another way of working with Mac applications with Python. :) I haven't played with Objective Everything too much, but what I did see was pretty cool. I wonder if its would have a hard time with Python 1.5.x though.. :/ (like someone mentioned earlier, the shipping version uses 1.4). .jPS | jeffrey@digicool.com zope, through the web. www.zope.org From joe@strout.net Mon May 3 18:23:46 1999 From: joe@strout.net (Joseph J. Strout) Date: Mon, 3 May 1999 10:23:46 -0700 Subject: [Pythonmac-SIG] MacOS X Server, round 2 (long-ish) In-Reply-To: <199905031659.MAA06155@python.org> Message-ID: At 9:59 AM -0700 05/03/99, Jeffrey P Shell wrote: >First a quick question: is this an appropriate place to talk about Python >on MacOS X Server ? Yep, I'd say so. Though ugh, looking at your message and comprehending about 5% of it, I'm not sure I *want* to use MacOS X... I hope it turns out easier than MacOS X Server! Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From jeffrey@Digicool.com Mon May 3 18:56:40 1999 From: jeffrey@Digicool.com (Jeffrey P Shell) Date: Mon, 03 May 1999 13:56:40 -0400 Subject: [Pythonmac-SIG] MacOS X Server, round 2 (long-ish) Message-ID: <199905031756.NAA07562@python.org> >>First a quick question: is this an appropriate place to talk about Python >>on MacOS X Server ? > > Yep, I'd say so. > > Though ugh, looking at your message and comprehending about 5% of it, I'm > not sure I *want* to use MacOS X... I hope it turns out easier than MacOS > X Server! I'm positive it will be. I think more will be unveiled at this years WWDC which i REALLY REALLY wish I could go to. Unfortunately, we're not (yet) a big enough Apple shop to warrent spending the money on such things. But, I'm gaining a lot of new moral high ground around here thanks to MacOS X Server, and I'm keeping a good eye on Darwin to see how/where that goes. Carbon is really what you should be watching if you're interested in the future of 'traditional' MacOS programming. Again, I think this will come out significantly at WWDC. It's starting to smell like the developer beta of MacOS X itself may be close at hand. *sigh* Time for more hard drives. :) .jPS | jeffrey@digicool.com zope, through the web. www.zope.org From peter.sommerfeld@gmx.de Mon May 3 21:17:36 1999 From: peter.sommerfeld@gmx.de (Peter Sommerfeld) Date: Mon, 3 May 1999 22:17:36 +0200 Subject: [Pythonmac-SIG] RefCount ? In-Reply-To: <19990503135139.08AA9303121@snelboot.oratrix.nl> References: Message by Peter Sommerfeld , Sat, 1 May 1999 13:23:49 +0200 , Message-ID: Jack Jansen wrote: >Believe Just (and me:-): you _really_ don't want to do this. [snip] Jack (and Just), believe me, I fully trust your knowledge and experiance, but ... :-) >Now in de parent __init__ you register and remember the key. Store the key in >the children, and when you need the parent you use objectkeeper.get() to >obtain it. In the parent __del__ do an unregister. If I use a registration server (like your ObjectKeeper) remains one problem: The __del__ function of the parent object will never be called because the last reference is stored within the registration server itself (Or do I get anything wrong here ?). This would work best if I could decrement the refcount by 1 imo. There seem to be 2 solutions: The first is to use an explicit destroy (or however you call it) function, the second is to make the registration server regularly check the refcounts of _all_ objects and del it if it falls below a certain threshhold (2 ???). The first is what I want to avoid (rather error prone), and the net effect of the second is a grown up object managment unit :-( On the other hand: the more I think about such a central unit, the more I see it's charme. :-) Anyway, that all is fairly cruical for my application and I have to think about it carefully. thanks a lot -- Peter From llatz@stuttgart.netsurf.de Tue May 4 09:58:12 1999 From: llatz@stuttgart.netsurf.de (tomtom) Date: Tue, 04 May 1999 10:58:12 +0200 Subject: [Pythonmac-SIG] newbie stuff References: Message-ID: <372EB6A3.F6526E8A@stuttgart.netsurf.de> > > Lukas, > > forget TKinter presently, and IDLE too :( It has been reported > that TK 8.x doesn't run properly yet (yes, you have to install tk first). > Take the IDE, that's definitly the way to go on mac (dont use debugger > breakpoints presently, will be fixed at 1.5.2). > > BTW: there is a german mailinglist too. > Somewhere at > > regards > > -- Peter > > PS: Hey, auch'n Nachtarbeiter :-) > :-) thanks for the info, Peter, i carried on regardless of the abovementioned problems and downloaded and installed the new tcl-tk stuff; put an alias to tk's shdlb into python's plugins folder and whoopie, the tkinter examples in the matt folder in the demo folder all worked except for window-creation-with-location.py (from TkinterUtils import * ImportError: No module named TkinterUtils). not bad. well if newbie questions are ok here (?), here are some more: so are there any really serious problems with tkinter that suggest it really shouldnīt be used? i wasnīt aware that the IDE is supposed to *replace* tkinter (?), altho i saw it has some windowing stuff. is it meant to replace tkinter on the mac altogether? another dumb question: i am kind of wary of having hulking folders in my extension folder. is it ok to move the tk shdlib into pythons plug-ins folder and just trash the tcl folder? (tcl fans, no offense..) lukas From peter.sommerfeld@gmx.de Tue May 4 11:06:00 1999 From: peter.sommerfeld@gmx.de (Peter Sommerfeld) Date: Tue, 4 May 1999 12:06:00 +0200 Subject: [Pythonmac-SIG] newbie stuff In-Reply-To: <372EB6A3.F6526E8A@stuttgart.netsurf.de> References: Message-ID: Lukas wrote: >thanks for the info, Peter, i carried on regardless of the abovementioned >problems and downloaded and installed the new tcl-tk stuff; put an alias to >tk's shdlb into python's plugins folder and whoopie, the tkinter examples in >the matt folder in the demo folder all worked except for >window-creation-with-location.py (from TkinterUtils import * ImportError: No >module named TkinterUtils). not bad. I'm glad you got it to run. There seem to be some major problems with TK 8.1. May be 8.0 is worth a try. But I have no newer experiance with TK at all. I just jumped in because the gurus here seem to be rather busy. >well if newbie questions are ok here (?), here are some more: Well, Jack agreed on this question some month ago. >so are there any really serious problems with tkinter that suggest it really >shouldnīt be used? Cannot say so much about that. When I checked it out (8.0) the look and feel was not so much Mac-like. And you always have to install TCL/TK, at least 3mb even for the most simple application if memory serves well. But if portability is an issue ... >i wasnīt aware that the IDE is supposed to *replace* tkinter (?), altho i saw >it has some windowing stuff. is it meant to replace tkinter on the mac >altogether? Sorry, that is a missunderstanding. What I ment was: don't play with with IDLE (presently, because it needs a running TK) and use JvR's IDE, an Integrated-Development-Enviroment. It's not ment to be a graphic lib. You have presently 2 options (I'm aware off): Mac Toolbox or TK. Make your choice. I would like to see wxWindows on Mac but that will last ... >another dumb question: i am kind of wary of having hulking folders in my >extension folder. is it ok to move the tk shdlib into pythons plug-ins folder >and just trash the tcl folder? (tcl fans, no offense..) >lukas Dunno, but I don't think so. regards -- Peter From jack@oratrix.nl Tue May 4 11:28:12 1999 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 04 May 1999 12:28:12 +0200 Subject: [Pythonmac-SIG] newbie stuff In-Reply-To: Message by Peter Sommerfeld , Tue, 4 May 1999 12:06:00 +0200 , Message-ID: <19990504102812.E88D6303121@snelboot.oratrix.nl> > [...] When I checked it out (8.0) the look and > feel was not so much Mac-like. And you always have to install TCL/TK, > at least 3mb even for the most simple application if memory serves well. I've seen remarks like this a few times the last few weeks, and I'm a bit surprised, as the _tkinter module for the mac (the Tkinter "engine") was designed _not_ to need an installed Tk to work, by incorporating everything into the resource fork. Is it indeed true that you can't use Tkinter applications with Python without first installing Tk? If so I'd like to hear what the errors are if you do attempt it so I can try to fix it (time permitting). -- 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 llatz@stuttgart.netsurf.de Tue May 4 12:17:25 1999 From: llatz@stuttgart.netsurf.de (tomtom) Date: Tue, 04 May 1999 13:17:25 +0200 Subject: [Pythonmac-SIG] newbie stuff References: <19990504102812.E88D6303121@snelboot.oratrix.nl> Message-ID: <372ED73D.97D706EB@stuttgart.netsurf.de> Jack Jansen wrote: > > > [...] When I checked it out (8.0) the look and > > feel was not so much Mac-like. And you always have to install TCL/TK, > > at least 3mb even for the most simple application if memory serves well. > > I've seen remarks like this a few times the last few weeks, and I'm a bit > surprised, as the _tkinter module for the mac (the Tkinter "engine") was > designed _not_ to need an installed Tk to work, by incorporating everything > into the resource fork. > > Is it indeed true that you can't use Tkinter applications with Python without > first installing Tk? If so I'd like to hear what the errors are if you do > attempt it so I can try to fix it (time permitting). > -- sorry i may have caused unnecessary turmoil here. when i tried to run idle it didnīt and gave me some errors. havenīt documented it but i *think* there was some import error concerning tk_inter. so i downloaded tcl-tk and tried some *other* stuff that uses tk and it worked so i thought that mustve been it. just now i rechecked idle and it still dont run, python tells me this: Traceback (innermost last): File "8.5:Python 1.5.2b1:Tools:idle:idle", line 3, in ? PyShell.main() File "8.5:Python 1.5.2b1:Tools:idle:PyShell.py", line 604, in main fixwordbreaks(root) File "8.5:Python 1.5.2b1:Tools:idle:EditorWindow.py", line 498, in fixwordbreaks tk.call('tcl_wordBreakAfter', 'a b', 0) # make sure word.tcl is loaded TclError: invalid command name "tcl_wordBreakAfter" iīm not really certain now if the errors were any different before. sorry i havent checked the other tk_inter demos before installing tcl-tk, so maybe they would have run after all.. when i get back from work, iīll try it without the tcl folder in my extensions.. cheers, lukas From shhummel@ricochet.net Tue May 4 22:15:17 1999 From: shhummel@ricochet.net (Sean Hummel) Date: Tue, 04 May 1999 14:15:17 -0700 Subject: [Pythonmac-SIG] Multi-Columns lists with TK? Message-ID: <199905042115.QAA00247@rgate3.ricochet.net> Is it possible to use TK to make a multi column list? I can't seem to find a way of doing this with TK and the Macintosh (or any other platform for that matter,) but I was wondering if someone else had gone to the trouble of doing it. From A.M.INGRALDI@larc.nasa.gov Wed May 5 03:01:34 1999 From: A.M.INGRALDI@larc.nasa.gov (Anthony M. Ingraldi) Date: Tue, 04 May 1999 22:01:34 -0400 Subject: [Pythonmac-SIG] Multi-Columns lists with TK? Message-ID: <199905050208.WAA11434@post.larc.nasa.gov> On Tuesday, May 4, 1999, Sean Hummel wrote: > Is it possible to use TK to make a multi column list? > Here's a semi-brief example that shows how to have one scrollbar controlling two lists. It also shows how to do a simple menubar. -- from Tkinter import * import sys root = Tk() menuBar = Menu() root.config(menu=menuBar) fileMenu = Menu(menuBar) fileMenu.add_command(label='Quit', command=sys.exit, accelerator='Command+Q') menuBar.add_cascade(label='File', menu=fileMenu) aList = Listbox(root, selectmode=SINGLE) anotherList = Listbox(root, selectmode=SINGLE) aScrollbar = Scrollbar(root, orient=VERTICAL) def scroll_em(*args): apply(aList.yview, args) apply(anotherList.yview, args) aList.config(yscrollcommand=aScrollbar.set) anotherList.config(yscrollcommand=aScrollbar.set) aScrollbar.config(command=scroll_em) aList.pack(side=LEFT, expand=1, fill=BOTH) anotherList.pack(side=LEFT, expand=1, fill=BOTH) aScrollbar.pack(side=LEFT, fill=Y) # add some list items for i in range(30): aList.insert(END, 'ITEM' + `i`) anotherList.insert(END, 'ITEM' + `i`) root.mainloop() -- Tony Ingraldi | e-mail: A.M.INGRALDI@LaRC.NASA.GOV NASA Langley Research Center | Mail Stop 267 | Phone : (757) 864-3039 Hampton, VA 23681-2199 | Fax : (757) 864-7892 From llatz@stuttgart.netsurf.de Wed May 5 12:27:18 1999 From: llatz@stuttgart.netsurf.de (tomtom) Date: Wed, 05 May 1999 13:27:18 +0200 Subject: [Pythonmac-SIG] newbie stuff References: <19990504102812.E88D6303121@snelboot.oratrix.nl> <372ED73D.97D706EB@stuttgart.netsurf.de> Message-ID: <37302B16.8FE9C0AD@stuttgart.netsurf.de> > > Is it indeed true that you can't use Tkinter applications with Python without > > first installing Tk? If so I'd like to hear what the errors are if you do > > attempt it so I can try to fix it (time permitting). > > -- > > sorry i may have caused unnecessary turmoil here. > when i tried to run idle it didnīt and gave me some errors. havenīt documented > it but i *think* there was some import error concerning tk_inter. so i > downloaded tcl-tk and tried some *other* stuff that uses tk and it worked so i > thought that mustve been it. just now i rechecked idle and it still dont run, > python tells me this: > > Traceback (innermost last): > File "8.5:Python 1.5.2b1:Tools:idle:idle", line 3, in ? > PyShell.main() > File "8.5:Python 1.5.2b1:Tools:idle:PyShell.py", line 604, in main > fixwordbreaks(root) > File "8.5:Python 1.5.2b1:Tools:idle:EditorWindow.py", line 498, in fixwordbreaks > tk.call('tcl_wordBreakAfter', 'a b', 0) # make sure word.tcl is loaded > TclError: invalid command name "tcl_wordBreakAfter" > > iīm not really certain now if the errors were any different before. sorry i > havent checked the other tk_inter demos before installing tcl-tk, so maybe > they would have run after all.. > when i get back from work, iīll try it without the tcl folder in my extensions.. i just checked: the tk_inter examples work well without tcl-tk installed. the IDLE doesnīt, errors are same as above. also what it does it gives me doubled items in the menu bar. apple..file..edit also i canīt get grail to work, but that may be because i havenīt got the setup right yet..thereīs like an infinite amount of stuff i donīt know about python, so i better shut up now. cheers, lukas From just@letterror.com Wed May 5 12:42:11 1999 From: just@letterror.com (Just van Rossum) Date: Wed, 5 May 1999 13:42:11 +0200 Subject: [Pythonmac-SIG] newbie stuff In-Reply-To: <37302B16.8FE9C0AD@stuttgart.netsurf.de> References: <19990504102812.E88D6303121@snelboot.oratrix.nl> <372ED73D.97D706EB@stuttgart.netsurf.de> Message-ID: At 1:27 PM +0200 5/5/99, tomtom wrote: >> > Is it indeed true that you can't use Tkinter applications with Python >>without >> > first installing Tk? If so I'd like to hear what the errors are if you do >> > attempt it so I can try to fix it (time permitting). >> > -- >> >> sorry i may have caused unnecessary turmoil here. >> when i tried to run idle it didnīt and gave me some errors. havenīt >>documented >> it but i *think* there was some import error concerning tk_inter. so i >> downloaded tcl-tk and tried some *other* stuff that uses tk and it >>worked so i >> thought that mustve been it. just now i rechecked idle and it still dont >>run, >> python tells me this: >> >> Traceback (innermost last): >> File "8.5:Python 1.5.2b1:Tools:idle:idle", line 3, in ? >> PyShell.main() >> File "8.5:Python 1.5.2b1:Tools:idle:PyShell.py", line 604, in main >> fixwordbreaks(root) >> File "8.5:Python 1.5.2b1:Tools:idle:EditorWindow.py", line 498, in >>fixwordbreaks >> tk.call('tcl_wordBreakAfter', 'a b', 0) # make sure word.tcl is loaded >> TclError: invalid command name "tcl_wordBreakAfter" Sorry for my late reply: this is a version problem. Apparently we use an older Tcl/Tk than Guido wrote Idle for. If you comment out the line that uses 'tcl_wordBreakAfter', it should work. Just From savageb@pacbell.net Thu May 6 07:29:47 1999 From: savageb@pacbell.net (savageb) Date: Wed, 05 May 1999 23:29:47 -0700 Subject: [Pythonmac-SIG] Re: MacOS X Server, round 2 Message-ID: <199905060634.XAA12696@mail-gw3.pacbell.net> >First a quick question: is this an appropriate place to talk about Python >on MacOS X Server ? Jeffrey, glad to see we have an infiltrator at digicool ;> Please continue to bring up MacOSX Server issues here -- at least until a better forum becomes apparent. If nothing else it will be a logical place to check for archived posts for people searching for info in the future. Bob From landauer@apple.com Thu May 6 18:34:31 1999 From: landauer@apple.com (Doug Landauer) Date: Thu, 6 May 1999 10:34:31 -0700 Subject: [Pythonmac-SIG] MacOS X Server, round 2 (long-ish) In-Reply-To: <199905031659.MAA06155@python.org> Message-ID: > I saw a message from someone who works in the MacOS X Server > tools group who said they had 1.5.2b2 building succesfully > and want to know what they did. That was I, and I did nothing. I.e., I configured it, and then I "make"d it. I didn't make any attempts to get the shared libraries or Zope running. Unfortunately, it's just a personal project for me, I use it to build small tools to help debug gcc, so tend not to need it to be all that complete or "play well with others". I keep trying to talk the Darwin guys into including it in there and in Mac OS X [Server or not], but haven't yet been successful. -- Doug From eddthompson@ssi.parlorcity.com Thu May 6 21:16:06 1999 From: eddthompson@ssi.parlorcity.com (Euphoriadj) Date: Thu, 6 May 1999 15:16:06 -0500 Subject: [Pythonmac-SIG] gdk+ on a mac with python? In-Reply-To: <199905050503.BAA26124@python.org> Message-ID: I am very new to python and rather new to gdk but I used to code tk all the time and I never cared much for it and I would rather use gdk. So is there a way to import gdk on the mac if not what other methods are there for gui's on the mac in python and any pointers on how to use them would be nice also. TKs An Elephant: A mouse built to government specifications Nevr try to out stubborn a cat Natural laws have no pity From joe@strout.net Thu May 6 22:03:22 1999 From: joe@strout.net (Joseph J. Strout) Date: Thu, 6 May 1999 14:03:22 -0700 Subject: [Pythonmac-SIG] gdk+ on a mac with python? In-Reply-To: References: <199905050503.BAA26124@python.org> Message-ID: At 1:16 PM -0700 05/06/99, Euphoriadj wrote: >I am very new to python and rather new to gdk but I used to code tk all the >time and I never cared much for it and I would rather use gdk. So is there >a way to import gdk on the mac if not what other >methods are there for gui's on the mac in python and any pointers on how to >use them would be nice also. Well, of course the best GUI on the Mac is MacOS itself. You can use direct QuickDraw calls in Python (especially Python IDE) windows. If that's a bit complicated for your needs, you could try PIDDLE. This is a cross-platform and cross-media drawing library. Unfortunately, the Mac version requires a few goodies which are only available in the next release of MacPython, not the current one. I suggest you post messages asking "Hey Jack and Just, when is that next release of MacPython coming out?" daily until it arrives. I'd do it, but for some reason they've stopped answering my messages. ;) For more info on PIDDLE -- which is still under development, but should be ready for use in the next few weeks -- go ye to: http://www.strout.net/python/piddle/ Cheers, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Biocomputing -- The Salk Institute | | joe@strout.net http://www.strout.net | `------------------------------------------------------------------' From erik@letterror.com Tue May 18 17:22:57 1999 From: erik@letterror.com (Erik van Blokland) Date: Tue, 18 May 1999 18:22:57 +0200 Subject: [Pythonmac-SIG] FilemakerPro module Message-ID: <199905181623.SAA07542@leidschenveen.denhaag.dataweb.net> Hi, I've built a module that accesses FileMakerPro through AppleEvents. A database object talks to Filemaker, opens documents etc. Record objects provide access to fields etc. It's not according to the Python standard database rules, but I've found it to be useful. I've implemented most of the things that can be done from AppleScript. Only one or two functions from FM did not make it due to AE weirdness. An overview of the classes can be found at: http://www.letterror.com/code/FMPro/FMProRef/index.html A page with download stuff is here (the code, demo and the reference itself in an archive) http://www.letterror.com/code/FMPro/fmpro.html best, erik van blokland From steele@cs.brandeis.edu Fri May 21 22:19:43 1999 From: steele@cs.brandeis.edu (Oliver Steele) Date: Fri, 21 May 1999 17:19:43 -0400 Subject: [Pythonmac-SIG] IDE patch to convert UNIX/MSDOS line feeds to carriage returns Message-ID: <199905212119.RAA10329@life.ai.mit.edu> Despite the best intentions of Anarchie and Internet Explorer, I often end up with Python source files (and other text files that I'd like to edit with PythonIDE) that use '\n' instead of '\r' as a line separator (and therefore show up as garbage in the text editing window). The patch at causes PythonIDE to notice when you open such a file, and offer to convert its '\n's to '\r's. It consists of 14 lines of code that go at the end of Editor.__init__ in {Python}:IDE:IDELib:IDE:PyEdit.py. I've also enclosed the code below, but I expect my mailer to mangle it in three ways: tabs will have been turned into spaces; the call to AskYesNoCancel will have been broken across two or more lines; and the initial '%s' on that line is supposed to be enclosed by curly braces (option-[ and shift-option-[). if '\n' in text: import EasyDialogs if string.find(text, '\r\n') >= 0: sourceOS = 'DOS' searchString = '\r\n' else: sourceOS = 'UNIX' searchString = '\n' change = EasyDialogs.AskYesNoCancel('ģ%sē contains %s-style line feeds. Change them to MacOS carriage returns?' % (self.title, sourceOS), 1) # bug: Cancel is treated as No if change > 0: text = string.replace(text, searchString, '\r') self.editgroup.editor.set(text, self.getfilename()) self.editgroup.editor.changed = 1 From just@letterror.com Fri May 21 22:45:29 1999 From: just@letterror.com (Just van Rossum) Date: Fri, 21 May 1999 23:45:29 +0200 Subject: [Pythonmac-SIG] IDE patch to convert UNIX/MSDOS line feeds to carriage returns In-Reply-To: <199905212119.RAA10329@life.ai.mit.edu> Message-ID: At 5:19 PM -0400 5/21/99, Oliver Steele wrote: >Despite the best intentions of Anarchie and Internet Explorer, I often end >up with Python source files (and other text files that I'd like to edit with >PythonIDE) that use '\n' instead of '\r' as a line separator (and therefore >show up as garbage in the text editing window). > >The patch at > causes >PythonIDE to notice when you open such a file, and offer to convert its >'\n's to '\r's. It consists of 14 lines of code that go at the end of >Editor.__init__ in {Python}:IDE:IDELib:IDE:PyEdit.py. Cool, thanks. I've checked it in, but I changed the behavior so that the dialog comes before the edit window appears. (Thanks for digging into the ugly guts of PyEdit.py ;-) Just From steele@cs.brandeis.edu Sat May 22 00:50:57 1999 From: steele@cs.brandeis.edu (Oliver Steele) Date: Fri, 21 May 1999 19:50:57 -0400 Subject: [Pythonmac-SIG] soft tabs for PythonIDE (preview; for the adventurous) Message-ID: <199905212351.TAA18012@life.ai.mit.edu> . This is a work in progress. It's alpha software: use it at your own risk. Importing this module into PythonIDE changes the behavior of text windows such that the Tab key inserts four spaces, instead of a tab character. It also changes "Shift left" and "Shift right" to recognize and insert, respectively, spaces instead of tabs. These changes make PythonIDE compatible with the behavior of emacs' python-mode, and with IDLE; they're useful if you're editing code that was developed on or is shared with developers on other platforms. For compatibility with hard-tabbed files, the system recognizes files that contain a carriage return followed by a tab ('\r\t'), and uses hard tabs instead of spaces in windows opened on those files. The behavior of the patched system is intended to be identical to the behavior of the unpatched system in this case, except that with the patch, the editor recognizes a sequence of spaces -- even in a window marked as hard-tabbed -- as being equivalent to a level of indentation. At some point it should become possible to set this behavior (hard tab versus soft tab) on a window-by-window basis, and to change the default. For now, you can type "PySpaceEditor.PySpaceEditor.use_hard_tabs = 1" to cause new files to use hard tabs. Usage: After PythonIDE has launched, type 'import PySpaceEditor' at its command line. From andres@corrada.com Fri May 21 21:04:29 1999 From: andres@corrada.com (Andres Corrada) Date: Fri, 21 May 1999 20:04:29 +0000 Subject: [Pythonmac-SIG] IDE patch to convert UNIX/MSDOS line feeds to carriage returns References: <199905212119.RAA10329@life.ai.mit.edu> Message-ID: <3745BBE6.6795BEBB@corrada.com> Funny coincidence, I just spent a couple of hours writing some Python code to unmangle an Alpha text file that I was looking at on an NT machine. In the process I noticed that IDLE saves the text files with Unix style line ends ('\n') on NT. Is it the intent of IDLE to enforce Unix-style line ends as the Python standard? I would prefer to have a settable option that specifies the line ends I want. In addition, I noticed that the file I was looking at was mangled by virtue of going through a Linux server. This meant that it not only had lots of '\r's but the file ended in '\n\r'. A robust way of fixing this was to first replace all '\n\r' with '\r', followed by all '\n' by '\r', followed by replacement of all '\r's by '\r\n'. This guarantees that the file will end in a consistent format in spite of whatever mangling the line ends suffer. ------------------------------------------------------- Andres Corrada-Emmanuel Email: andres@corrada.com Owner http://www.corrada.com/mamey Mamey Phone: (413) 587-9595 ------------------------------------------------------- From tom@sz-sb.de Wed May 26 17:35:39 1999 From: tom@sz-sb.de (Th. Fettig) Date: Wed, 26 May 1999 18:35:39 +0200 Subject: [Pythonmac-SIG] [Pythonmac-SIG] Message-ID: <19990526183539.47408@sz-sb.de> Hello , I made an installer using a somewhat reduced stand-alone python interpreter. As i want to make things a little more tight, i'd like to put everything (pyc-files and the interpreter) in one executable file. Does a packaging method like this exist for the Mac? cu Tom From just@letterror.com Wed May 26 20:59:51 1999 From: just@letterror.com (Just van Rossum) Date: Wed, 26 May 1999 21:59:51 +0200 Subject: [Pythonmac-SIG] [Pythonmac-SIG] In-Reply-To: <19990526183539.47408@sz-sb.de> Message-ID: At 6:35 PM +0200 5/26/99, Th. Fettig wrote: >I made an installer using a somewhat reduced stand-alone python >interpreter. As i want to make things a little more tight, i'd >like to put everything (pyc-files and the interpreter) in one >executable file. Does a packaging method like this exist for the >Mac? Yes, you can put 'PYC ' resources in your application. You'd have to add $(APPLICATION) to your path preferences with EditPythonPrefs. There is some support for creating these PYC resources in 1.5.1, but a whole lot more in the latest beta. In 1.5.1, look for the scripts mkfrozenresources.py and PackLibDir.py, in the latest beta also look for BuildApplication and macfreeze. Just From brian@garage.co.jp Sun May 30 09:14:06 1999 From: brian@garage.co.jp (Brian Hooper) Date: Sun, 30 May 1999 17:14:06 +0900 Subject: [Pythonmac-SIG] CGI on the mac Message-ID: <3750F34E321.31F1BRIAN@smtp.garage.co.jp> hi there - i am a long-time user of python but have only recently started using it on the mac - one thing i would like to do in particular is use CGI scripts. is there anyone else out there doing this? in particular, i have a question about the AEServer example script included in the Mac/Demo/cgi folder of the 1.5.2a1 distribution. i followed the instructions and tried running the script, and though the first time around it returned an error (error -1708), the second and any subsequent times that i run the script, it runs fine. first off there is a NameError for MacOS, since it is not imported in the script, but even if i add "import MacOS", i still get an error on the first invocation of the script (where the AEServer starts up). subsequent invocations of the script work without error. i'm really interested in finding out what this problem is, but also in contributing in any way i can to the improvement of the way that python handles CGI on the mac (in particular, it would be nice to make it look, through the use of an intermediate module, more like the standard cgilib). does anyone have any thoughts on this? thanks, brian hooper