From ita.mis@euro.apple.com Mon Jan 5 13:50:25 1998 From: ita.mis@euro.apple.com (Tasselli Marco) Date: Mon, 05 Jan 1998 14:50:25 +0100 Subject: [PYTHONMAC-SIG] memory usage Message-ID: <34B0E51C.47BB2174@euro.apple.com> Hi everybody, I'm just trying to figure out how Python uses memory when loading dictionaries. I have a master CGI program that drives all other CGI requests. This program loads (at startup time) 3 large dictionaries for later access by many other CGI scripts. This is a sort of 'in-memory' database. Everything works fine and the performance of the system is exceptional (every request require no more than 0.080 seconds!!). This way the need for multithreading is a not so compelling one. The problem, however, is with the scalability of the solution. The 3 files I upload at startup are: -10000 recs (350K) -800 recs (80K) -35000 recs (3500K) This require a huge 23M of RAM occupied after the upload! Obviously you cannot add many new files unless you have a very high amount of free memory. By the way, I tried the same upload using a MacPerl script and I succeded in using only 6M of RAM! Is there a way to keep memory consumption lower? best regards Tasselli Marco _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Mon Jan 5 15:39:00 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 05 Jan 1998 16:39:00 +0100 Subject: [PYTHONMAC-SIG] memory usage In-Reply-To: Message by Tasselli Marco , Mon, 05 Jan 1998 14:50:25 +0100 , <34B0E51C.47BB2174@euro.apple.com> Message-ID: > Hi everybody, > > I'm just trying to figure out how Python uses memory when loading > dictionaries. > [...] > The problem, however, is with the scalability of the solution. > The 3 files I upload at startup are: > -10000 recs (350K) > -800 recs (80K) > -35000 recs (3500K) > > This require a huge 23M of RAM occupied after the upload! The memory allocator in MacPython is of the fast-but-wasteful variety. Blocks of over 16Kb are allocated directly through NewPtr/DisposePtr. For smaller blocks we always allocate the next biggest power of 2 size. For each power of 2 we keep a pool of 16Kb blocks that are used for that size allocations only. These pool blocks are never DisposePtr-ed again and never reused for other sized blocks. This is a design decision that may need to be reconsidered in the light of the huge allocations you mention, but checking all blocks in the pool for being completely empty is rather a lot of work. Let's have a look at your figures. > -10000 recs (350K) So that's 35 byte objects. Add 24 bytes for Python object overhead and 8 for malloc overhead and we're at 64 byte mallocs for a total of 640Kb for the objects. For a list we would add another ~64K for the list object. For a dictionary object, assuming you invent keys on the fly and they're not included in the 350K you'll have another 160Kb key objects and the dict object would be about 100K. All in all this'll fit easily in 1Mb. > -800 recs (80K) Nothing to worry about, 200Kb at very most. > -35000 recs (3500K) Hmm, let's assume worst case: 256 bytes per object giving 9Mb for the objects, 500Kb for the keys and 350Kb for the dict object. 10Mb total. All in all we end up with less that 12Mb, about half of your 23Mb. However, I'm assuming that your 100-byte objects of the last dict are 100-byte strings. If they're, say, 25 4-byte integers in a tuple then the per-object malloced size goes to 25*32bytes (for the ints) + 256 bytes (for the tuple) giving about 1Kb for each object, giving 35Mb for all the objects.... Solutions? Hmm. See if you can use a gdbm database for the 35000 record dictionary is the first one that comes to mind. Check your datastructure (for the 9Mb/35Mb problem sketched above) is the second. If you're storing large amounts of integers the "array" module may help, it stores c-style arrays (so an integer takes only 4 bytes). The datastructures of NumPy also store large quantities of numbers in space comparable to what C would use. And I'll put checking out whether I can make malloc() return freespace to the real freelist on my list of things to do at some point. However, you said nothing about the objects here being freed again, so I doubt whether this would help you anything. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Mon Jan 5 16:21:55 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 05 Jan 1998 17:21:55 +0100 Subject: [PYTHONMAC-SIG] MacPython 1.5 beta 3 available Message-ID: Finally a new distribution of Python for the Macintosh is available. It is, however, still a beta distribution. The reason for distributing a third beta release for the Mac (unlike for other platforms) is that there are still some problems. The main problem is that packages ("dotted import") seem to have problems when used under cfm68k. Other outstanding problems are tkinter problems with menus (all platforms) and NumPy printing problems (cfm68k). Please report your findings with this distribution to pythonmac-sig@python.org, so we can try to iron out the problems and have a normal 1.5 distribution in a few weeks time. The distribution is available via or . -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From managan@llnl.gov Mon Jan 5 21:02:28 1998 From: managan@llnl.gov (Rob Managan) Date: Mon, 5 Jan 1998 13:02:28 -0800 Subject: [PYTHONMAC-SIG] MacPython 1.5 beta 3 available In-Reply-To: Message-ID: At 5:21 PM +0100 1/5/98, Jack Jansen wrote: >Finally a new distribution of Python for the Macintosh is >available. > >The distribution is available via > or >. >-- Jack, For those of us wanting to port modules based on NumPy and other stuff is a source distribution available or at least an updated version of the archive Python-1.5a3-Develop.sit ? Thanks! *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan mailto://managan@llnl.gov LLNL ph: 510-423-0903 P.O. Box 808, L-183 FAX: 510-423-5804 Livermore, CA 94551-0808 _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Tue Jan 6 12:40:14 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Tue, 06 Jan 1998 13:40:14 +0100 Subject: [PYTHONMAC-SIG] MacPython 1.5 beta 3 available In-Reply-To: Message by Rob Managan , Mon, 5 Jan 1998 13:02:28 -0800 , Message-ID: > Jack, For those of us wanting to port modules based on NumPy and other > stuff is a source distribution available or at least an updated version of > the archive Python-1.5a3-Develop.sit ? Your wish is my command. You'll now find developer and source releases too, in http://www.cwi.nl/~jack/macpython.html and ftp://ftp.cwi.nl/pub/jack/python/mac . -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From just@knoware.nl Tue Jan 6 16:30:58 1998 From: just@knoware.nl (Just van Rossum) Date: Tue, 6 Jan 1998 17:30:58 +0100 Subject: [PYTHONMAC-SIG] MacPythonIDE for 1.5b3 available In-Reply-To: Message-ID: Now that there's a new release of MacPython, it's time for a 1.5b3 compatible Development Environment, too. Download it directly from or indirectly from , where you'll also find links to the 1.4 compatible versions, which are updated as well. As always, feedback is welcome. Just _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From wtbridgman@radix.net Wed Jan 7 02:21:24 1998 From: wtbridgman@radix.net (W.T. Bridgman) Date: Tue, 6 Jan 1998 21:21:24 -0500 Subject: [PYTHONMAC-SIG] MacPython v1.5b3 / NumPy bugs? Message-ID: I've installed MacPython v1.5b3 pretty much successfully. Two items: 1) System paths were not fully set after the install. The img library was there but I had to add NumPy, NumPy:NumPy and Imaging:Lib (is that all of them?). Shouldn't these be set in a normal install? Come to think of it, I did a custom install of the PPC versions of each package. 2) I reported this next problem in the NumPy that came with v1.5a4 and it seems to still be there. However, I suspect this is a NumPy specific problem. By just importing the RandomArray module, I get: >>>>> import RandomArray >>Traceback (innermost last): >> File "", line 1, in ? >> File "Macintosh HD:Development:Python v1.5:Python >>1.5b3:Extensions:NumPy:NumPy:RandomArray.py", line 12, in ? >> seed() >> File "Macintosh HD:Development:Python v1.5:Python >>1.5b3:Extensions:NumPy:NumPy:RandomArray.py", line 8, in seed >> x = int(t) >>OverflowError: float too large to convert >>>>> Rob Managan reported this fix but my first concern is if this is legit and doesn't introduce any problems or correlations in the generator: >def seed(x=0,y=0): > if x == y == 0: > import time > t = time.time() > x = long(t) > y = long((t-long(t))*1000000) > ranlib.set_seeds(x,y) > Now this fix generates errors at ranlib.set_seeds with: OverflowError: long int too long to convert. Does this bug and fix need to be propagated to the Matrix SIG for repair? Thanks, Tom Tom Bridgman, Ph.D. wtbridgman@radix.net Physics & Astronomy _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From hinsen@ibs.ibs.fr Wed Jan 7 17:36:29 1998 From: hinsen@ibs.ibs.fr (Konrad Hinsen) Date: Wed, 7 Jan 1998 18:36:29 +0100 Subject: [MATRIX-SIG] Re: [PYTHONMAC-SIG] MacPython v1.5b3 / NumPy bugs? In-Reply-To: (message from Jack Jansen on Wed, 07 Jan 1998 13:09:52 +0100) Message-ID: <199801071736.SAA12948@lmspc1.ibs.fr> > Yes, I noticed that. All the other fixes I tried (clamping the x value to 31 > bits, or by trickery converting the longint to the 32bit signed representation > that corresponds to the unsigned value) have resulted in strange crashes > inside ranlib.set_seeds(). It turns out that the library that underlies the > ranlib module handles errors by calling printf() and then exit(); not very > nice on the Mac because you never get to see the output:-( Not nice on Unix either, although you usually do see the error... Here's an example: ranlib.set_seeds(0, -2) a, m, s out of order in mltmod - ABORT! a = 2082007225 s = 0 m = 2147483563 mltmod requires: 0 < a < m; 0 < s < m But other than by using negative seeds I can't get such an error. > Apparently the numbers you give to ranlib.set_seeds() have to satisfy certain > criteria, what are these criteria, matrix-folks? If I know these I can come up > with two randomish numbers that match them for the mac... Almost anything works for me as long as the seeds are positive. The Python wrapper just passes two long arguments to the function setall, defined in NumPyLib/com.c: void setall(long iseed1,long iseed2) /* ********************************************************************** void setall(long iseed1,long iseed2) SET ALL random number generators Sets the initial seed of generator 1 to ISEED1 and ISEED2. The initial seeds of the other generators are set accordingly, and all generators states are set to these seeds. This is a transcription from Pascal to Fortran of routine Set_Initial_Seed from the paper L'Ecuyer, P. and Cote, S. "Implementing a Random Number Package with Splitting Facilities." ACM Transactions on Mathematical Software, 17:98-111 (1991) Arguments iseed1 -> First of two integer seeds iseed2 -> Second of two integer seeds ********************************************************************** */ ... But just an idea: are you sure the f2c generated code works on the Mac at all? It makes assumptions about the relative sizes of various data types, which might not be true on the Mac. In that case you might be overwriting essential data in common blocks. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28 Institut de Biologie Structurale | Fax: +33-4.76.88.54.94 41, av. des Martyrs | Deutsch/Esperanto/English/ 38027 Grenoble Cedex 1, France | Nederlands/Francais ------------------------------------------------------------------------------- _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From lennan@beachnet.com Wed Jan 7 19:22:00 1998 From: lennan@beachnet.com (Timothy Lennan) Date: Wed, 7 Jan 98 11:22:00 -0800 Subject: [PYTHONMAC-SIG] Can Mac Python be embedded? Message-ID: <19980107181105869.AAA150@pipe1-24.beachnet.com> Has anyone tried embedding Python in a Mac app? _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From doug@sonosphere.com Wed Jan 7 20:15:21 1998 From: doug@sonosphere.com (Doug Wyatt) Date: Wed, 7 Jan 1998 15:15:21 -0500 Subject: [PYTHONMAC-SIG] Can Mac Python be embedded? In-Reply-To: <19980107181105869.AAA150@pipe1-24.beachnet.com> Message-ID: At 11:22 -0800 1/7/98, Timothy Lennan wrote: > Has anyone tried embedding Python in a Mac app? Yes. It was just an experiment but it worked... :) Doug _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Wed Jan 7 21:07:36 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Wed, 07 Jan 1998 22:07:36 +0100 Subject: [PYTHONMAC-SIG] Can Mac Python be embedded? In-Reply-To: Message by "Timothy Lennan" , Wed, 7 Jan 98 11:22:00 -0800 , <19980107181105869.AAA150@pipe1-24.beachnet.com> Message-ID: Recently, "Timothy Lennan" said: > Has anyone tried embedding Python in a Mac app? You're the second to ask this in a few days... I noticed that the Mac:Demo:embed folder was pretty outdated, so I updated it. Until the 1.5 final release it can be found at ftp://ftp.cwi.nl/pub/jack/python/mac/embed.hqx . For embedding you need a source or developers distribution, by the way. And, using a developers distribution to do embedding has never been test (at least not by me), so I'd be interested in hearing whether it is actually possible:-) -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From evb@knoware.nl Thu Jan 8 07:36:25 1998 From: evb@knoware.nl (Erik van Blokland) Date: Thu, 8 Jan 98 09:36:25 +0200 Subject: [PYTHONMAC-SIG] Can Mac Python be embedded? Message-ID: <199801080833.JAA25889@kalvermarkt.denhaag.dataweb.net> >Has anyone tried embedding Python in a Mac app? have a look at: http://www.petr.nl/robofog erik LettError: www.letterror.com _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From hinsen@ibs.ibs.fr Thu Jan 8 11:26:41 1998 From: hinsen@ibs.ibs.fr (Konrad Hinsen) Date: Thu, 8 Jan 1998 12:26:41 +0100 Subject: [MATRIX-SIG] Re: [PYTHONMAC-SIG] MacPython v1.5b3 / NumPy bugs? In-Reply-To: (message from Jack Jansen on Wed, 07 Jan 1998 21:46:03 +0100) Message-ID: <199801081126.MAA16696@lmspc1.ibs.fr> > ">*WHAT?!*<", he says, grabbing the table and trying to steady his > breath... Since the C code, not the fortran code, is distributed it > might be a good idea to put some asserts somewhere that these > assumptions hold... Indeed. f2c-generated code isn't fully portable. It requires that the C types used to represent Fortran types fulfill the Fortran conditions, because otherwise common blocks and equivalent statements cannot be translated correctly. > But, luckily, the f2c code seems to work on the mac. For all three > architectures (PPC, classic 68k, cfm68k) I use > sizeof(int)==sizeof(long)==4 and sizeof(double)==8. This seems what That should work, since the same sizes are used on my Linux system! > Unless f2c (or something else) also expects IEEE floating point? No, there are no assumptions other than those about data sizes. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28 Institut de Biologie Structurale | Fax: +33-4.76.88.54.94 41, av. des Martyrs | Deutsch/Esperanto/English/ 38027 Grenoble Cedex 1, France | Nederlands/Francais ------------------------------------------------------------------------------- _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From just@knoware.nl Thu Jan 8 11:32:08 1998 From: just@knoware.nl (Just van Rossum) Date: Thu, 8 Jan 1998 12:32:08 +0100 Subject: [PYTHONMAC-SIG] Can Mac Python be embedded? In-Reply-To: <199801080833.JAA25889@kalvermarkt.denhaag.dataweb.net> Message-ID: >>Has anyone tried embedding Python in a Mac app? > >have a look at: >http://www.petr.nl/robofog We currently do this by compiling Python as a single static lib. The original app is quite old and big and complex; still, embedding Python wasn't that hard. I think the main problem we had was that the original app depended on ints being two bytes, where we preferred to stick to MacPython's 4 byte ints. Oh, and then there was porting the app from Think to CodeWarrior... I did some testing with embedding the standard PythonCore shared lib, and this works as well. I hope to switch to this approach sooner or later. I would think that this should be possible using the developers release, but I haven't actually tried this. (Jack: that's what you call the one containing only the include files, right?) Just _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From managan@llnl.gov Fri Jan 9 21:15:55 1998 From: managan@llnl.gov (Rob Managan) Date: Fri, 9 Jan 1998 13:15:55 -0800 Subject: [PYTHONMAC-SIG] MacPython v1.5b3 / NumPy bugs? In-Reply-To: References: Message by wtbridgman@radix.net (W.T. Bridgman) , Tue, 6 Jan 1998 21:21:24 -0500 , Message-ID: Tom Bridgman reported that RandomArray.py broke under 1.5 >> >> 2) I reported this next problem in the NumPy that came with v1.5a4 and it >> seems to still be there. However, I suspect this is a NumPy specific >> problem. By just importing the RandomArray module, I get: >> >> >>>>> import RandomArray >> >>Traceback (innermost last): >> >> File "", line 1, in ? >> >> File "Macintosh HD:Development:Python v1.5:Python >> >>1.5b3:Extensions:NumPy:NumPy:RandomArray.py", line 12, in ? >> >> seed() >> >> File "Macintosh HD:Development:Python v1.5:Python >> >>1.5b3:Extensions:NumPy:NumPy:RandomArray.py", line 8, in seed >> >> x = int(t) >> >>OverflowError: float too large to convert >> >>>>> > >This is because MacPython time.time() can return a float that is bigger than >can be represented in a signed int (but it could have been represented in a >32bit unsigned int, had Python had such a type). > >> Jack Jensen commented on this and my earlier fix: > >Yes, I noticed that. All the other fixes I tried (clamping the x value to 31 >bits, or by trickery converting the longint to the 32bit signed >representation >that corresponds to the unsigned value) have resulted in strange crashes >inside ranlib.set_seeds(). It turns out that the library that underlies the >ranlib module handles errors by calling printf() and then exit(); not very >nice on the Mac because you never get to see the output:-( > >Apparently the numbers you give to ranlib.set_seeds() have to satisfy certain >criteria, what are these criteria, matrix-folks? If I know these I can >come up >with two randomish numbers that match them for the mac... >-- Having played with the URNG module some I relooked at this. My latest attempt to fix this came up with this for the file RandomArray.py def seed(x=0,y=0): if x == y == 0: import time t = time.time() import os if os.name == 'mac': t = t*1.e-3 x = int(t) y = int((t-int(t))*1000000) ranlib.set_seeds(x,y) seed() The reason for singling out the macos is that most systems give you a time that changes on roughly microsecond intervals so that there is a fractional part to the time. MacPython is set to return integer seconds since 1904. So there is no fractional part and y is always 0 under the old code. Therefore I decided to take the time returned and divide by 1 thousand to provide a fractional part. This also makes sure that t can be cast to an int (it is at most a factor of 2 too large!). This should give reasonable values for x and y. However, this is not adequate for modules with independant random number generators (URNG, RNG) since the seed only changes once a second. See Below. Busby claims that you arn't likely to get a 'bad' seed. Fred Fritsch made this point about my work on URNG: I would be more concerned by the coarseness of the clock--if two calls are made within the same second they will get the same seed, defeating the desire for independent streams. (Not a problem for jobs restarted at a later time, however.) Lee Busby then added: I think Fred's comment about coarseness of the clock is the only possible worry. You could handle that by arranging not to call mixranf more than once per second, I suppose. Or maybe there is some other system call whose return value is somehow dependent on the "instantaneous" state of the machine? Be creative. There aren't any good or bad seeds. Each one is just an entry point onto the specific permutation of length 2**46 defined by a given multiplier. (There *are* many bad multipliers; in fact, practically all of them, but that's a different question.) *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan mailto://managan@llnl.gov LLNL ph: 510-423-0903 P.O. Box 808, L-183 FAX: 510-423-5804 Livermore, CA 94551-0808 _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From sdm7g@Virginia.EDU Thu Jan 22 17:28:41 1998 From: sdm7g@Virginia.EDU (Steven D. Majewski) Date: Thu, 22 Jan 1998 12:28:41 -0500 (EST) Subject: [PYTHONMAC-SIG] EOF ( ^D or ^Z ) on sys.stdin.read() Message-ID: Using Mac Python 1.5b3, A control-D or control-Z while reading from sys.stdin seems to exit Python. I tried wrapping it in a try/except and Editing the options to try to keep the window open, but it still quits immediately. Is this a SOUIX bug/feature ? How can you signal the end of text without exiting the interpreter? BTW: I just ran into the problem -- I'm amazed that I didn't run into it sooner -- that under OS8's ( and 8.1 ) you can't drag more than one item from FindFile into the trash! As you can drag the multiple selection into a text editor app, I was about to see if this would work with Python, however dragging it to Aplha, I see it does not include the full pathname with the filename, so that is a pretty useless way around the problem. Also it doesn't look that Python will accept the drop, so I suppose this is not a generic function of a text app, but must require Drag & Drop support. So the answer to the above is not going to help with the problem I was trying to fix anyway! ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- All power corrupts and obsolete power corrupts obsoletely." - Ted Nelson _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Fri Jan 23 10:05:34 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Fri, 23 Jan 1998 11:05:34 +0100 Subject: [PYTHONMAC-SIG] EOF ( ^D or ^Z ) on sys.stdin.read() In-Reply-To: Message by "Steven D. Majewski" , Thu, 22 Jan 1998 12:28:41 -0500 (EST) , Message-ID: > > Using Mac Python 1.5b3, A control-D or control-Z while reading > from sys.stdin seems to exit Python. I tried wrapping it in a > try/except and Editing the options to try to keep the window > open, but it still quits immediately. > > Is this a SOUIX bug/feature ? This behaviour is caused by Sioux, indeed. I could probably fix it, if people think it's important... -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Fri Jan 23 10:40:48 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Fri, 23 Jan 1998 11:40:48 +0100 Subject: [PYTHONMAC-SIG] EOF ( ^D or ^Z ) on sys.stdin.read() In-Reply-To: Message by Jack Jansen , Fri, 23 Jan 1998 11:05:34 +0100 , Message-ID: > This behaviour is caused by Sioux, indeed. I could probably fix it, if people > think it's important... Hmm, I just looked at it in an idle 5 minutes, and it is rather difficult to fix: the sioux console driver sets a hard eof flag on a low level. So I hereby retract the offer to fix it (unless people can point me to the right page in the C standard where it says that this behaviour is illegal, so I can send a bugreport to MW: I have this feeling that clearerr() should clear eof conditions too, but I haven't got a standard handy). -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From ita.mis@euro.apple.com Fri Jan 23 17:44:11 1998 From: ita.mis@euro.apple.com (Tasselli Marco) Date: Fri, 23 Jan 1998 18:44:11 +0100 Subject: [PYTHONMAC-SIG] malloc error Message-ID: <34C8D6EB.672400E1@euro.apple.com> hi everybody, I'm continuing my exaustive use of Python and its gdbm capabilities. I have many procedures tha access gdbm files now and it started giving the following error: "gdbm fatal: malloc error" The fact is that I could not track down this error which seems completely random and seems, apparently, correlated with the way gdbm is implemented. I'm using a version 1.4 of MacPython. DO you have any idea about this? Any suggestion for working it around? Tasselli Marco _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From sdm7g@Virginia.EDU Sat Jan 24 01:16:12 1998 From: sdm7g@Virginia.EDU (Steven D. Majewski) Date: 23 Jan 98 20:16:12 -0500 Subject: [PYTHONMAC-SIG] FWD: Find File bugs and a Trash Icon emulation in Python. (send to comp.sys.mac... ) Message-ID: I only recently ran into the Find File bug in MacOS-8 (unfixed in 8.1) where you cannot drag multiple files onto the desktop or into the trash. ( I'm quite amazed that Apple could leave such a glaring User Interface but unfixed, but that's another matter! ) After I found this note at MacFixit about the 8.1 update: | Dragging | | Rich Bottiglieri writes: "The bug with dragging multiple files to the trash | from the Find File window has not been fixed with Mac OS 8.1. You still have | to drag them one by one, or create an alias of the trash and drag them there. | On the plus side, however, the annoying bug with dragging and dropping text | clippings into some applications (notably SimpleText) appears to have been | fixed." But before I found the original account (which gives a bit more explaination): |Find File glitch Robb Albright writes that Find File in Mac OS 8 "cannot |operate on multiple items in Find File's Results window. Specifically, |apparently due to changes in Finder's AppleScript/Apple Events, if you |perform a find, select more than one item in the results window, and try to |do something with it (i.e., drag to trash, drag to Desktop, etc.), the items |will bounce back to the Results window. These operations work fine on a |single item." Richard Hardy and others also reported this I tried or considered several workarounds: Strangely, dragging the items into a text editor does work. I had considered writing a program or script to take that list of files and trash them, however, the filename, size, type and date modified can all be pasted into an Text Editor (I tested Alpha), but that doesn't include the full pathname -- without that the rest of the info is pretty useless. The fact that this feature, however useless, works, while the usual drag operation doesn't had me thinking that perhaps this bug was a feature of some new changes to Drag & Drop support. I started reading thru the docs and Tech Notes (TN-1043 & TN-1085) to see if there was a mention of this problem. [ I tried a couple of searches at the apple web site for "Find File" and/or "drag", and this was the best I could find. I found no direct mention of the bug on Apple's site. ] However, after I got bored with reading Tech Notes, I though I'ld try something simple. A Mac Python applet ( and ) will turn files or folders dropped onto it into pathnames in the sys.argv list. I tried the following little test script, dropping it onto BuildApplet to turn it into a "droplet": from os import unlink def main( args ): n = 0 for filename in args: n = n + 1 print '[%3d]' % n, filename # for now, just print count and name # unlink( filename ) # to delete files use os.unlink import sys if __name__ == '__main__' : main( sys.argv ) This worked when I dragged one or several files from Find File onto the droplet, however it crashed when I dragged 400+. I thought at first that it might be due to the maximum number of args in Python (255), and was about to try rebuilding it with a heftier 1024 limit, but testing it in more detail, I found it worked for 50+ or 80+ files, but it crashed (or on two occasions, it did nothing and passed no args to Python) for the values I tried between 100 and 255. The Crash was always from a BUS ERROR in Find File. Anyone know what's going on with Find File ? -- Steve Majewski _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From sdm7g@Virginia.EDU Sat Jan 24 01:40:44 1998 From: sdm7g@Virginia.EDU (Steven D. Majewski) Date: Fri, 23 Jan 1998 20:40:44 -0500 (EST) Subject: [PYTHONMAC-SIG] FWD: Find File bugs and a Trash Icon emulation in Python. (send to comp.sys.mac... ) In-Reply-To: Message-ID: Obviously, if you want to uncomment the unlink and use that script to delete anything, you need to do it over sys.argv[1:], not sys.argv. That was intentional for testing, so I could see if ANYTHING was happening, but when I forgot to remove it, I got a 'file busy' error when the program tries to delete itself! :-> ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- All power corrupts and obsolete power corrupts obsoletely." - Ted Nelson _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Sun Jan 25 22:26:33 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Sun, 25 Jan 1998 23:26:33 +0100 Subject: [PYTHONMAC-SIG] malloc error In-Reply-To: Message by Tasselli Marco , Fri, 23 Jan 1998 18:44:11 +0100 , <34C8D6EB.672400E1@euro.apple.com> Message-ID: Recently, Tasselli Marco said: > I'm continuing my exaustive use of Python and its gdbm capabilities. > I have many procedures tha access gdbm files now and it started giving > the following error: > "gdbm fatal: malloc error" This sounds like a simple out-of-memory error. Check the "about this mac" window to see whether the Python partition is indeed completely filled up (or almost filled up: the window isn't always completely up-to-date) when the error occurs. If so: give Python more space with the "info" dialog in the finder. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From turtle@dallas.net Mon Jan 26 20:56:58 1998 From: turtle@dallas.net (Greg Pierce) Date: Mon, 26 Jan 1998 14:56:58 -0600 Subject: [PYTHONMAC-SIG] python and Frontier Message-ID: has anyone worked on interoperation between Mac Python and Frontier. I'm just learning Python, but am experience with Frontier, and would love to be able to use it's outliner for Python script writing....it's a natural match for the language's use of indentation, etc. i have, however, had little luck deciphering Apple-Events in Python and need some direction on how to establish a link....i'd love to be able to send script with parameters from Frontier to Python and receive results. any ideas? links? tutorials? Greg Pierce work: turtle@dallas.net, home: gregp@dallas.net Home: http://www.dallas.net/~gregp/ UNo MAS Magazine: http://www.unomas.com/ ----------A L W A Y S B E G R O O V Y---------- _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From jeff@digicool.com Mon Jan 26 22:03:30 1998 From: jeff@digicool.com (Jeffrey P Shell) Date: Mon, 26 Jan 1998 17:03:30 -0500 Subject: [PYTHONMAC-SIG] OSA status? (was: python and Frontier) Message-ID: <199801262335.SAA18568@albert.digicool.com> >has anyone worked on interoperation between Mac Python and Frontier. I'm >just learning Python, but am experience with Frontier, and would love to be >able to use it's outliner for Python script writing....it's a natural match >for the language's use of indentation, etc. > >i have, however, had little luck deciphering Apple-Events in Python and >need some direction on how to establish a link....i'd love to be able to >send script with parameters from Frontier to Python and receive results. > >any ideas? links? tutorials? What's the OSA status of MacPython anyways? I played a _tiny_ bit with the 1.4 stuff, but the osasuite thing generated a lot of commented out code and there was something about it being rather unfinished. . ? -- "Green Tony squeeled and I'm off to Galaxy X" .jPS jeff@Digicool.com Digital Creations http://www.digicool.com/ _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From managan@llnl.gov Tue Jan 27 00:45:27 1998 From: managan@llnl.gov (Rob Managan) Date: Mon, 26 Jan 1998 16:45:27 -0800 Subject: [PYTHONMAC-SIG] python and Frontier In-Reply-To: Message-ID: Greg Pierce wrote: >has anyone worked on interoperation between Mac Python and Frontier. I'm >just learning Python, but am experience with Frontier, and would love to be >able to use it's outliner for Python script writing....it's a natural match >for the language's use of indentation, etc. > >i have, however, had little luck deciphering Apple-Events in Python and >need some direction on how to establish a link....i'd love to be able to >send script with parameters from Frontier to Python and receive results. > >any ideas? links? tutorials? > You might look at Mac:Demo:applescript.html in the source distribution. It describes how to work with AppleEvents to some extent. *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan mailto://managan@llnl.gov LLNL ph: 510-423-0903 P.O. Box 808, L-183 FAX: 510-423-5804 Livermore, CA 94551-0808 _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Tue Jan 27 14:04:05 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Tue, 27 Jan 1998 15:04:05 +0100 Subject: [PYTHONMAC-SIG] OSA status? (was: python and Frontier) In-Reply-To: Message by "Jeffrey P Shell" , Mon, 26 Jan 1998 17:03:30 -0500 , <199801262335.SAA18568@albert.digicool.com> Message-ID: > What's the OSA status of MacPython anyways? I played a _tiny_ bit with the > 1.4 stuff, but the osasuite thing generated a lot of commented out code and > there was something about it being rather unfinished. . ? There's a lot more in 1.5: OSA classes and such are supported in a way. Also, Bill Bedford is rather active on this front, so expect more functionality in a reasonable timeframe. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From sdm7g@Virginia.EDU Wed Jan 28 15:52:50 1998 From: sdm7g@Virginia.EDU (Steven D. Majewski) Date: Wed, 28 Jan 1998 10:52:50 -0500 (EST) Subject: [PYTHONMAC-SIG] FWD: Find File bugs and a Trash Icon emulation in Python. (send to comp.sys.mac... ) In-Reply-To: Message-ID: FYI: There is a simpler fix for the Find File bug : create an alias of the Trash and drag the selected files into the alias. However, I would still like to know why Find File crashes when dragging a large number ( N > 100+ ) of files onto a Python Applet. ( And even though MacsBug says it's in Find File after the crash, I'm not confident that Python isn't to blame, since this is the only way I've seen it crash like that. ) ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- All power corrupts and obsolete power corrupts obsoletely." - Ted Nelson _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________