From smithsm at samuelsmith.org Sun Feb 1 13:57:40 2004 From: smithsm at samuelsmith.org (Samuel M. Smith) Date: Sun Feb 1 13:58:09 2004 Subject: [Pythonmac-SIG] Non blocking terminal input In-Reply-To: References: <4C4BB602-541F-11D8-BF32-000393DB52E4@2xtreme.net> Message-ID: <82AB2C9C-54E8-11D8-B033-000A95C4B360@samuelsmith.org> Is there an equivalent on mac/unix to the msvcrt module for windows kbhit() function? Or in other words is there some way to do non blocking reads of the terminal as opposed to blocking reads vis a vis raw_input()? In other can I non blocking poll the terminal input to see if something is there before I read it. It looks like I might be able to do it with curses.getch() with nodelay(True) Can I treat the terminal stdin as a file and use ftell to see if more characters have been added since the last check of ftell? I am playing around with generator based weightless threads and wanted to see if I could do interactive I/O with the terminal while running other tasks. I know I could do it with threads Sam, From bob at redivi.com Sun Feb 1 14:28:50 2004 From: bob at redivi.com (Bob Ippolito) Date: Sun Feb 1 14:26:02 2004 Subject: [Pythonmac-SIG] Non blocking terminal input In-Reply-To: <82AB2C9C-54E8-11D8-B033-000A95C4B360@samuelsmith.org> References: <4C4BB602-541F-11D8-BF32-000393DB52E4@2xtreme.net> <82AB2C9C-54E8-11D8-B033-000A95C4B360@samuelsmith.org> Message-ID: On Feb 1, 2004, at 1:57 PM, Samuel M. Smith wrote: > Is there an equivalent on mac/unix to the msvcrt module for windows > kbhit() function? > Or in other words is there some way to do non blocking reads of the > terminal as opposed to blocking reads vis a vis raw_input()? > In other can I non blocking poll the terminal input to see if > something is there before I read it. > > It looks like I might be able to do it with curses.getch() with > nodelay(True) > > Can I treat the terminal stdin as a file and use ftell to see if more > characters have been added since > the last check of ftell? > > I am playing around with generator based weightless threads and wanted > to see if I could do interactive I/O with the terminal while running > other tasks. > > I know I could do it with threads The reason stdin acts as a line based input is because there are certain flags set on it... serial ports are the same way. I remember delving into this a while ago, and I *think* the constants/functions you need to use are in the termios module. After you've set the right flags, you can even use select() on stdin and it'll let you know when a key has been pressed. -bob (this is pretty standard *nix stuff..) From drewmccormack at mac.com Mon Feb 2 04:34:47 2004 From: drewmccormack at mac.com (Drew McCormack) Date: Mon Feb 2 04:36:40 2004 Subject: [Pythonmac-SIG] Using Xcode for python dev Message-ID: <0A7AC13A-5563-11D8-BDA5-003065BD3BD8@mac.com> Is anyone out there using Xcode for python dev? How are you doing it? I am using it to edit files, which works quite nicely, but I am wondering what the best way to run the python code is. At the moment I either use the terminal command line, or a target in Xcode which includes a single 'Shell Script' build phase. Is there a better way? What about debugging? Is there any chance of using Xcode's debugger with python, or doesn't apple supply the hooks for that functionality? Drew ======================================== Dr. Drew McCormack (Kmr. R153) Afd. Theoretische Chemie Faculteit Exacte Wetenschappen Vrije Universiteit Amsterdam De Boelelaan 1083 1081 HV Amsterdam The Netherlands Email cormack@chem.vu.nl Telephone +31 20 44 47623 Mobile +31 6 483 21307 Fax +31 20 44 47629 From mwh at python.net Mon Feb 2 07:40:10 2004 From: mwh at python.net (Michael Hudson) Date: Mon Feb 2 07:40:13 2004 Subject: [Pythonmac-SIG] advanced newbie questions In-Reply-To: <1682EF88-517D-11D8-96AC-0050E4794D0F@uma.pt> (Michael J. Barber's message of "Wed, 28 Jan 2004 10:31:09 +0000") References: <1682EF88-517D-11D8-96AC-0050E4794D0F@uma.pt> Message-ID: <2mfzdtirit.fsf@starship.python.net> "Michael J. Barber" writes: > Not actually an outliner, but jEdit has decent line folding. I used it > for Python programming for a while, and the folding was quite nice. As > I understand it, both vim and emacs do folding as well, but I've > little or no experience using folding with either of them. Emacs certainly supports this, but I never in practice use it (the fact that I can never seem to remember the key binding for un-narrowing may be connected to this). Cheers, mwh -- The gripping hand is really that there are morons everywhere, it's just that the Americon morons are funnier than average. -- Pim van Riezen, alt.sysadmin.recovery From rowen at cesmail.net Mon Feb 2 13:12:04 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Mon Feb 2 13:12:10 2004 Subject: [Pythonmac-SIG] Re: can't delete Tkinter apps built with bundlebuilder References: Message-ID: In article , "Russell E. Owen" wrote: > I finally go bundlebuilder working (thanks for all the help). Sigh. > Quite a struggle. I plan to post some docs on what I learned when I get > some time. Unfortunately, I'm still in the learning stage... > > The Tkinter apps I produce, once executed, cannot be deleted until the > Mac is rebooted (simply logging out and logging back in again does NOT > suffice). The Finder's error message is: > > The operation cannot be completed because the item "Python" is in use. I tried a semi_standalone version and that worked around the problem. Since standalones don't work on Jaguar anyway, it will do for now. I have reported this as a bug in bundlebuilder: -- Russell From bob at redivi.com Mon Feb 2 13:53:42 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 2 13:50:56 2004 Subject: [Pythonmac-SIG] Re: can't delete Tkinter apps built with bundlebuilder In-Reply-To: References: Message-ID: <1F56FFC2-55B1-11D8-895C-000A95686CD8@redivi.com> On Feb 2, 2004, at 1:12 PM, Russell E. Owen wrote: > In article , > "Russell E. Owen" wrote: > >> I finally go bundlebuilder working (thanks for all the help). Sigh. >> Quite a struggle. I plan to post some docs on what I learned when I >> get >> some time. Unfortunately, I'm still in the learning stage... >> >> The Tkinter apps I produce, once executed, cannot be deleted until the >> Mac is rebooted (simply logging out and logging back in again does NOT >> suffice). The Finder's error message is: >> >> The operation cannot be completed because the item "Python" is in use. > > I tried a semi_standalone version and that worked around the problem. > Since standalones don't work on Jaguar anyway, it will do for now. I > have reported this as a bug in bundlebuilder: > func=detail&aid=889200&group_id > =5470&atid=105470> --standalone of a compiled-for-Panther Python will never work on a Jaguar because that version of Python itself is not compatible with Jaguar. On top of that, the way things are linked (and especially where they install and look for extensions) makes it pretty easy to cause version mismatch problems if you have both versions on your computer because they are effectively not binary compatible, even though they would otherwise be, due to the baked-in dyld path. I wouldn't hold my breath, it's not something that can be changed because OS X 10.3 is probably stuck at Python 2.3.0 as-compiled anyhow, and OS X 10.2 does not support -undefined dynamic_lookup anyways. If https://sourceforge.net/tracker/? func=detail&atid=105470&aid=887242&group_id=5470 is adopted, then this problem may eventually go away, but not for Jaguar. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040202/5568ea31/smime.bin From owen at astro.washington.edu Mon Feb 2 14:37:18 2004 From: owen at astro.washington.edu (Russell E Owen) Date: Mon Feb 2 14:37:25 2004 Subject: [Pythonmac-SIG] Re: can't delete Tkinter apps built with bundlebuilder In-Reply-To: <1F56FFC2-55B1-11D8-895C-000A95686CD8@redivi.com> References: <1F56FFC2-55B1-11D8-895C-000A95686CD8@redivi.com> Message-ID: At 1:53 PM -0500 2004-02-02, Bob Ippolito wrote: >On Feb 2, 2004, at 1:12 PM, Russell E. Owen wrote: > >>In article , >> "Russell E. Owen" wrote: >> >>> I finally go bundlebuilder working (thanks for all the help). Sigh. >>>Quite a struggle. I plan to post some docs on what I learned when I get >>>some time. Unfortunately, I'm still in the learning stage... >>> >>>The Tkinter apps I produce, once executed, cannot be deleted until the >>>Mac is rebooted (simply logging out and logging back in again does NOT >>>suffice). The Finder's error message is: >>> >>>The operation cannot be completed because the item "Python" is in use. >> >>I tried a semi_standalone version and that worked around the problem. >>Since standalones don't work on Jaguar anyway, it will do for now. I >>have reported this as a bug in bundlebuilder: >>>=5470&atid=105470> > >--standalone of a compiled-for-Panther Python will never work on a >Jaguar because that version of Python itself is not compatible with >Jaguar. On top of that, the way things are linked (and especially >where they install and look for extensions) makes it pretty easy to >cause version mismatch problems if you have both versions on your >computer because they are effectively not binary compatible, even >though they would otherwise be, due to the baked-in dyld path. I >wouldn't hold my breath, it's not something that can be changed >because OS X 10.3 is probably stuck at Python 2.3.0 as-compiled >anyhow, and OS X 10.2 does not support -undefined dynamic_lookup >anyways. > >If >https://sourceforge.net/tracker/?func=detail&atid=105470&aid=887242&group_id=5470 >is adopted, then this problem may eventually go away, but not for >Jaguar. > Just to be sure we're all on the same page here...the bug I reported was that my fully standalone app built on MacOS X 10.3 (I probably forgot to include the version # in the bug report, alas) cannot be emptied from the trash if it has ever been run. That bug has nothing to do with Jaguar. The only connection is at all is that one reason I wanted a fully standalone app is the vain hope it might run on Jaguar. Having said that....do you know if this issue of a fully standalone app built on one major version of MacOS X not working on another major release will continue to be an issue? Or is Jaguar a special case? -- Russell From eichin at metacarta.com Mon Feb 2 14:58:27 2004 From: eichin at metacarta.com (Mark Eichin) Date: Mon Feb 2 14:58:31 2004 Subject: [Pythonmac-SIG] items vs. documents in Safari suite Message-ID: Using Panther, and the stock gensuitemodule, I've finally gotten some little applescripts rewritten in python. However, some of the things I had to fight with lead me to some questions... 1) I ended up doing s = Safari.Safari() items = Safari.items(1) ndocs = s.count(items, each=Safari.document) I found this mostly by trial and error - given the iCal examples in various presentations, I expected to use Safari.documents(1), or likewise Safari.windows(1), each=Safari.window - but none of these work, instead I get aetools.Error: (6, 'Device not configured', None) I can move forward with items(1), but could anyone explain (a) why (b) what I might have read to figure that out? 2) In the above error, the 6 is certainly the errn value, but the string in question comes from the unix errno space, and has nothing to do with the problem. Where should that string have really come from? 3) is Selection = s.do_JavaScript("getSelection()", in_=Safari.documents(1)) *really* the only way to find the current selection via AppleScript? I ask because it doesn't get any markup, whereas StickyBrain (for example) runs from a context menu and *does* get rich text for the selection, and that's what I'm aiming for. Actually, it looks like StickyBrain does an Edit->Copy, and gets the RichText from the clipboard, how do I talk to that with ae*? 4) Is there a trick to figuring out the raw event operations that a given chunk of AppleScript produces? I can find lots of AppleScript examples, and if I could take something like "repeat with i from 1 to the count of documents" and figure out what it was really doing, it would be a lot easier to come up with python equivalents. Maybe some kind of AppleEvent tracer, or disassembler? Thanks. _Mark_ ps. I used pythonw -c 'import gensuitemodule; gensuitemodule.main()' --output Safari /Applications/Safari.app to generate the Safari import; is there a cleaner way to say that? From berkowit at silcom.com Mon Feb 2 15:42:29 2004 From: berkowit at silcom.com (Paul Berkowitz) Date: Mon Feb 2 15:45:17 2004 Subject: [Pythonmac-SIG] items vs. documents in Safari suite In-Reply-To: Message-ID: On 2/2/04 11:58 AM, "Mark Eichin" wrote: > 4) Is there a trick to figuring out the raw event operations that a > given chunk of AppleScript produces? I can find lots of > AppleScript examples, and if I could take something like > "repeat with i from 1 to the count of documents" > and figure out what it was really doing, it would be a lot easier > to come up with python equivalents. Maybe some kind of AppleEvent > tracer, or disassembler? If it's worth it to you, you can test, then buy, Script Debugger, made by Late Night Software . It's the best debugger and IDE I know for any language, a real pleasure to work in, and well worth every penny if you're going to spend any time doing AppleScript. The free demo is good for 30 days, which may be all you need. You can step through every iteration of the repeat loop in your script (or check any other variable. etc. etc) and switch the result window's Format popup to "AEEvent". That will give you just the raw events you're looking for. Those of you who AppleScript might like to take a good look at SD, and see what you think. I think it's fantastic. It's not beyond possibility that Mark Alldritt, who makes SD, might be interested in making a similarly classy (commercial) IDE for Python. I believe that he thinks that the Python community (you guys) are already quite well-provided for by your own efforts, and that Perl might be more needy and receptive to such a thing. Take a god look, and see what you think. -- Paul Berkowitz From dp at ulaluma.com Mon Feb 2 16:19:48 2004 From: dp at ulaluma.com (Donovan Preston) Date: Mon Feb 2 16:20:14 2004 Subject: [Pythonmac-SIG] items vs. documents in Safari suite In-Reply-To: References: Message-ID: <87C84A0C-55C5-11D8-AE12-000A95864FC4@ulaluma.com> On Feb 2, 2004, at 2:58 PM, Mark Eichin wrote: > 4) Is there a trick to figuring out the raw event operations that a > given chunk of AppleScript produces? I can find lots of > AppleScript examples, and if I could take something like > "repeat with i from 1 to the count of documents" > and figure out what it was really doing, it would be a lot easier > to come up with python equivalents. Maybe some kind of AppleEvent > tracer, or disassembler? set the following environment variables in a shell: AEDebug 1 AEDebugSends 1 AEDebugReceives 1 Adjust to taste depending on what you want to see. Then run the app which you expect to be sending and receiving AEs. ScriptEditor or your python script using pythonw: /Applications/AppleScript/Script\ Editor.app/Contents/MacOS/Script\ Editor or: pythonw myscript.py I used to use Lasso Capture AE on Mac OS 9 to do a similar thing where I would trigger some events which did whatever I was trying to do in script editor, watch the output, and then try to reproduce it using python code. It has been helpful. dp From jhrsn at pitt.edu Mon Feb 2 18:28:31 2004 From: jhrsn at pitt.edu (Jim Harrison) Date: Mon Feb 2 18:28:41 2004 Subject: [Pythonmac-SIG] Mildly tweaking IDLE In-Reply-To: <87C84A0C-55C5-11D8-AE12-000A95864FC4@ulaluma.com> Message-ID: I finally got tired of IDLE's appearance on OSX and poked around a bit until I was able to fix a few minor annoyances. Here's what I did, in case it would be useful to anyone; I edited these files using BBedit's "Open Hidden" command on the IDLE icon/directory installed by Jack's current Python 2.3.3 installer. The salient files are in IDLE/Contents/Resources/idlelib. 1. Fixing the status bar in the shell and editor windows. This looks clunky, the line and col labels are on the wrong end (in my opinion), the default font is too big and the SUNKEN relief produces borders that just don't look right on OSX. First, edit MultiStatusBar.py, line 13 (the Label definition) to remove "relief=SUNKEN" and add "font=('Verdana', 9)" -- use your desired font and size. Then edit EditorWindow.py lines 224 and 225 to change side=LEFT to side=RIGHT. I also switched the order of these lines so the line number comes before the column number, which I prefer. This change moves the line and column labels to the left bottom of the window and as an extra added bonus, both labels now update correctly. There was previously an updating problem when the line number overlay the grow box at the right bottom of the window. 2. Fixing the ugly, continuous, focus rectangle around the text area in the shell and editor windows. Actually, a focus indicator isn't needed here, as the text area is the only widget in the window that can receive the focus. Unfortunately, the IDLE theme system assigns the same color to the text widget highlight (the focus ring) as to the font color of selected text, which I prefer to be black. I broke this relationship by editing lines 96 and 97 of EditorWindow.py to set the Text element highlight color and highlightbackground to a light gray (#DDDDDD). Note that doing this makes these elements not settable from the configuration window, but this didn't bother me since I didn't really want a focus ring and I'm using the rectangle just for a subtle divider between the text editing area and the status bar. Since the default highlight thickness of 2 pixels seemed a little heavy, I added "highlightthickness=1" to the Text definition on line 90 to reduce the thickness of the rectangle to 1 pixel. This ends up with a pretty attractive display. Now if I can only find a way to pass a y value to the tear-off menus so they will display a bit lower rather than jumping up under the menubar at the top of the screen. Is there a possibility of getting some minor tweaks to address OSX issues like this back into the IDLE source? Jim Harrison Univ. of Pittsburgh From wfolta at netmail.to Mon Feb 2 22:14:28 2004 From: wfolta at netmail.to (Wayne Folta) Date: Mon Feb 2 22:14:36 2004 Subject: [Pythonmac-SIG] pygames event.get() ? Message-ID: <13F4A82A-55F7-11D8-AF8A-000A959CB2EC@netmail.to> I just discovered pygames and it's a great module. One puzzler, though, for anyone who is familiar with the package on MacOS X. (I'm assuming the example works on the PC, though maybe it never worked as typed.) The issue seems to be that pygame.event.get() is blocking. So the little ball moving around the screen only moves when I move the cursor around to feed it events. Any insight? #!/usr/bin/env pythonw import sys, pygame pygame.init() size = width, height = 320, 240 speed = [2, 2] black = 0, 0, 0 screen = pygame.display.set_mode(size) ball = pygame.image.load("ball.gif") ballrect = ball.get_rect() while 1: for event in pygame.event.get(): # Here's the issue if event.type == pygame.QUIT: sys.exit() ballrect = ballrect.move(speed) if ballrect.left < 0 or ballrect.right > width: speed[0] = -speed[0] if ballrect.top < 0 or ballrect.bottom > height: speed[1] = -speed[1] screen.fill(black) screen.blit(ball, ballrect) pygame.display.flip() From bob at redivi.com Mon Feb 2 22:47:10 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 2 22:44:22 2004 Subject: [Pythonmac-SIG] pygames event.get() ? In-Reply-To: <13F4A82A-55F7-11D8-AF8A-000A959CB2EC@netmail.to> References: <13F4A82A-55F7-11D8-AF8A-000A959CB2EC@netmail.to> Message-ID: On Feb 2, 2004, at 10:14 PM, Wayne Folta wrote: > I just discovered pygames and it's a great module. One puzzler, > though, for anyone who is familiar with the package on MacOS X. (I'm > assuming the example works on the PC, though maybe it never worked as > typed.) > > The issue seems to be that pygame.event.get() is blocking. So the > little ball moving around the screen only moves when I move the cursor > around to feed it events. Any insight? I'm pretty sure that it's supposed block. Use poll, or alternatively use peek to see if there are any events then do a get if appropriate. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040202/803ee670/smime-0001.bin From mwh at python.net Tue Feb 3 05:19:27 2004 From: mwh at python.net (Michael Hudson) Date: Tue Feb 3 05:19:31 2004 Subject: [Pythonmac-SIG] pygames event.get() ? In-Reply-To: <13F4A82A-55F7-11D8-AF8A-000A959CB2EC@netmail.to> (Wayne Folta's message of "Mon, 2 Feb 2004 22:14:28 -0500") References: <13F4A82A-55F7-11D8-AF8A-000A959CB2EC@netmail.to> Message-ID: <2m1xpcihxs.fsf@starship.python.net> Wayne Folta writes: > I just discovered pygames and it's a great module. One puzzler, > though, for anyone who is familiar with the package on MacOS X. (I'm > assuming the example works on the PC, though maybe it never worked as > typed.) > > The issue seems to be that pygame.event.get() is blocking. So the > little ball moving around the screen only moves when I move the cursor > around to feed it events. Any insight? I think you can arrange for pygame to deliver an event every N milliseconds, or something like that. I don't know if that's the usual way of doing animation -- I've never actually written a game in pygame... Cheers, mwh -- For their next act, they'll no doubt be buying a firewall running under NT, which makes about as much sense as building a prison out of meringue. -- -:Tanuki:- -- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html From joaoleao at gmx.net Tue Feb 3 07:50:17 2004 From: joaoleao at gmx.net (=?ISO-8859-1?Q?Jo=E3o_Le=E3o?=) Date: Tue Feb 3 07:52:32 2004 Subject: [Pythonmac-SIG] pygames event.get() ? In-Reply-To: <13F4A82A-55F7-11D8-AF8A-000A959CB2EC@netmail.to> References: <13F4A82A-55F7-11D8-AF8A-000A959CB2EC@netmail.to> Message-ID: <848AFA0F-5647-11D8-8B80-000393967AF4@gmx.net> Most of the examples i've come across use this code: --- while 1: for event in pygame.event.get(): if event.type == QUIT: return --- after having imported like this: --- import pygame from pygame.locals import * --- It always worked for me in Jaguar and Panther. I'm sorry I can't help you more than this... _ joao On 3 de fev de 2004, at 3:14, Wayne Folta wrote: > I just discovered pygames and it's a great module. One puzzler, > though, for anyone who is familiar with the package on MacOS X. (I'm > assuming the example works on the PC, though maybe it never worked as > typed.) > > The issue seems to be that pygame.event.get() is blocking. So the > little ball moving around the screen only moves when I move the cursor > around to feed it events. Any insight? > > #!/usr/bin/env pythonw > > import sys, pygame > pygame.init() > > size = width, height = 320, 240 > speed = [2, 2] > black = 0, 0, 0 > > screen = pygame.display.set_mode(size) > > ball = pygame.image.load("ball.gif") > ballrect = ball.get_rect() > > while 1: > for event in pygame.event.get(): # Here's the issue > if event.type == pygame.QUIT: sys.exit() > > ballrect = ballrect.move(speed) > if ballrect.left < 0 or ballrect.right > width: > speed[0] = -speed[0] > if ballrect.top < 0 or ballrect.bottom > height: > speed[1] = -speed[1] > > screen.fill(black) > screen.blit(ball, ballrect) > pygame.display.flip() > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1873 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040203/daf03cfd/attachment.bin From joaoleao at gmx.net Tue Feb 3 08:18:59 2004 From: joaoleao at gmx.net (=?ISO-8859-1?Q?Jo=E3o_Le=E3o?=) Date: Tue Feb 3 08:21:06 2004 Subject: [Pythonmac-SIG] pygames event.get() ? In-Reply-To: <13F4A82A-55F7-11D8-AF8A-000A959CB2EC@netmail.to> References: <13F4A82A-55F7-11D8-AF8A-000A959CB2EC@netmail.to> Message-ID: <86EC905F-564B-11D8-8B80-000393967AF4@gmx.net> Earlier I didn't check the code properly The code that moves the balll can't be inside the < if event.type...> This is what should happen: while 1: for event in pygame.event.get(): # Here's the issue if event.type == pygame.QUIT: sys.exit() ballrect = ballrect.move(speed) if ballrect.left < 0 or ballrect.right > width: speed[0] = -speed[0] if ballrect.top < 0 or ballrect.bottom > height: speed[1] = -speed[1] screen.fill(black) screen.blit(ball, ballrect) pytpygame.display.flip() _ joao > while 1: > for event in pygame.event.get(): # Here's the issue > if event.type == pygame.QUIT: sys.exit() > > ballrect = ballrect.move(speed) > if ballrect.left < 0 or ballrect.right > width: > speed[0] = -speed[0] > if ballrect.top < 0 or ballrect.bottom > height: > speed[1] = -speed[1] > > screen.fill(black) > screen.blit(ball, ballrect) > pygame.display.flip() From joaoleao at gmx.net Tue Feb 3 13:35:56 2004 From: joaoleao at gmx.net (=?ISO-8859-1?Q?Jo=E3o_Le=E3o?=) Date: Tue Feb 3 13:38:18 2004 Subject: [Pythonmac-SIG] pygames event.get() ? In-Reply-To: References: <13F4A82A-55F7-11D8-AF8A-000A959CB2EC@netmail.to> <86EC905F-564B-11D8-8B80-000393967AF4@gmx.net> Message-ID: Wayne Folta: > Someone else mentioned that they haven't used pygame to do games. I'm > not sure exactly what I'm going to use it for, but it seems like a > nice interface for any kind of animated-ish interface whether a game > or a network tool. > That's my opinion too. I'm more interested in interactive / reactiv visual applications. So far i've used pygame to generate complex visual structures or semi-random images.* If you like this kind of programming check http://www.visionegg.org/ (i think it makes some use of pygame too) although i've never installed visionegg. * Processing < http://processing.org/ > is very nice too. Does anyone know it? It's written in Java and its syntax is like a simplified Java. But after becoming a Python user Java seems so.... ugly... From gillet at scripps.edu Tue Feb 3 13:47:31 2004 From: gillet at scripps.edu (Alexandre Gillet) Date: Tue Feb 3 13:47:47 2004 Subject: [Pythonmac-SIG] PyOpenGL 2.0.1.07, MacOSX 10.3, python2.3 and aqua, problem with Line demo. Message-ID: <401FECC3.2040903@scripps.edu> Hi, I am trying to run the demo/tom/Line.py which use Togl on a Mac G5 with a ATI card. I compile a version of Togl that run with Aqua. I install a binary distribtuion of PyOpenGL 2.0.1.07, Tkinter for python2.3 When I run the demo, I see a 400*400 widows open with a little black windows which seems to be the opengl context. If I resize my frame to be the same size of the black square I can see the line. But then if I try to scale the windows, the OpenGL context don't get resize. It's seems that the glViewport don't get update correctly. Anyone has seen that problem? Has anyone be able to run the PyOpenGL Demo using Togl on MacOSX 10.3 using aqua and not a Xserver? Thanks Alex ps: I already send the message to PyOpenGL list and did not get any answer. -- o Alexandre Gillet email: gillet@scripps.edu / The Scripps Research Institute, o Dept. Molecular Biology, MB-5, \ 10550 North Torrey Pines Road, o La Jolla, CA 92037-1000, USA. / tel: (858) 784-2053 o fax: (858) 784-2860 From bob at redivi.com Tue Feb 3 13:57:33 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 3 13:54:39 2004 Subject: [Pythonmac-SIG] PyOpenGL 2.0.1.07, MacOSX 10.3, python2.3 and aqua, problem with Line demo. In-Reply-To: <401FECC3.2040903@scripps.edu> References: <401FECC3.2040903@scripps.edu> Message-ID: On Feb 3, 2004, at 1:47 PM, Alexandre Gillet wrote: > I am trying to run the demo/tom/Line.py which use Togl on a Mac G5 with > a ATI card. > I compile a version of Togl that run with Aqua. > I install a binary distribtuion of PyOpenGL 2.0.1.07, Tkinter for > python2.3 > > When I run the demo, I see a 400*400 widows open with a little black > windows which seems to be the opengl context. If I resize my frame to > be > the same size of the black square I can see the line. > But then if I try to scale the windows, the OpenGL context don't get > resize. > It's seems that the glViewport don't get update correctly. > > Anyone has seen that problem? Has anyone be able to run the PyOpenGL > Demo using Togl on MacOSX 10.3 using aqua and not a Xserver? This is almost definitely a Togl problem. Good luck, I don't even think Togl is supposed by the PyOpenGL team anymore. I would just give up, or port it to something else (like pygame+PyOpenGL) . -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040203/bb9371c4/smime.bin From gherman at darwin.in-berlin.de Wed Feb 4 09:10:02 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed Feb 4 09:09:03 2004 Subject: [Pythonmac-SIG] Podpourri for iPod owners Message-ID: Hi, I've just overhauled my Podpourri app, a tool for iPod owners after discovering it burned on a magazine CD-ROM two days ago... It's now completely reimplemented in PyObjC and works internally much smarter than before (if it worked at all ;-). As of now Podpourri will extract iPod songs based on a regular ex- pression search into a directory and nothing else. I've stripped of two former features, XML and PDF export, since iTunes now exports XML itself and the PDF thing was always more of a joke. BTW, does someone know an iTunes-like tool to play songs on a Mac directly from a connected iPod? iTunes seems to still prevent this for whatever ideological reasons... More off-topic, I'd be interested to know if iTunes can handle more than one connected iPod at once in some useful (?) way... OK, here it is: http://python.net/~gherman/Podpourri.html Have fun, Dinu -- Dinu C. Gherman - http://python.net/~gherman ...................................................................... "The best way to predict the future is to invent it." (Alan Kay) From oussoren at cistron.nl Wed Feb 4 09:19:38 2004 From: oussoren at cistron.nl (Ronald Oussoren) Date: Wed Feb 4 09:19:42 2004 Subject: [Pythonmac-SIG] Podpourri for iPod owners In-Reply-To: References: Message-ID: <2A3A139F-571D-11D8-8D4F-0003931CFE24@cistron.nl> On 4-feb-04, at 15:10, Dinu Gherman wrote: > > > BTW, does someone know an iTunes-like tool to play songs on a Mac > directly from a connected iPod? iTunes seems to still prevent this > for whatever ideological reasons... I must have a different iTunes that you, I can play from a connected iPod. The iPod was managed by the Mac is was connected too, I don't know if it also works with other systems. Ronald -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 From dp at ulaluma.com Wed Feb 4 10:31:11 2004 From: dp at ulaluma.com (Donovan Preston) Date: Wed Feb 4 10:31:34 2004 Subject: [Pythonmac-SIG] Podpourri for iPod owners In-Reply-To: <2A3A139F-571D-11D8-8D4F-0003931CFE24@cistron.nl> References: <2A3A139F-571D-11D8-8D4F-0003931CFE24@cistron.nl> Message-ID: <297C80CC-5727-11D8-A54C-000A95864FC4@ulaluma.com> On Feb 4, 2004, at 9:19 AM, Ronald Oussoren wrote: > > On 4-feb-04, at 15:10, Dinu Gherman wrote: >> >> >> BTW, does someone know an iTunes-like tool to play songs on a Mac >> directly from a connected iPod? iTunes seems to still prevent this >> for whatever ideological reasons... > > I must have a different iTunes that you, I can play from a connected > iPod. The iPod was managed by the Mac is was connected too, I don't > know if it also works with other systems. I think he meant control the iPod via iTunes on the computer, but have the audio play out of the iPod headphone jack? It has bugged me that you can't do that, in the past. dp From gherman at darwin.in-berlin.de Wed Feb 4 10:48:12 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed Feb 4 10:47:12 2004 Subject: [Pythonmac-SIG] Podpourri for iPod owners In-Reply-To: <297C80CC-5727-11D8-A54C-000A95864FC4@ulaluma.com> Message-ID: <89EE5413-5729-11D8-A706-00039345C610@darwin.in-berlin.de> Donovan Preston: > On Feb 4, 2004, at 9:19 AM, Ronald Oussoren wrote: > >> I must have a different iTunes that you, I can play from a connected >> iPod. The iPod was managed by the Mac is was connected too, I don't >> know if it also works with other systems. > > I think he meant control the iPod via iTunes on the computer, but have > the audio play out of the iPod headphone jack? It has bugged me that > you can't do that, in the past. Not quite... In my setting I've got an external drive hosting my iTunes library which is periodically synchronized with an iPod. If I connect only the iPod, but not the disk containing the iTunes library, I get all entries grayed out in iTunes after selecting the iPod icon in the left column, so I cannot play on a Mac via iTunes any songs directly from the attached iPod. All iTunes versions I've used so far showed the same behaviour. I tried looking for some exotic preference options, but so far with no luck... Dinu From Larry.A.Meyn at nasa.gov Wed Feb 4 13:29:10 2004 From: Larry.A.Meyn at nasa.gov (Larry Meyn) Date: Wed Feb 4 13:29:21 2004 Subject: [Pythonmac-SIG] IDE Fails to Start In-Reply-To: <89EE5413-5729-11D8-A706-00039345C610@darwin.in-berlin.de> References: <89EE5413-5729-11D8-A706-00039345C610@darwin.in-berlin.de> Message-ID: <062A8643-5740-11D8-A63B-000A95A06CF6@nasa.gov> Just after installing the latest Aqua TCL/Tk, the Python IDE failed on start-up with the following traceback: Traceback (most recent call last): File "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/ PythonIDE.py", line 58, in ? import PythonIDEMain as _PythonIDEMain File "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/ PythonIDEMain.py", line 7, in ? import W File "/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/ IDE/W.py", line 7, in ? from Wtext import * File "/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/ IDE/Wtext.py", line 6, in ? import waste ImportError: No module named waste I've tried reinstalling the MacPython-Panther-2.3-2 additions and still have this failure. The waste.so file is in /Library/Python/2.3, so I'm assuming that there is a path finding problem. Can anyone tell me what I need to do to get /Library/Python/2.3 back on python's path list? Thanks! Larry Meyn Aerospace Operations Modeling Office M/S 210-10 NASA Ames Research Center Moffett Field, CA 94035-1000 E-mail: Larry.A.Meyn@nasa.gov Phone: (650) 604-5038 Fax: (650) 604-0222 E-Fax: (425) 944-5526 sent via e-mail From rowen at cesmail.net Wed Feb 4 13:44:03 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Wed Feb 4 13:44:19 2004 Subject: [Pythonmac-SIG] Using Carbon for files; a brief intro Message-ID: I just had to figure out how to use Carbon to obtain the preferences folder and thought I'd share what I learned. I hope to find time to put some of this into the Carbon docs someday, but right now time is short. The first step is to look at Apple's docs, as the MacOS Toolbox docs say: The important modules are as follows. Note that only the last of these is listed in the Python manual. I ended up finding these by searching through the source code looking for constants I needed. The lesson: if you are going to use Carbon, print dir(Carbon) and also have the source around so you can search it. But I digress...the important modules for files and folders are: - Carbon.File: File Manager routines - Carbon.Files: constants for File Manager routines - Carbon.Folder: Folder Manager routines - Carbon.Folders: constants for Folder Manager routines Also note that FSSpec objects have methods that implement some of the File Manager routines (very nice). There is an alternate means of referring to files, FSRref objects, which do not have any methods. I am not sure the tradeoffs for using one or the other. I ended up using FSSpec objects. Once you have an FSRef, what do you do with it? You can query information with FSGetCatalogInfo, but I have no idea how to interpret most of it (for example how to convert the dates to Python times). The most useful thing I found was the function Carbon.File.pathname, which converts FSSpecs and FSRefs (and "str" or "unicode") to a path that can be used in Python (e.g. the os module). Here is the code I ended up with: """Utilities for finding standard Mac directories. """ import Carbon.File, Carbon.Folder, Carbon.Folders import MacOS def findFolder(domain, dirType): """Return a path to the specified standard directory or None if not found. The path is in unix notation for MacOS X native python and Mac colon notation for Carbon python, i.e. the form expected by the os.path module. Inputs: - domain: one of the domain constants found in Carbon.Folders, such as kUserDomain, kLocalDomain or kSystemDomain. - dirType: one of the type constants found in Carbon.Folders, such as kPreferencesFolderType or kTrashFolderType. """ try: fsref = Carbon.Folder.FSFindFolder(domain, dirType, False) return Carbon.File.pathname(fsref) except MacOS.Error: return None def getPrefsDir(): """Return a path to the user's preferences folder or None if not found. """ return findFolder(Carbon.Folders.kUserDomain, Carbon.Folders.kPreferencesFolderType) def getAppSuppDirs(): """Return a list of paths to the user's and local (shared) application support folder. If a folder does not exist, it is omitted; hence returns [] if nothing found. """ retDirs = [] for domain in Carbon.Folders.kUserDomain, Carbon.Folders.kLocalDomain: path = findFolder(domain, Carbon.Folders.kApplicationSupportFolderType) if path != None: retDirs.append(path) return retDirs From Larry.A.Meyn at nasa.gov Wed Feb 4 14:21:46 2004 From: Larry.A.Meyn at nasa.gov (Larry Meyn) Date: Wed Feb 4 14:21:52 2004 Subject: [Pythonmac-SIG] Re: IDE Fails to Start In-Reply-To: <062A8643-5740-11D8-A63B-000A95A06CF6@nasa.gov> References: <89EE5413-5729-11D8-A706-00039345C610@darwin.in-berlin.de> <062A8643-5740-11D8-A63B-000A95A06CF6@nasa.gov> Message-ID: <5F731D6C-5747-11D8-840A-000A95A06CF6@nasa.gov> Somehow the symbolic link from site-packages to /Library/Python/2.3 was lost and site-packages was an empty directory. Recreating the symbolic link fixed the problem. --Larry Meyn On Feb 4, 2004, at 10:29 AM, Larry Meyn wrote: > Just after installing the latest Aqua TCL/Tk, the Python IDE failed on > start-up with the following traceback: > > Traceback (most recent call last): > File > "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/ > PythonIDE.py", line 58, in ? > import PythonIDEMain as _PythonIDEMain > File > "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/ > PythonIDEMain.py", line 7, in ? > import W > File > "/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/ > IDE/W.py", line 7, in ? > from Wtext import * > File > "/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/ > IDE/Wtext.py", line 6, in ? > import waste > ImportError: No module named waste > > > I've tried reinstalling the MacPython-Panther-2.3-2 additions and > still have this failure. The waste.so file is in /Library/Python/2.3, > so I'm assuming that there is a path finding problem. Can anyone tell > me what I need to do to get /Library/Python/2.3 back on python's path > list? Thanks! > > Larry Meyn > Aerospace Operations Modeling Office > > M/S 210-10 > NASA Ames Research Center > Moffett Field, CA 94035-1000 > > E-mail: Larry.A.Meyn@nasa.gov > Phone: (650) 604-5038 > Fax: (650) 604-0222 > E-Fax: (425) 944-5526 sent via e-mail > > From jjb5 at cornell.edu Wed Feb 4 15:48:16 2004 From: jjb5 at cornell.edu (Joel Bender) Date: Wed Feb 4 15:48:42 2004 Subject: [Pythonmac-SIG] Podpourri for iPod owners In-Reply-To: <89EE5413-5729-11D8-A706-00039345C610@darwin.in-berlin.de> References: <89EE5413-5729-11D8-A706-00039345C610@darwin.in-berlin.de> Message-ID: Dinu Gherman wrote: >If I connect only the iPod, but not the disk containing the iTunes >library, I get all entries grayed out in iTunes after selecting the >iPod icon in the left column, so I cannot play on a Mac via iTunes >any songs directly from the attached iPod. I get the same behavior with more than one user on the same Mac. In fact it's worse because if the iPod is connected when I log in it launches iTunes asks if I would like to replace the contents of the iPod with the current library. My wife would be particularly unimpressed if that happened :-). I'd like it to ignore the iPod completely when I'm logged in, but so far no luck. Joel From smithsm at samuelsmith.org Fri Feb 6 13:39:14 2004 From: smithsm at samuelsmith.org (Samuel M. Smith) Date: Fri Feb 6 13:39:30 2004 Subject: [Pythonmac-SIG] Non blocking terminal input In-Reply-To: References: <4C4BB602-541F-11D8-BF32-000393DB52E4@2xtreme.net> <82AB2C9C-54E8-11D8-B033-000A95C4B360@samuelsmith.org> Message-ID: Thanks Bob for the clue of where to look. Actually it took some digging to make it work. The python termios doesn't have the O_NONBLOCK flag it is in os.open(). In unix both fcntl and open support O_NONBLOCK but only python os.open() exports it. This kind of threw me because I didn't want to open the console I just wanted to change is state so os.fcntl was what I wanted but it didn't support. I tried os.open anyway and reopened the console. This seemed problematic but I guess you can open the same file multiple times with different file descriptors. The only problem I had was mixing print to stdout and writes to the new nonblocking fd = 3. Newlines were getting mixed up. Anyway I thought others might be interested. Here is a short class that supports nonblocking reads from the console. class ConsoleNB(object): """Class to manage non blocking reads from console. Opens non blocking read file descriptor on console Use instance method close to close file descriptor Use instance methods getline & put to read & write to console Needs os module """ def __init__(self, canonical = True): """Initialization method for instance. opens fd on terminal console in non blocking mode os.ctermid() returns path name of console usually '/dev/tty' os.O_NONBLOCK makes non blocking io os.O_RDWR allows both read and write. Don't use print as same time since it could mess up non blocking reads. Default is canonical mode so no characters available until newline """ #need to add code to enable non canonical mode self.fd = os.open(os.ctermid(),os.O_NONBLOCK | os.O_RDWR) def close(self): """Closes fd. Should use in try finally block. """ os.close(self.fd) def getline(self,bs = 80): """Gets nonblocking line from console up to bs characters including newline. Returns None if no characters available else returns line. In canonical mode no chars available until newline is entered. """ line = None try: line = os.read(self.fd, bs) except OSError, ex1: #if no chars available generates exception try: #need to catch correct exception errno = ex1.args[0] #if args not sequence get TypeError if errno == 35: pass #No characters available else: raise #re raise exception ex1 except TypeError, ex2: #catch args[0] mismatch above raise ex1 #ignore TypeError, re-raise exception ex1 return line def put(self, data = '\n'): """Writes data string to console. """ os.write(self.fd, data) On Feb 1, 2004, at 12:28, Bob Ippolito wrote: > On Feb 1, 2004, at 1:57 PM, Samuel M. Smith wrote: > >> Is there an equivalent on mac/unix to the msvcrt module for windows >> kbhit() function? >> Or in other words is there some way to do non blocking reads of the >> terminal as opposed to blocking reads vis a vis raw_input()? > > The reason stdin acts as a line based input is because there are > certain flags set on it... serial ports are the same way. I remember > delving into this a while ago, and I *think* the constants/functions > you need to use are in the termios module. > > After you've set the right flags, you can even use select() on stdin > and it'll let you know when a key has been pressed. > > -bob > > (this is pretty standard *nix stuff..) > > ********************************************************************** Samuel M. Smith Ph.D. 2966 Fort Hill Road Eagle Mountain, Utah 84043 801-768-2768 voice 801-768-2769 fax ********************************************************************** "The greatest source of failure and unhappiness in the world is giving up what we want most for what we want at the moment" ********************************************************************** From smithsm at samuelsmith.org Fri Feb 6 15:02:08 2004 From: smithsm at samuelsmith.org (Samuel M. Smith) Date: Fri Feb 6 15:02:14 2004 Subject: [Pythonmac-SIG] yield keyword in BBedit not colored Message-ID: <57DC99D6-58DF-11D8-A8FD-000A95C4B360@samuelsmith.org> I just noticed that the new yield keyword does not get proper syntax coloring in BBedit 7.1.2. Is there a new python language module for BBedit that recognizes the new keyword? From janssen at parc.com Fri Feb 6 15:29:04 2004 From: janssen at parc.com (Bill Janssen) Date: Fri Feb 6 15:29:28 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? Message-ID: <04Feb6.122905pst."58611"@synergy1.parc.xerox.com> I've got a software package (gamera.sf.net) that claims to need 2.3.1 on MacOS. However, the python in /usr/bin/python is 2.3.0. 1. Can it be upgraded? 2. If not, can it be moved out of the way (/usr/libexec/ or whatever), and can I install a newer version in /usr/bin/? 3. Is Apple going to upgrade it with Software Upgrade? Bill From bob at redivi.com Fri Feb 6 15:41:50 2004 From: bob at redivi.com (Bob Ippolito) Date: Fri Feb 6 15:38:55 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: <04Feb6.122905pst."58611"@synergy1.parc.xerox.com> References: <04Feb6.122905pst."58611"@synergy1.parc.xerox.com> Message-ID: On Feb 6, 2004, at 3:29 PM, Bill Janssen wrote: > I've got a software package (gamera.sf.net) that claims to need 2.3.1 > on MacOS. However, the python in /usr/bin/python is 2.3.0. > > 1. Can it be upgraded? You can install another Python somewhere else.. but you shouldn't try and upgrade any vendor provided software yourself. > 2. If not, can it be moved out of the way (/usr/libexec/ or > whatever), and can I install a newer version in /usr/bin/? What's with /usr/bin? You shouldn't touch the 2.3.0 installation. Change your PATH or the software to use another interpreter. > 3. Is Apple going to upgrade it with Software Upgrade? I'd say that's highly unlikely, unless 10.4 is a free update ;) BTW: do they say specifically why they want 2.3.1? I know there are a few bugs in the interpreter at 2.3.0, but I haven't seen any come up myself... if it's just a standard library change, there is a workaround to upgrading. -bob From altis at semi-retired.com Fri Feb 6 15:49:35 2004 From: altis at semi-retired.com (Kevin Altis) Date: Fri Feb 6 15:46:23 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: Message-ID: > From: Bob Ippolito > Sent: Friday, February 06, 2004 12:42 PM > To: Bill Janssen > Cc: pythonmac-sig@python.org > Subject: Re: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? > > > > On Feb 6, 2004, at 3:29 PM, Bill Janssen wrote: > > > I've got a software package (gamera.sf.net) that claims to need 2.3.1 > > on MacOS. However, the python in /usr/bin/python is 2.3.0. > > > > 1. Can it be upgraded? > > You can install another Python somewhere else.. but you shouldn't try > and upgrade any vendor provided software yourself. > > > 2. If not, can it be moved out of the way (/usr/libexec/ or > > whatever), and can I install a newer version in /usr/bin/? > > What's with /usr/bin? You shouldn't touch the 2.3.0 installation. > Change your PATH or the software to use another interpreter. > > > 3. Is Apple going to upgrade it with Software Upgrade? > > I'd say that's highly unlikely, unless 10.4 is a free update ;) > > BTW: do they say specifically why they want 2.3.1? I know there are a > few bugs in the interpreter at 2.3.0, but I haven't seen any come up > myself... if it's just a standard library change, there is a workaround > to upgrading. > > -bob I submitted a bug report on January 21st to Apple asking that they keep Python 2.3 updated. I don't expect any action, but you never know. http://bugreport.apple.com/ Problem ID: 3536048 ka From Jack.Jansen at cwi.nl Thu Feb 5 17:29:32 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 6 16:10:57 2004 Subject: [Pythonmac-SIG] Using Carbon for files; a brief intro In-Reply-To: References: Message-ID: On 4-feb-04, at 19:44, Russell E. Owen wrote: > I just had to figure out how to use Carbon to obtain the preferences > folder and thought I'd share what I learned. I hope to find time to put > some of this into the Carbon docs someday, but right now time is short. > > The first step is to look at Apple's docs, as the MacOS Toolbox docs > say: > > The important modules are as follows. Note that only the last of these > is listed in the Python manual. I ended up finding these by searching > through the source code looking for constants I needed. The lesson: if > you are going to use Carbon, print dir(Carbon) and also have the source > around so you can search it. But I digress...the important modules for > files and folders are: > - Carbon.File: File Manager routines > - Carbon.Files: constants for File Manager routines > - Carbon.Folder: Folder Manager routines > - Carbon.Folders: constants for Folder Manager routines They should at least be listed in the documentation, along with all the other Carbon modules. If they really aren't: please file a bug report. Make it a documentation bug report, but assign it to me. > Also note that FSSpec objects have methods that implement some of the > File Manager routines (very nice). There is an alternate means of > referring to files, FSRref objects, which do not have any methods. I am > not sure the tradeoffs for using one or the other. I ended up using > FSSpec objects. Why do you think FSRef objects don't have any methods? They have quite a few... Also, in the code you actually use FSRefs (FSFindFolder() returns an FSRef).... FSRefs are newer than FSSpecs, and are deemed to be the wave of the future. FSSpecs have one advantage, though: they can refer to non-existing files, which FSRefs can't. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Thu Feb 5 17:18:02 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 6 16:25:50 2004 Subject: [Pythonmac-SIG] Mildly tweaking IDLE In-Reply-To: References: Message-ID: <29CAB6BA-5829-11D8-8B21-000A27B19B96@cwi.nl> On 3-feb-04, at 0:28, Jim Harrison wrote: > Is there a possibility of getting some minor tweaks to address OSX > issues > like this back into the IDLE source? Put them in the sourceforge bug repository. I guess you'd put them in as a feature request. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From janssen at parc.com Fri Feb 6 16:49:43 2004 From: janssen at parc.com (Bill Janssen) Date: Fri Feb 6 16:55:46 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: Your message of "Fri, 06 Feb 2004 12:41:50 PST." Message-ID: <04Feb6.134950pst."58611"@synergy1.parc.xerox.com> > > 1. Can it be upgraded? > > You can install another Python somewhere else.. but you shouldn't try > and upgrade any vendor provided software yourself. The last time I had another 2.3 python in /usr/local/bin (installed under Jaguar), it caused no ends of problems with the PIL extension, as you may recall. If I install 2.3.3 under /usr/local, will I have the same problems? > What's with /usr/bin? You shouldn't touch the 2.3.0 installation. > Change your PATH or the software to use another interpreter. I'd just like /usr/bin/python to be generally useful by the other software on my machine. Seems that either Apple should track the minor releases with Software Update, or it should be in some less used directory (like /usr/libexec, for instance). I find this whole "frameworks" version of Python on 10.3 to be somewhat user-hostile. > BTW: do they say specifically why they want 2.3.1? I know there are a > few bugs in the interpreter at 2.3.0, but I haven't seen any come up > myself... if it's just a standard library change, there is a workaround > to upgrading. No, and I haven't tried to ask yet. But I will, and I'll get back to you on that. Thanks, Bob. Bill From bob at redivi.com Fri Feb 6 17:06:42 2004 From: bob at redivi.com (Bob Ippolito) Date: Fri Feb 6 17:03:48 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: <04Feb6.134950pst."58611"@synergy1.parc.xerox.com> References: <04Feb6.134950pst."58611"@synergy1.parc.xerox.com> Message-ID: On Feb 6, 2004, at 4:49 PM, Bill Janssen wrote: >>> 1. Can it be upgraded? >> >> You can install another Python somewhere else.. but you shouldn't try >> and upgrade any vendor provided software yourself. > > The last time I had another 2.3 python in /usr/local/bin (installed > under Jaguar), it caused no ends of problems with the PIL extension, > as you may recall. If I install 2.3.3 under /usr/local, will I have > the same problems? Yes, you will have problems building extensions for the vendor 2.3.0 installation if you have another installation of Python (it's not /usr/local that matters, it's /Library/Frameworks). You can probably subvert this by adding -F/System/Library/Frameworks to the linker flags when building applications that need to link with the vendor 2.3.0 -- or you can just use packages from the various Package Manager databases, which are already compiled properly for this version of Python. You will also have problems with extension modules if installed to ~/Library/Python/2.3/site-packages .. This probably won't be a problem system-wide, as vendor Python currently uses /Library/Python/2.3 where a user-build Python will use /Library/Python/2.3/site-packages. In any case, these problems are really not solvable without adding OS X 10.3 specific linker flags to the extension building process... once we can do that, then extensions will be portable amongst different versions of Python so long as the ABI doesn't change, because the bundles won't link directly to the Python framework. See http://python.org/sf/887242 for more information -- feel free to help me convince Jack to make this change.. I'm hoping it happens before OS X 10.4, so we can forget about this problem at some point. >> What's with /usr/bin? You shouldn't touch the 2.3.0 installation. >> Change your PATH or the software to use another interpreter. > > I'd just like /usr/bin/python to be generally useful by the other > software on my machine. Seems that either Apple should track the > minor releases with Software Update, or it should be in some less used > directory (like /usr/libexec, for instance). I find this whole > "frameworks" version of Python on 10.3 to be somewhat user-hostile. /usr/bin/* is software that Apple expects to have control over. If you want to override it, do it in /usr/local. This is the case for other operating systems too. It's never a good idea to screw with /usr unless you know exactly what you're doing and are willing to accept the consequences; namely, it will break Apple and 3rd party software. -bob From Jack.Jansen at cwi.nl Fri Feb 6 17:49:11 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 6 17:49:17 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: References: <04Feb6.134950pst."58611"@synergy1.parc.xerox.com> Message-ID: On 6-feb-04, at 23:06, Bob Ippolito wrote: > In any case, these problems are really not solvable without adding OS > X 10.3 specific linker flags to the extension building process... once > we can do that, then extensions will be portable amongst different > versions of Python so long as the ABI doesn't change, because the > bundles won't link directly to the Python framework. See > http://python.org/sf/887242 for more information -- feel free to help > me convince Jack to make this change.. I'm hoping it happens before OS > X 10.4, so we can forget about this problem at some point. I second Bob's request: if you feel strongly about multiple Pythons on MacOS check < http://python.org/sf/887242>, think about it, think about my solution (sketched below) and voice your opinion. My change, which is already in the CVS tree, but which I'll gladly retract if people think Bobs solution is better, is to add "-F /Library/Frameworks" or "-F /System/Library/Frameworks" to the linker call for extensions. The "-F" option adds a directory to the front of the framework search path, so on a system with both frameworks installed this will make the correct framework (correct for the version of Python used to build the extension) be used. Bob's change will not link extensions against the framework but in stead use the new linker flag "-undefined dynamic_lookup". This will in principle make an extension load in any Python. My method has the disadvantage that importing the module into the wrong Python on a system with two Pythons installed will still cause problems. Bobs method has the disadvantage that dynamic_lookup is inherently dangerous: all your symbols that were undefined at link time will by satisfied from any symbol with the same name that happens to be loaded in the executable loading the module. I'm tending to favor Bob's solution, but I'd like to hear other peoples opinion, please. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From oussoren at cistron.nl Fri Feb 6 18:27:18 2004 From: oussoren at cistron.nl (Ronald Oussoren) Date: Fri Feb 6 18:27:18 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: References: <04Feb6.134950pst."58611"@synergy1.parc.xerox.com> Message-ID: <012B3070-58FC-11D8-883C-0003931CFE24@cistron.nl> On 6-feb-04, at 23:49, Jack Jansen wrote: > > On 6-feb-04, at 23:06, Bob Ippolito wrote: > >> In any case, these problems are really not solvable without adding OS >> X 10.3 specific linker flags to the extension building process... >> once we can do that, then extensions will be portable amongst >> different versions of Python so long as the ABI doesn't change, >> because the bundles won't link directly to the Python framework. See >> http://python.org/sf/887242 for more information -- feel free to help >> me convince Jack to make this change.. I'm hoping it happens before >> OS X 10.4, so we can forget about this problem at some point. > > I second Bob's request: if you feel strongly about multiple Pythons on > MacOS check < http://python.org/sf/887242>, think about it, think > about my solution (sketched below) and voice your opinion. > > My change, which is already in the CVS tree, but which I'll gladly > retract if people think Bobs solution is better, is to add "-F > /Library/Frameworks" or "-F /System/Library/Frameworks" to the linker > call for extensions. The "-F" option adds a directory to the front of > the framework search path, so on a system with both frameworks > installed this will make the correct framework (correct for the > version of Python used to build the extension) be used. > Did you test your alternative? The manpage for ld(1) gives me the impression that -F is used at link-time only. Hmm, this would of course help when building extensions when you have two python frameworks installed. But didn't some people have problems with their existing Jaguar MacPython installation after upgrading to Panther (existing extension modules that suddenly picked up the other Python.framework)? If that is so, the -F solution won't fix that. I don't like Bob's idea of using -undefined dynamic_lookup, this will make development harder. I don't want to count the number of times that I built extension modules on Linux that built just fine but didn't work because they contained undefined symbols. On MacOS X we currently get compile-time errors for most, if not all, of these errors. Ronald From bob at redivi.com Fri Feb 6 18:41:59 2004 From: bob at redivi.com (Bob Ippolito) Date: Fri Feb 6 18:39:00 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: <012B3070-58FC-11D8-883C-0003931CFE24@cistron.nl> References: <04Feb6.134950pst."58611"@synergy1.parc.xerox.com> <012B3070-58FC-11D8-883C-0003931CFE24@cistron.nl> Message-ID: <0E558B38-58FE-11D8-BF45-000A95686CD8@redivi.com> On Feb 6, 2004, at 6:27 PM, Ronald Oussoren wrote: > > On 6-feb-04, at 23:49, Jack Jansen wrote: > >> >> On 6-feb-04, at 23:06, Bob Ippolito wrote: >> >>> In any case, these problems are really not solvable without adding >>> OS X 10.3 specific linker flags to the extension building process... >>> once we can do that, then extensions will be portable amongst >>> different versions of Python so long as the ABI doesn't change, >>> because the bundles won't link directly to the Python framework. >>> See http://python.org/sf/887242 for more information -- feel free to >>> help me convince Jack to make this change.. I'm hoping it happens >>> before OS X 10.4, so we can forget about this problem at some point. >> >> I second Bob's request: if you feel strongly about multiple Pythons >> on MacOS check < http://python.org/sf/887242>, think about it, think >> about my solution (sketched below) and voice your opinion. >> >> My change, which is already in the CVS tree, but which I'll gladly >> retract if people think Bobs solution is better, is to add "-F >> /Library/Frameworks" or "-F /System/Library/Frameworks" to the linker >> call for extensions. The "-F" option adds a directory to the front of >> the framework search path, so on a system with both frameworks >> installed this will make the correct framework (correct for the >> version of Python used to build the extension) be used. >> > > Did you test your alternative? The manpage for ld(1) gives me the > impression that -F is used at link-time only. > > Hmm, this would of course help when building extensions when you have > two python frameworks installed. But didn't some people have problems > with their existing Jaguar MacPython installation after upgrading to > Panther (existing extension modules that suddenly picked up the other > Python.framework)? If that is so, the -F solution won't fix that. Extensions modules always pick up the framework that they are linked with so long as that framework exists and it isn't influenced by one of the DYLD environment variables. The problem was -F related. > I don't like Bob's idea of using -undefined dynamic_lookup, this will > make development harder. I don't want to count the number of times > that I built extension modules on Linux that built just fine but > didn't work because they contained undefined symbols. On MacOS X we > currently get compile-time errors for most, if not all, of these > errors. You can turn off -undefined dynamic_lookup and use -framework Python instead when doing development. bundles should be distributed without a load command for the Python framework or else we will continue to have these headaches for the rest of time. Think about the problems users will have with two versions of Python 2.3 installed, both use the same paths for site-packages (except the current vendor system-wide is slightly different, due to an Apple misunderstanding). -bob From janssen at parc.com Fri Feb 6 23:38:42 2004 From: janssen at parc.com (Bill Janssen) Date: Fri Feb 6 23:39:15 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: Your message of "Fri, 06 Feb 2004 14:49:11 PST." Message-ID: <04Feb6.203851pst."58611"@synergy1.parc.xerox.com> > I'm tending to favor Bob's solution, but I'd like to hear other peoples > opinion, please. I think I'm favoring Bob's solution, too. Bill From altis at semi-retired.com Sat Feb 7 01:34:33 2004 From: altis at semi-retired.com (Kevin Altis) Date: Sat Feb 7 01:31:16 2004 Subject: [Pythonmac-SIG] advanced newbie questions - Outliners In-Reply-To: <882F8381-5101-11D8-9EDD-000A95686CD8@redivi.com> Message-ID: > From: Bob Ippolito > > On Jan 27, 2004, at 1:58 PM, steve harley wrote: > > > i'm learning Python, evaluating it for replacing a workflow that is > > now half in Visual FoxPro, half in UserLand Frontier (running in > > Virtual PC & Classic respectively under Mac OS X 10.3.2).. given that > > i find both of those environments very fluid and powerful, but dislike > > having to use VPC and Classic, Python looks very promising.. it has a > > coding feel much like Frontier, though i miss coding in an outliner; > > has anyone found a way to do this for Python, which is so obviously > > suited? > > We don't have an outliner. I've never used one (and I'm not willing to > install Classic :) so if you could explain what an outliner does, how > it works, and what you like most about it.. maybe we can incorporate > that sort of thing into a future IDE for MacPython. This is a bit late, but I came across these links today for a series of articles that will show and tell you more than you ever wanted to know about outliners. Since this may end up improving one or more Python editors and IDEs in the future, it is worth getting into the list archive. History http://www.atpm.com/9.09/atpo.shtml Features http://www.atpm.com/9.10/atpo.shtml http://www.atpm.com/9.11/atpo.shtml Usage Patterns http://www.atpm.com/9.12/atpo.shtml User Interfaces http://www.atpm.com/10.02/atpo.shtml Then if you haven't had your fill, go back to the Dave Winer site... http://www.outliners.com/ ka From hengist.podd at virgin.net Sat Feb 7 05:33:28 2004 From: hengist.podd at virgin.net (has) Date: Sat Feb 7 05:33:43 2004 Subject: [Pythonmac-SIG] Using Carbon for files; a brief intro In-Reply-To: References: Message-ID: Jack wrote: >>Also note that FSSpec objects have methods that implement some of the >>File Manager routines (very nice). There is an alternate means of >>referring to files, FSRref objects, which do not have any methods. I am >>not sure the tradeoffs for using one or the other. I ended up using >>FSSpec objects. > >Why do you think FSRef objects don't have any methods? They have >quite a few... > >Also, in the code you actually use FSRefs (FSFindFolder() returns an >FSRef).... >FSRefs are newer than FSSpecs, and are deemed to be the wave of the >future. FSSpecs have one advantage, though: they can refer to >non-existing files, which FSRefs can't. Useful link: has -- http://freespace.virgin.net/hamish.sanderson/ From smiles at saysomething.com Sat Feb 7 12:14:02 2004 From: smiles at saysomething.com (Christopher Smith) Date: Sat Feb 7 12:14:46 2004 Subject: [Pythonmac-SIG] Swig_for_Mac In-Reply-To: Message-ID: <06EE9222-5991-11D8-894C-000393C0D100@saysomething.com> Hello, I'm trying to use an extension I've downloaded (APSE, a "Python port of the String::Approx module written for perl by Jarkko Hietaniemi."). I downloaded Swig_for_Mac 1.3.11 and am trying to figure out how to make one of the examples work before I try to process the apse.c file. I start up Swig_for_Mac and set the source to be the example.i file and press run. A wrapper file is produced, example_wrap.c. Now I don't know what to do from here. I am having a hard time sifting out what can/should be done with the Swig_for_Mac and what must be done at the command line with gcc. One of the pages that I've consulted says to issue a gcc compile of the example.c and example_wrap.c files. When I do that I get the following output: csmith% gcc -c example.c example_wrap.c -I/usr/local/include/python2.2 -I/usr/local/include/python2.2 example_wrap.c:27: header file 'string.h' not found example_wrap.c:203: header file 'stdlib.h' not found [and a whole lot more!] I don't have anything related to python in the usr/local/include directory so I'm not surprised I get a lot of error messages--there is only a 'dlfcn.h' file in that directory. On the other hand, I don't know which path I should be specifying. I am using version 2.2 of python: csmith% python Python 2.2 (#1, 07/14/02, 23:25:09) [GCC Apple cpp-precomp 6.14] on darwin Type "help", "copyright", "credits" or "license" for more information. Being a bit unix-unsavvy, I almost never run it from the command line; I always run it through the IDE. My objective is to be able to use the APSE.c file's functions. I assume that I have to use SWIG in some manner to do that. If you can help me get it running (or suggest another way to be able to access the apse.c function) I would appreciate it. /c From jhrsn at pitt.edu Sat Feb 7 21:57:11 2004 From: jhrsn at pitt.edu (Jim Harrison) Date: Sat Feb 7 21:57:18 2004 Subject: [Pythonmac-SIG] advanced newbie questions - Outliners In-Reply-To: Message-ID: on 2/7/04 1:34 AM, Kevin Altis at altis@semi-retired.com wrote: >>> Python looks very promising.. it has a coding feel much like Frontier, >>> though i miss coding in an outliner; has anyone found a way to do this for >>> Python, which is so obviously suited? >> >> We don't have an outliner. I've never used one (and I'm not willing to >> install Classic :) so if you could explain what an outliner does, how >> it works, and what you like most about it.. maybe we can incorporate >> that sort of thing into a future IDE for MacPython. > > This is a bit late, but I came across these links today for a series of > articles that will show and tell you more than you ever wanted to know about > outliners. Since this may end up improving one or more Python editors and > IDEs in the future, it is worth getting into the list archive. I used Frontier some years ago and liked the outliner-based coding as well. I've always been disappointed that this functionality wasn't more generally available, and it would be a particularly good fit with Python. It is possible to write Python code in OmniOutliner on OSX--OO can export as a tab-indented outline, which is then executable as Python. I talked to the Omni people a year or so ago about the possibility of putting some coding-related features into OO, but they weren't particularly interested in taking the program in that direction then. http://www.omnigroup.com/applications/omnioutliner/ FO is new OSX outliner that also exports as tabbed text. It's a bit awkward and has a few bugs, but may develop into something useful. http://homepage.mac.com/takashi_hamada/Acti/MacOSX/FO/index.html Jim Harrison Univ. of Pittsburgh From krjackson at lbl.gov Sat Feb 7 22:05:46 2004 From: krjackson at lbl.gov (Keith Jackson) Date: Sat Feb 7 22:05:45 2004 Subject: [Pythonmac-SIG] Swig_for_Mac In-Reply-To: <06EE9222-5991-11D8-894C-000393C0D100@saysomething.com> References: <06EE9222-5991-11D8-894C-000393C0D100@saysomething.com> Message-ID: Hi, First off, swig 1.3.11 is really old and buggy. Personally I'd just build swig by hand, and run it from the command line. then you can get swig-1.3.20. If you really have to have a gui, a quick google search shows the current version of Swig for Mac is 1.3.19. You should at least upgrade to that. More comments inline. On Feb 7, 2004, at 9:14 AM, Christopher Smith wrote: > Hello, > > I'm trying to use an extension I've downloaded (APSE, a "Python port > of the String::Approx module written for perl by Jarkko Hietaniemi."). > I downloaded Swig_for_Mac 1.3.11 and am trying to figure out how to > make one of the examples work before I try to process the apse.c file. > > I start up Swig_for_Mac and set the source to be the example.i file > and press run. A wrapper file is produced, example_wrap.c. > > Now I don't know what to do from here. I am having a hard time sifting > out what can/should be done with the Swig_for_Mac and what must be > done at the command line with gcc. One of the pages that I've > consulted says to issue a gcc compile of the example.c and > example_wrap.c files. When I do that I get the following output: > Yes, Swig just generates C code from the .i file. You must still compile it. > csmith% gcc -c example.c example_wrap.c -I/usr/local/include/python2.2 > -I/usr/local/include/python2.2 > example_wrap.c:27: header file 'string.h' not found > example_wrap.c:203: header file 'stdlib.h' not found > kjackson@krjnote(5)>ls /usr/include/string.h 8 /usr/include/string.h kjackson@krjnote(6)>ls /usr/include/stdlib.h 8 /usr/include/stdlib.h kjackson@krjnote(7)> Those should all be in /usr/include. gcc adds /usr/include to the include search path, so I'm not sure what's going on. Do you have these files in /usr/include? > [and a whole lot more!] > > I don't have anything related to python in the usr/local/include > directory so I'm not surprised I get a lot of error messages--there is > only a 'dlfcn.h' file in that directory. On the other hand, I don't > know which path I should be specifying. > > I am using version 2.2 of python: > csmith% python > Python 2.2 (#1, 07/14/02, 23:25:09) > [GCC Apple cpp-precomp 6.14] on darwin > Type "help", "copyright", "credits" or "license" for more information. > > Being a bit unix-unsavvy, I almost never run it from the command line; > I always run it through the IDE. > > My objective is to be able to use the APSE.c file's functions. I > assume that I have to use SWIG in some manner to do that. If you can > help me get it running (or suggest another way to be able to access > the apse.c function) I would appreciate it. > You can certainly use Swig to enable access to a function in C, but you're going to need to become a little more unix-savy. :) Once you get the example working, you'll have to write a .i file that tells swig what you want to wrap. I've never looked at APSE, so I can't give you a feel for how difficult that will be. It could be as simple as just including it in the .i file in the right section, or it could require a more complex interface file. --keith > /c > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From bob at redivi.com Mon Feb 9 01:18:29 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 9 01:15:28 2004 Subject: [Pythonmac-SIG] bundlebuilder2 preview Message-ID: I've put together a preview release of my bundlebuilder revisions and macholib: http://undefined.org/python/macholib-v2.0a0.tgz Changes: Finds dyld/frameworks that extensions use and automatically includes them for --(semi-)standalone (i.e. Tcl/Tk). Will include anything that doesn't live in /System Rewrites Mach-O load commands (for dylds, frameworks, and the python binary) when using --(semi-)standalone Validates keyword arguments for "buildapp.py" purposes Changed command line parser to use optparse instead of getopt (I think I want to refactor this some more though). In doing so, I changed the --file syntax to take two arguments instead of a colon delimited argument. Doesn't care what the Python framework is called (i.e., tested against a Python framework called Stackless.framework) Depends on macholib TODO: analyze packages to see if they have necessary data files (that have to be included whole, or at least not zipimport) zipimport toggle warn user and fallback to --semi-standalone when trying to --standalone a /System python GUI TODO (but YAGNI for me, so don't hold your breath): give it toggles to ignore certain kinds of files when making the bundle (think .cvsignore) non-framework python not tested/supported /usr/bin/strip functionality untested, may be broken toggle to turn mach-o header walking off allow user to exclude libs/frameworks make it easy/possible to strip headers/resources for automatically included frameworks documentation (but it exposes the same API and CLI args with few exceptions..) Note that a lot of (but not all of) this crazy header rewriting would be avoided if http://python.org/sf/887242 was adopted.. because most extensions currently link against Python.framework directly and need to be rewritten for --standalone. Also note that it's possible (but not demonstrated) to use macholib to migrate a python extension from one Python to another, but probably not possible to convert an existing bundle to an "-undefined dynamic_lookup" bundle (I have yet to examine an extension linked like this). -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040209/afa2d606/smime.bin From altis at semi-retired.com Mon Feb 9 11:17:11 2004 From: altis at semi-retired.com (Kevin Altis) Date: Mon Feb 9 11:18:12 2004 Subject: [Pythonmac-SIG] Fw: OSCON Reminder: proposal deadline *** TODAY *** Message-ID: Guido said: This is the FINAL reminder: you still have all day today to submit a proposal for the Python 12 Conference at OSCON: The O'Reilly Open Source Convention (OSCON) will be held July 26-30, 2004 at the Portland Marriott Downtown in Portland, OR. http://conferences.oreillynet.com/os2004/ Proposals Submission Information--Deadline: February 9, 2004 http://conferences.oreillynet.com/cs/os2004/create/e_sess --Guido van Rossum (home page: http://www.python.org/~guido/) From Chris.Barker at noaa.gov Mon Feb 9 13:48:21 2004 From: Chris.Barker at noaa.gov (Chris Barker) Date: Mon Feb 9 13:48:42 2004 Subject: [Pythonmac-SIG] Swig_for_Mac In-Reply-To: <06EE9222-5991-11D8-894C-000393C0D100@saysomething.com> References: <06EE9222-5991-11D8-894C-000393C0D100@saysomething.com> Message-ID: <4027D5F5.1030307@noaa.gov> Christopher Smith wrote: > Now I don't know what to do from here. I am having a hard time sifting > out what can/should be done with the Swig_for_Mac and what must be done > at the command line with gcc. One of the pages that I've consulted says > to issue a gcc compile of the example.c and example_wrap.c files. When I > do that I get the following output: > > csmith% gcc -c example.c example_wrap.c -I/usr/local/include/python2.2 > -I/usr/local/include/python2.2 > example_wrap.c:27: header file 'string.h' not found > example_wrap.c:203: header file 'stdlib.h' not found As someone already metntioned, SWIG builds the C wrapper code, but you still have to compile that code like any other extension. I've found it easiest to use distutils to compile my extensions. see: http://www.python.org/doc/current/ext/building.html#building for how to do it. That may not solve your problem, as your missing headers are system ones, not Python ones, but it's may make the rest of your project easier. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From mark.asbach at post.rwth-aachen.de Mon Feb 9 13:51:34 2004 From: mark.asbach at post.rwth-aachen.de (Mark Asbach) Date: Mon Feb 9 13:58:28 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: References: <04Feb6.134950pst.58611@synergy1.parc.xerox.com> Message-ID: Hi Jack, hi Bob, > Bobs method has the disadvantage that dynamic_lookup is inherently > dangerous: all your symbols that were undefined at link time will by > satisfied from any symbol with the same name that happens to be loaded > in the executable loading the module. Well, that's the point in using proper C++ namespaces :-} I don't see a problem here as long as we all take care to not use symbol names that could conflict easily. IF python installations switch over to Bob's method, there should at least be an easy-to-use tool that wraps around otool (this is Mac OS X's counterpart to ldd, right?) and checks the python paths along with user-given modules and applications to make sure there's no conflict. Yours, Mark From bob at redivi.com Mon Feb 9 14:25:38 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 9 14:22:35 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: References: <04Feb6.134950pst.58611@synergy1.parc.xerox.com> Message-ID: On Feb 9, 2004, at 1:51 PM, Mark Asbach wrote: > Hi Jack, hi Bob, > >> Bobs method has the disadvantage that dynamic_lookup is inherently >> dangerous: all your symbols that were undefined at link time will by >> satisfied from any symbol with the same name that happens to be >> loaded in the executable loading the module. > > Well, that's the point in using proper C++ namespaces :-} > > I don't see a problem here as long as we all take care to not use > symbol names that could conflict easily. IF python installations > switch over to Bob's method, there should at least be an easy-to-use > tool that wraps around otool (this is Mac OS X's counterpart to ldd, > right?) and checks the python paths along with user-given modules and > applications to make sure there's no conflict. Here's the thing, -undefined dynamic_lookup means "look up undefined symbols dynamically" it doesn't mean "look up all symbols dynamically". The only symbols that should be undefined in a given extension bundle are symbols from Python.framework and symbols from crt1.o (which should be used indirectly anyways). The only possible problems are: 1) Your bundle is broken, you forgot to link something and have more undefined symbols than you should.. easy to figure out by importing it from the interpreter or linking it with -framework Python instead of -undefined dynamic_lookup. 2) You managed to link something that overrides a symbol in Python.framework and the bundle looks up the wrong one (this is extremely unlikely because everything in Python is PyPrefixed and I think the search order would find Python.framework first, anyway). In short, there are no problems. otool is more than just the 'counterpart to ldd'.. but I don't understand what your easy-to-use wrapper would actually do. Do you mean it wouldn't be hard to cross-reference the symbol table of an extension bundle with Python.framework to see if there is any case #1 happening? That's not hard, but I wouldn't call it a conflict, and it can be checked just by relinking with the current options. BTW: OS X has namespaces for modules, even in C.. this is why special linker flags are desired for the bundle scenario. Ideally we'd have some sort of indirect-framework linker flag, but we don't (maybe in 10.4). It's also extremely unlikely to have bizarre "symbol conflicts" in Python code, because other operating systems do not have two level namespaces for symbols. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040209/61a33621/smime.bin From Chris.Barker at noaa.gov Mon Feb 9 14:59:59 2004 From: Chris.Barker at noaa.gov (Chris Barker) Date: Mon Feb 9 15:00:15 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: References: <04Feb6.134950pst.58611@synergy1.parc.xerox.com> Message-ID: <4027E6BF.6010607@noaa.gov> I'm out of my depth in this discussion, but I really want this all to "Just Work", so I have a question: Which of Bob or Jack's proposals is more like the situation on other Unixes? Optimium or not, Python seems to work just fine there. And I have at least three versions of Python on my Linux box at the moment, and I'm pretty sure I've had different sub-versions in the past. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From janssen at parc.com Mon Feb 9 16:42:24 2004 From: janssen at parc.com (Bill Janssen) Date: Mon Feb 9 16:43:08 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: Your message of "Mon, 09 Feb 2004 11:59:59 PST." <4027E6BF.6010607@noaa.gov> Message-ID: <04Feb9.134233pst."58611"@synergy1.parc.xerox.com> > Which of Bob or Jack's proposals is more like the situation on other > Unixes? Optimium or not, Python seems to work just fine there. That's the situation I'd like us to get back to on MacOS X :-). Bill From bob at redivi.com Mon Feb 9 20:02:56 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 9 19:59:57 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: <04Feb9.134233pst."58611"@synergy1.parc.xerox.com> References: <04Feb9.134233pst."58611"@synergy1.parc.xerox.com> Message-ID: On Feb 9, 2004, at 4:42 PM, Bill Janssen wrote: >> Which of Bob or Jack's proposals is more like the situation on other >> Unixes? Optimium or not, Python seems to work just fine there. > > That's the situation I'd like us to get back to on MacOS X :-). Mac OS X is not UNIX! Anyway, my proposal is more like UNIX. To be REALLY like unix, you would use a flat namespace and undefined suppress, but I'm very much against that. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040209/7fe5818c/smime.bin From bob at redivi.com Mon Feb 9 20:16:47 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 9 20:13:42 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: References: <04Feb6.134950pst.58611@synergy1.parc.xerox.com> Message-ID: On Feb 9, 2004, at 2:40 PM, Mark Asbach wrote: >> otool is more than just the 'counterpart to ldd'.. but I don't >> understand what your easy-to-use wrapper would actually do. Do you >> mean it wouldn't be hard to cross-reference the symbol table of an >> extension bundle with Python.framework to see if there is any case #1 >> happening? That's not hard, but I wouldn't call it a conflict, and >> it can be checked just by relinking with the current options. > > I just thought, it would be nice to give end-users a chance to > discover duplicate symbol names easily, so they could check if #2 had > happened because of installing a module with "-undefined lookup" and > to other modules with conflicting names. Names don't conflict in this scenario unless you're colliding with symbols from Python.framework itself. There are no other possible cases (assuming you're doing things correctly otherwise). >> 2) You managed to link something that overrides a symbol in >> Python.framework and the bundle looks up the wrong one (this is >> extremely unlikely because everything in Python is PyPrefixed and I >> think the search order would find Python.framework first, anyway). > > Wouldn't "-undefined lookup" also make other dependencies remain > unresolved at static link time? Say, you have three modules named A, B > and C. A and B have duplicate symbol names, C depends on A and was > linked with "-undefined lookup". Couldn't it happen that C will be > linked to B's symbols erroneously? No. When you link to a module, you only get its symbols, not the symbols it uses from other modules. If you are module C and you link to A, you only see symbols that were defined originally in A (except in umbrellas, but I won't get into that). >> BTW: OS X has namespaces for modules, even in C > > Ah, that's the two-level namespace thing?!? If have to admit, that OS > X is still a deep black box to me in some respects ... Yes, there is a namespace for every file that you link to. >> It's also extremely unlikely to have bizarre "symbol conflicts" in >> Python code, because other operating systems do not have two level >> namespaces for symbols. > > But on other OSes you won't link with "-undefined lookup", but have an > RPATH set, right? We're not talking about other OSes. These linker flags don't even exist elsewhere.. and it's "-undefined dynamic_lookup" -bob P.S. To anyone who has the spare time, please read the man pages for dyld and ld and become familiar with otool and install_name_tool as well as their man pages. Apple has additional documentation in HTML as well that may also be of use. If you don't read the man pages, you probably won't understand this system and the tools. I do my best to convey what's needed, but I'm not a technical writer. Remember, this is an entirely different dynamic linking system than linux/bsd or win32, so don't assume you know anything about it... I can't stress that enough. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040209/9c47e2c0/smime-0001.bin From mdehoon at ims.u-tokyo.ac.jp Tue Feb 10 03:37:29 2004 From: mdehoon at ims.u-tokyo.ac.jp (Michiel Jan Laurens de Hoon) Date: Tue Feb 10 03:38:23 2004 Subject: [Pythonmac-SIG] Opening a Cocoa window from a Python C extension Message-ID: <40289849.2020808@ims.u-tokyo.ac.jp> I am porting PyGist (a scientific plotting package for Python, mainly written in C) to Mac OS X. PyGist was originally written for Linux/Unix machines and was recently ported to Windows. For the Mac OS X port, I am using Cocoa to create the graphics windows and calls to CoreGraphics for the actual drawing. The graphics work fine, but there is still a problem with Cocoa windows created from a Python C extension module. I create my window with window = [ [NSWindow alloc] initWithContentRect: rect styleMask: style backing: NSBackingStoreBuffered defer: NO]; and try to show the window with [window orderFront: nil]; The window is displayed and everything seems to be working fine; graphics are also drawn correctly. The window becomes the key window if I click in it, however the previous key window also stays key, so I end up with two key windows at the same time. In addition, cursor events are not handled correctly (which I need for zooming and reading out coordinate values). I wrote a little test program to find out what is happening. It turns out that the test program works correctly if it is located in a directory test.app/Contents/MacOS/test. However, if I move the "test" program to a different directory it shows the same problem as a window created in the Python C extension, even though the test.app directory is otherwise empty. The problem may therefore be that the window that I am trying to open should be somehow linked to the Terminal.app from which I am running Python in order for it to be recognized as a bona fide window. Does anybody know the right way to do this? Many thanks in advance, Michiel de Hoon, U Tokyo. From bob at redivi.com Tue Feb 10 08:22:25 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 10 08:19:21 2004 Subject: [Pythonmac-SIG] Opening a Cocoa window from a Python C extension In-Reply-To: <40289849.2020808@ims.u-tokyo.ac.jp> References: <40289849.2020808@ims.u-tokyo.ac.jp> Message-ID: <2AD2F1D2-5BCC-11D8-BF45-000A95686CD8@redivi.com> On Feb 10, 2004, at 3:37 AM, Michiel Jan Laurens de Hoon wrote: > I am porting PyGist (a scientific plotting package for Python, mainly > written in C) to Mac OS X. PyGist was originally written for > Linux/Unix machines and was recently ported to Windows. For the Mac OS > X port, I am using Cocoa to create the graphics windows and calls to > CoreGraphics for the actual drawing. The graphics work fine, but there > is still a problem with Cocoa windows created from a Python C > extension module. > > I create my window with > > window = [ [NSWindow alloc] > initWithContentRect: rect > styleMask: style > backing: NSBackingStoreBuffered > defer: NO]; > > and try to show the window with > > [window orderFront: nil]; > > The window is displayed and everything seems to be working fine; > graphics are also drawn correctly. The window becomes the key window > if I click in it, however the previous key window also stays key, so I > end up with two key windows at the same time. In addition, cursor > events are not handled correctly (which I need for zooming and reading > out coordinate values). > > I wrote a little test program to find out what is happening. It turns > out that the test program works correctly if it is located in a > directory test.app/Contents/MacOS/test. However, if I move the "test" > program to a different directory it shows the same problem as a window > created in the Python C extension, even though the test.app directory > is otherwise empty. > > The problem may therefore be that the window that I am trying to open > should be somehow linked to the Terminal.app from which I am running > Python in order for it to be recognized as a bona fide window. Does > anybody know the right way to do this? Applications in OS X *must* be run from a bundle. Run your script with pythonw, build a bundle yourself (as you did), or use bundlebuilder. See http://pythonmac.org/wiki/FAQ . It has absolutely nothing to do with Terminal.app. You may also want to consider using PyObjC instead of writing ObjC code. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040210/4cc6a344/smime.bin From Jack.Jansen at cwi.nl Tue Feb 10 08:34:41 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Tue Feb 10 08:34:46 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: References: <04Feb6.134950pst.58611@synergy1.parc.xerox.com> Message-ID: On 9-feb-04, at 20:25, Bob Ippolito wrote: > 1) Your bundle is broken, you forgot to link something and have more > undefined symbols than you should.. easy to figure out by importing it > from the interpreter or linking it with -framework Python instead of > -undefined dynamic_lookup. This is the situation I'm worried about (and the same goes for Ronald, I think). You forget to link against a library at build time, and because you're using -undefined dynamic_lookup you are not getting any errors. Only at runtime will you suddenly get the error. To answer the questions of Bill and Chris: the situation with Bob's mods is very similar to the situation on other unixen. However, I think that dynamic linking is one of the areas where both MacOS (8 and later) and even Windows have a much better design than Unix: the binding from undefined symbols to specific symbols defined in specific libraries is done at link time. But, as they say, practicality beats purity... -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From bob at redivi.com Tue Feb 10 09:02:28 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 10 08:59:24 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: References: <04Feb6.134950pst.58611@synergy1.parc.xerox.com> Message-ID: On Feb 10, 2004, at 8:34 AM, Jack Jansen wrote: > > On 9-feb-04, at 20:25, Bob Ippolito wrote: >> 1) Your bundle is broken, you forgot to link something and have more >> undefined symbols than you should.. easy to figure out by importing >> it from the interpreter or linking it with -framework Python instead >> of -undefined dynamic_lookup. > > This is the situation I'm worried about (and the same goes for Ronald, > I think). You forget to link against a library at build time, and > because you're using -undefined dynamic_lookup you are not getting any > errors. Only at runtime will you suddenly get the error. > > To answer the questions of Bill and Chris: the situation with Bob's > mods is very similar to the situation on other unixen. However, I > think that dynamic linking is one of the areas where both MacOS (8 and > later) and even Windows have a much better design than Unix: the > binding from undefined symbols to specific symbols defined in specific > libraries is done at link time. > > But, as they say, practicality beats purity... We know how to check for those errors.. import the module, or link with -framework Python instead of -undefined dynamic_lookup. I'd just rather not see the latter be the deployment linking options! Besides, you need to worry about those errors on other platforms anyhow. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040210/a17c8f22/smime.bin From Chris.Barker at noaa.gov Tue Feb 10 14:51:49 2004 From: Chris.Barker at noaa.gov (Chris Barker) Date: Tue Feb 10 14:52:59 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: References: <04Feb6.134950pst.58611@synergy1.parc.xerox.com> Message-ID: <40293655.8030905@noaa.gov> Bob Ippolito wrote: > Mac OS X is not UNIX! yes, it is. It's not Linux, or FreeBSD, or Solarus, etc, but it is certainly a *nix. > Anyway, my proposal is more like UNIX. > > To be REALLY like unix, you would use a flat namespace and undefined > suppress, but I'm very much against that. Apple does seem to have made some real improvments with name spaces, bundles, etc. and I'm all for using them. I think were problems arise most is with apps ported from other Unixes--the two approaches don't seem to mix well. And Apple doing a half-assed job of providing Python doesn't help. Why in world is no one from Apple taking part in this discussion? Someone who really knows the system might have a better idea than any of us the best way to do it. > Besides, you need > to worry about those errors on other platforms anyhow. That was my point... Like it or not, there are a LOT of python extensions that were made to work on other Unixes...it would be great if they worked on OS-X without the user having to do anything. I can't add much to this discusion, because I havn't built anything complicated on ANY platform without someone else's Makefile or build system. That's why I like distutils so much...I dont need to know anything about all this...it just works (at least on Linux). -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From bob at redivi.com Tue Feb 10 17:54:42 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 10 17:51:49 2004 Subject: [Pythonmac-SIG] Upgrading /usr/bin/python to 2.3.1? In-Reply-To: <40293655.8030905@noaa.gov> References: <04Feb6.134950pst.58611@synergy1.parc.xerox.com> <40293655.8030905@noaa.gov> Message-ID: <1D164B2D-5C1C-11D8-8A2B-000A95686CD8@redivi.com> On Feb 10, 2004, at 2:51 PM, Chris Barker wrote: > Bob Ippolito wrote: >> Mac OS X is not UNIX! > > yes, it is. It's not Linux, or FreeBSD, or Solarus, etc, but it is > certainly a *nix. The linker is nothing like any other *nix linker (unless you're talking about NeXT), and that's what we're talking about. >> Anyway, my proposal is more like UNIX. >> To be REALLY like unix, you would use a flat namespace and undefined >> suppress, but I'm very much against that. > > Apple does seem to have made some real improvments with name spaces, > bundles, etc. and I'm all for using them. I think were problems arise > most is with apps ported from other Unixes--the two approaches don't > seem to mix well. And Apple doing a half-assed job of providing Python > doesn't help. Why in world is no one from Apple taking part in this > discussion? Someone who really knows the system might have a better > idea than any of us the best way to do it. You can't really blame Apple for not donating developer resources to a programming language that they didn't even use (anywhere in the OS, at least) until OS X 10.3. It's really our fault that Python isn't perfect on OS X. It is somewhat Apple's fault that they don't do minor version updates of Python, but I don't really blame them for that either (for the same reasons). If we fix Python, and get more users, Apple will have a good reason to help us. Right now, they don't. >> Besides, you need to worry about those errors on other platforms >> anyhow. > > That was my point... Like it or not, there are a LOT of python > extensions that were made to work on other Unixes...it would be great > if they worked on OS-X without the user having to do anything. The user doesn't do anything, it's the extension developer who ensures that they are using distutils properly such that it will deploy to any OS. If a standardish extension doesn't build on OS X, then it's probably the developer's fault for not using distutils properly. > I can't add much to this discusion, because I havn't built anything > complicated on ANY platform without someone else's Makefile or build > system. That's why I like distutils so much...I dont need to know > anything about all this...it just works (at least on Linux). Distutils does pretty much just work on OS X.. however, it's not entirely OS X-ified because nobody wants to write and maintain a big distutils patch for OS X. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040210/f911f993/smime.bin From claird at lairds.com Wed Feb 11 13:21:25 2004 From: claird at lairds.com (Cameron Laird) Date: Wed Feb 11 13:21:32 2004 Subject: [Pythonmac-SIG] Publicity opportunity Message-ID: I'll be writing about Python's utility for system administrators several times over the next year (and beyond?) for the US *System Administration* magazine . I'd welcome stories/content/collaborators/... that have to do with MacOS X system administration. Cameron Laird +1 281 996 8546 FAX http://phaseit.net/claird/misc.writing/publications.html From robin at reportlab.com Thu Feb 12 09:39:43 2004 From: robin at reportlab.com (Robin Becker) Date: Thu Feb 12 09:40:51 2004 Subject: [Pythonmac-SIG] Interpreting a crash dump? Message-ID: A 10.2 client has crashes using our dylib packaged python application. The dylib was built using the traditional configure make dance starting with a standard Python 2.2.2 tgz, then freeze was hacked to make the output a dylib rather than an executable. The client is suggesting a mismatch between the quark version of strncpy and the one that python wants to use. The following strategies are suggested 1) build the app as a static library. 2) build the dylib with all dependencies statically linked. 3) Build the application as a normal python embedding dll (ie make use of the standard OS X Python (presumably now based on 2.3). I assume that both 1) and 2) are feasible, but am a bit unsure how using standard python will help to alter the way in which stuff gets linked together. I'm not a mach expert, but is there a way to get my dylib to link to the 'correct' strncpy etc etc? ********************** CRASH TRACE **************************** Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000005 Thread 0 Crashed: 0 com.quark.QuarkXPress 0x00528158 strncpy + 0x10 1 lib_rl_embed.dylib 0x0822b848 inittime + 0x150 (timemodule.c:664) 2 lib_rl_embed.dylib 0x08216050 init_builtin + 0x21c (import.c:1464) 3 lib_rl_embed.dylib 0x08215d28 load_module + 0x238 (import.c:1402) 4 lib_rl_embed.dylib 0x08216c5c import_submodule + 0x170 (import.c:1910) 5 lib_rl_embed.dylib 0x0821673c load_next + 0x148 (import.c:1771) 6 lib_rl_embed.dylib 0x082184c0 import_module_ex + 0x5c (import.c:1618) -- Robin Becker From mdehoon at ims.u-tokyo.ac.jp Thu Feb 12 08:41:33 2004 From: mdehoon at ims.u-tokyo.ac.jp (Michiel Jan Laurens de Hoon) Date: Thu Feb 12 09:46:36 2004 Subject: [Pythonmac-SIG] Opening a Cocoa window from a Python C extension In-Reply-To: <2AD2F1D2-5BCC-11D8-BF45-000A95686CD8@redivi.com> References: <40289849.2020808@ims.u-tokyo.ac.jp> <2AD2F1D2-5BCC-11D8-BF45-000A95686CD8@redivi.com> Message-ID: <402B828D.70702@ims.u-tokyo.ac.jp> Wow I got it to work by using pythonw. Actually I had tried pythonw before but I didn't get it to work correctly at that time (probably has to do with readline support). After reinstalling python from the source using configure --enable-framework and with readline support, pythonw works correctly. My windows behave as they should and also I don't have problems with setting the cursor any more. Thanks Bob! I will continue working on porting Pygist to Mac OS X, and I'll post a message here once it is available. Thanks again, --Michiel. >> I am porting PyGist (a scientific plotting package for Python, mainly >> written in C) to Mac OS X. PyGist was originally written for >> Linux/Unix machines and was recently ported to Windows. For the Mac OS >> X port, I am using Cocoa to create the graphics windows and calls to >> CoreGraphics for the actual drawing. The graphics work fine, but there >> is still a problem with Cocoa windows created from a Python C >> extension module. > > Applications in OS X *must* be run from a bundle. Run your script with > pythonw, build a bundle yourself (as you did), or use bundlebuilder. > See http://pythonmac.org/wiki/FAQ . It has absolutely nothing to do > with Terminal.app. > > You may also want to consider using PyObjC instead of writing ObjC code. > > -bob -- Michiel de Hoon, Assistant Professor University of Tokyo, Institute of Medical Science Human Genome Center 4-6-1 Shirokane-dai, Minato-ku Tokyo 108-8639 Japan http://bonsai.ims.u-tokyo.ac.jp/~mdehoon From kranki2 at earthlink.net Thu Feb 12 10:37:40 2004 From: kranki2 at earthlink.net (Robert White) Date: Thu Feb 12 10:37:52 2004 Subject: [Pythonmac-SIG] Make a dmg file from files/directories for Panther Message-ID: <6490B816-5D71-11D8-9ECE-000A95A94FC8@earthlink.net> I have developed the following script to create a dmg file from files/directories indicated. The script runs only in Panther and I test for that. I am enclosing it for your comments. I am relatively new to MacOSX and Python so this is a good way for me to learn. If this is not the proper way to get code reviewed, then I apoligize now, but please indicate that to me and a better way of doing it. Thanks for your help. Feel free to use the script for whatever purposes you like if you find it helpful. -----Script------ #!/usr/bin/env python """mkdmg.py -- Copy files to a .dmg file This copies the specified files and directories to a newly created compressed DMG file for Mac OS X 10.3 and above. !!! USE AT YOUR OWN RISK !!! """ __version__ = 1.0 __license__ = "none" ###################################################################### # Imports ###################################################################### import os import sys import datetime import glob import fnmatch import shutil import string import copy import getopt import commands import optparse import tempfile import time import rmwCommon if sys.platform == 'darwin': import Carbon import macostools ###################################################################### # Global Data ###################################################################### fDebug = 0 fSkip = 0 ###################################################################### # dmgFS Class ###################################################################### class dmgFS: """A class for a Sparse Disk Image (dmg) for Mac OS X. This is intended to create a OS X Disk Image File (with extension .dmg) containing archives of arbitrary files. """ def __del__( self ): "Delete the object." if fDebug: print "dmgFS::del()" # Unmount it if necessary. if self.fMounted: self.detachSparseImage( ) self.fMounted = 0 # Delete it if it shows being created. if self.fCreated: self.destroySparseImage( ) self.fCreated = 0 def __init__( self, szArchive="mkdmg" ): "Initialize the object." if fDebug: print "dmgFS::init(%s)" % ( szArchive ) # setup Temporary dmg file. # self.szTempDir = tempfile.gettempdir( ) self.szTempDir = "$HOME/Desktop" self.szTempFile = szArchive self.szTempPath = os.path.join( self.szTempDir, (self.szTempFile + ".dmg") ) self.szTempPath = os.path.normpath( self.szTempPath ) if fDebug: print "\tszTempPath=\"%s\"" % ( self.szTempPath ) self.szSparsePath = os.path.join( self.szTempDir, (szArchive + ".dmg.sparseimage") ) self.szSparsePath = os.path.normpath( self.szSparsePath ) if fDebug: print "\tszSparsePath=\"%s\"" % ( self.szSparsePath ) oDT = datetime.datetime.utcnow( ) szDT = oDT.isoformat( ' ' ) szWrk = "-" + szDT[0:4] + szDT[5:7] + szDT[8:10] szWrk = szWrk + szDT[11:13] + szDT[14:16] + szDT[17:19] szWrk = szWrk + "-z.dmg" self.szFinalPath = os.path.join( self.szTempDir, (szArchive + szWrk) ) self.szFinalPath = os.path.normpath( self.szFinalPath ) if fDebug: print "\tszFinalPath=\"%s\"" % ( self.szFinalPath ) # variables set later self.listPaths = [ ] self.fCreated = 0 self.fMounted = 0 self.iSizeK = 0 def addPath( self, szPath ): "Add a Path to the Sparse Image." if fDebug: print "addPath(%s)" % ( szPath ) szWork = os.path.normpath( szPath ) szWork = os.path.expanduser( szWork ) szWork = os.path.expandvars( szWork ) szWork = os.path.abspath( szWork ) if fDebug: print "\tabs.path=", szWork # Figure out the source name. if os.path.exists( szWork ): pass else: if fDebug: print "\tfSkip =", fSkip if fSkip: return print "ERROR - %s does not exist to be copied!" % ( szPath ) raise ValueError # iSize = os.path.getsize( szWork ) oDS = rmwCommon.DirectorySize( szWork ) iSizeK = (oDS.size() + 1024 - 1) / 1024 if fDebug: print "\tos.path.size =", iSizeK if os.path.isdir( szWork ): if szWork[-1] == "/": szWork = szWork[:-2] if fDebug: print "\tDirectory = %s" % ( szWork ) elif os.path.isfile( szWork ): if fDebug: print "\tFile = %s" % ( szWork ) else: print "ERROR - %s is not a directory or file!" % ( szPath ) raise ValueError self.iSizeK += iSizeK self.listPaths.append( szWork ) def attachSparseImage( self ): "Attach the Sparse Image." if fDebug: print "attachSparseImage()" szCmdA = "hdiutil attach %s" % ( self.szSparsePath ) szCmdB = " 2>/dev/null >/dev/null" szCmd = szCmdA + szCmdB szCmd = szCmdA if fDebug: print "\tExecuting %s..." % ( szCmd ) tupleResult = commands.getstatusoutput( szCmd ) if fDebug: print "\tResult = %s, %s..." % ( tupleResult[0], tupleResult[1] ) if tupleResult[0] == 0: self.fMounted = 1 else: print "ERROR - Could not mount %s." % ( self.szSparsePath ) raise OSError listWork = tupleResult[1].split() if fDebug: print "\tlistWork = ", listWork self.szDevice = listWork[4] if fDebug: print "\tszDevice = ", self.szDevice self.szVolume = listWork[10] if fDebug: print "\tszVolume = ", self.szVolume return 0 def compressSparseImage( self ): "Compress the Sparse Image." if fDebug: print "compressSparseImage()" szCmdA = "hdiutil convert \"%s\" -format UDZO" % ( self.szSparsePath ) szCmdB = " -o \"%s\" -imagekey zlib-devel=9" % ( self.szFinalPath ) szCmdC = " 2>/dev/null >/dev/null" szCmd = szCmdA + szCmdB + szCmdC szCmd = szCmdA + szCmdB if fDebug: print "\tExecuting %s..." % ( szCmd ) tupleResult = commands.getstatusoutput( szCmd ) if fDebug: print "\tResult = %s, %s..." % ( tupleResult[0], tupleResult[1] ) if tupleResult[0] == 0: pass else: print "ERROR - Could not compress SparseImage!" raise OSError def copyPaths( self ): "Copy Paths to the Sparse Image." if fDebug: print "copyPaths( )" if self.fMounted: pass else: print "ERROR - SparseImage is not mounted!" raise OSError # Copy all the paths. for szPath in self.listPaths: self.copyPathToSparseImage( szPath ) def copyPathToSparseImage( self, szPath ): "Copy a Path to the Sparse Image." if fDebug: print "copyPathToSparseImage(%s)" % ( szPath ) if self.fMounted: pass else: print "ERROR - SparseImage is not mounted!" raise OSError # Figure out the source name. if os.path.exists( szPath ): pass else: print "ERROR - %s does not exist to be copied!" % ( szPath ) raise NameError if fDebug: print "\tos.path.size =", os.path.getsize( szPath ) if os.path.isdir( szPath ): if szPath[-1] == "/": szPath = szPath[:-2] if fDebug: print "\tDirectory = %s" % ( szPath ) szSrc = szPath szDest = os.path.join( self.szVolume, os.path.split( szPath )[1] ) elif os.path.isfile( szPath ): if fDebug: print "\tFile = %s" % ( szPath ) szSrc = szPath szDest = os.path.join( self.szVolume, os.path.split( szPath )[1] ) else: print "ERROR - object, %s, needs to be a file or directory!" % (szPath) raise ValueError # Copy the data to the Sparse Image. szCmdA = "ditto -rsrcFork \"%s\" \"%s\"" % ( szSrc, szDest ) szCmdB = " 2>/dev/null >/dev/null" szCmd = szCmdA + szCmdB szCmd = szCmdA if fDebug: print "\tExecuting %s..." % ( szCmd ) tupleResult = commands.getstatusoutput( szCmd ) if fDebug: print "\tResult = %s, %s..." % ( tupleResult[0], tupleResult[1] ) if tupleResult[0] == 0: pass else: print "ERROR - Copy %s to SparseImage FAILED!" raise OSError def createSparseImage( self ): "Create the Sparse Image." if fDebug: print "createSparseImage(%d)" % ( self.iSizeK ) if self.iSizeK > 0: pass else: print "ERROR - No files or directories to add to dmg!" raise ValueError iSizeM = ((2 * self.iSizeK) + 1024 - 1) / 1024 szCmdA = "hdiutil create \"%s\"" % ( self.szTempPath ) szCmdB = " -volname \"%s\" " % ( self.szTempFile ) szCmdC = " -megabytes %d -type SPARSE -fs HFS+ -autostretch" % ( iSizeM ) szCmdD = " 2>/dev/null >/dev/null" # szCmd = szCmdA + szCmdB + szCmdC + szCmdD szCmd = szCmdA + szCmdB + szCmdC if fDebug: print "\tExecuting %s..." % ( szCmd ) tupleResult = commands.getstatusoutput( szCmd ) if fDebug: print "\tResult = %s, %s..." % ( tupleResult[0], tupleResult[1] ) if tupleResult[0] == 0: self.fCreated = 1 else: print "ERROR - Could not create SparseImage!" raise OSError def destroySparseImage( self ): "Destroy the Sparse Image." if fDebug: print "destroySparseImage()" if self.fCreated: pass else: print "ERROR - SparseImage does not exist so it cant be destroyed!" raise StandardError # Cant destroy it if it is mounted. if self.fMounted: print "ERROR - Tried to destroy mounted SparseImage!" raise StandardError # Remove the file. szCmd = "rm \"%s\"" % ( self.szSparsePath ) if fDebug: print "\tExecuting %s..." % ( szCmd ) tupleResult = commands.getstatusoutput( szCmd ) if fDebug: print "\tResult = %s, %s..." % ( tupleResult[0], tupleResult[1] ) if tupleResult[0] == 0: self.fCreated = 0 else: print "ERROR - Could not destroy SparseImage!" raise OSError def detachSparseImage( self ): "Detach the Sparse Image." if fDebug: print "detachSparseImage()" if self.fMounted: pass else: print "ERROR - SparseImage is not mounted!" raise StandardError szCmdA = "hdiutil detach -debug -verbose %s" % ( self.szDevice ) szCmdB = " 2>/dev/null >/dev/null" szCmd = szCmdA + szCmdB szCmd = szCmdA # Unfortunately, the previous operations against the dmg are somewhat # queued w/o a means of knowing when they are done. So, we will wait # for successful completion of the detach for a specified period of # 10 mins (arbitrarily chosen) before aborting the detach. for i in range( 60 ): cWait = 10 if fDebug: print "\tWaiting for %d seconds..." % (cWait) time.sleep( cWait ) if fDebug: print "\tExecuting %s..." % ( szCmd ) tupleResult = commands.getstatusoutput( szCmd ) if fDebug: print "\tResult = %s, %s..." % ( tupleResult[0], tupleResult[1] ) if tupleResult[0] == 0: break if tupleResult[0] == 0: self.fMounted = 0 else: print "ERROR - Could not unmount SparseImage!" raise OSError def run( self ): "run creating the compressed image." if fDebug: print "run()" self.createSparseImage( ); self.attachSparseImage( ); self.copyPaths( ) self.detachSparseImage( ); self.compressSparseImage( ); ###################################################################### # Command-line interface ###################################################################### def main(): "Command-line interface." global fDebug global fSkip szUsage = "usage: %prog [options] arg1 arg2 ..." oCmdPrs = optparse.OptionParser( usage=szUsage ) oCmdPrs.add_option( "-d", "--debug", action="store_true", dest="fDebug", default=False, help="Set debug mode" ) oCmdPrs.add_option( "-f", "--file", dest="filename", metavar="FILE", help="Read input file with one directory or file per line" ) oCmdPrs.add_option( "-s", "--skip", action="store_true", dest="fSkip", default=False, help="Allow files or directories that don't exist to be skipped" ) (oOptions, oArgs) = oCmdPrs.parse_args( ) if oOptions.fDebug: fDebug = 1 print "In DEBUG Mode..." if oOptions.fSkip: fSkip = 1 print "In File/Directory skip Mode..." if fDebug: print "platform=%s" % sys.platform if oOptions.filename: print "-f name =", oOptions.filename if sys.platform == "darwin": pass else: oCmdPrs.error( "MacOSX 10.3 or above required" ) if len(oArgs) > 0: pass elif oOptions.filename: pass else: oCmdPrs.error( "too few arguments" ) try: oDmg = dmgFS( ) if oOptions.filename: szWork = os.path.normpath( oOptions.filename ) szWork = os.path.expanduser( szWork ) szWork = os.path.expandvars( szWork ) szWork = os.path.abspath( szWork ) if fDebug: print "\tabs.path=", szWork if os.path.exists( szWork ): pass else: print "ERROR - Could not file %s (%s)!" % (oOptions.filename, szWork) raise StandardError fileInput = open( szWork, "r" ) for szLine in fileInput: szLine = szLine.strip( ) if szLine == "": continue if szLine[0] == '#': continue oDmg.addPath( szLine ) for szPath in oArgs: oDmg.addPath( szPath ) oDmg.run( ) finally: oDmg = None if __name__ == "__main__": tupleName = os.uname( ) if tupleName[0] == "Darwin": iRel = tupleName[2].split('.') if iRel[0] > 6: main( ) else: print "Error - mkdmg only works in Darwin 7.0 and above!" exit( 4 ) else: print "Error - mkdmg only works in Darwin 7.0 and above!" exit( 4 ) -----End of Script----- -----Sample --file input file----- # Define the Files/Directories to be backed up. ~/.xchat2 ~/bin ~/Desktop ~/Documents ~/Library/Mail ~/Library/Safari/Bookmarks.plist #~/Movies #~/Music #~/Pictures ~/rmwDPorts ~/rmwHtml ~/rmwLocal ~/rmwTest -----End of Sample input file----- From rjk at phy.auckland.ac.nz Thu Feb 12 14:22:23 2004 From: rjk at phy.auckland.ac.nz (rjk) Date: Thu Feb 12 14:22:32 2004 Subject: [Pythonmac-SIG] Macpython/Tkinter newbie question Message-ID: <5.0.2.1.2.20040213081036.01e38b20@mail.phy.auckland.ac.nz> Hi All, Sorry in advance if this question/bug has already been reported. I am trying to run a python script that uses Tkinter on a Mac that was originally written on a PC. The Mac is running OSX 10.2.3 and MacPython 2.3. I think the problem can be simplified to the following: Script 1 from tkSimpleDialog import askinteger myInt=askinteger('title','prompt') Script 2 from Tkinter import Tk from tkSimpleDialog import askinteger root=Tk() myInt=askinteger('title','prompt') On the PC both scripts invoke the same askinteger dialog, with the first script creating a root Tk window automatically. On the Mac, the first script works as on the PC, but the second script creates a dialog which lacks a title bar and does not render the title. It gets worse when I try to use an 'initialvalue' for the integer on the Mac -- the 'textbox' renders on top of the 'prompt'. Any help would be greatly appreciated. Regards Rob ____________________________________________________________________ Rob Kruhlak HOME: +64 9 446 0070 Applied Optics Centre OFFICE: +64 9 373 7599 x 88868 Physics Department FAX: +64 9 373 7445 University of Auckland E-MAIL: rjk@phy.auckland.ac.nz From jeffrey.dean at stingrayoffice.com Thu Feb 12 14:54:41 2004 From: jeffrey.dean at stingrayoffice.com (Jeffrey Dean) Date: Thu Feb 12 14:54:47 2004 Subject: [Pythonmac-SIG] Beginner's query: Path configuration in OS X 10.3 Message-ID: I'm just getting started, aiming to learn Python for use in scripting FontLab for typeface design. I'm using Lutz & Ascher, _Learning Python_, 2nd edn (O'Reilly 2004), which I'm finding really helpful. But I've hit a snag very close to the beginning. I have no doubt there's an obvious solution to my problem, but I haven't found it yet. I'm running Python 2.3 in Mac OS X 10.3.2 (I've installed Jack's addons for Panther), so Python is located in /System/Library/Frameworks. I can't write files to that directory, so I've put my exercise modules in /Users/Myname/Documents/Python. How the heck do I get Python to look there for modules to import them? Or, alternatively, where should I be saving the files so Python can find them? I've read the documentation about PYTHONPATH and .pth files, but I can't work out how to use them in OS X 10.3. My Unix ability is very rudimentary. TIA, Jeff ---------------------------------------------------------------- Jeffrey Dean The Stingray Office Manchester, England ================================================================ From bob at redivi.com Thu Feb 12 15:13:04 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Feb 12 15:09:57 2004 Subject: [Pythonmac-SIG] Beginner's query: Path configuration in OS X 10.3 In-Reply-To: References: Message-ID: On Feb 12, 2004, at 2:54 PM, Jeffrey Dean wrote: > I'm just getting started, aiming to learn Python for use in scripting > FontLab for typeface design. I'm using Lutz & Ascher, _Learning > Python_, 2nd > edn (O'Reilly 2004), which I'm finding really helpful. But I've hit a > snag > very close to the beginning. I have no doubt there's an obvious > solution to > my problem, but I haven't found it yet. > > I'm running Python 2.3 in Mac OS X 10.3.2 (I've installed Jack's > addons for > Panther), so Python is located in /System/Library/Frameworks. I can't > write > files to that directory, so I've put my exercise modules in > /Users/Myname/Documents/Python. How the heck do I get Python to look > there > for modules to import them? Or, alternatively, where should I be > saving the > files so Python can find them? I've read the documentation about > PYTHONPATH > and .pth files, but I can't work out how to use them in OS X 10.3. My > Unix > ability is very rudimentary. The site-packages in /System/Library/Frameworks/Python.framework is a symlink to /Library/Python/2.3, which should be writable by anyone in the admin group. Python also looks in the Library/Python/2.3/site-packages location inside your home folder, which is definitely writable even if you are not an admin. You don't need .pth files, they are only a convenience that you can use to add additional search locations. You don't need unix ability, they are just plain text files that contain a full unix path to where you would like to search.. you could create them from TextEdit an drop them into either of the two locations that I just mentioned. -bob From Jack.Jansen at cwi.nl Thu Feb 12 15:52:40 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Thu Feb 12 15:52:49 2004 Subject: [Pythonmac-SIG] Interpreting a crash dump? In-Reply-To: References: Message-ID: <65FB1953-5D9D-11D8-8F81-000D934FF6B4@cwi.nl> On 12 Feb 2004, at 15:39, Robin Becker wrote: > A 10.2 client has crashes using our dylib packaged python application. > The dylib was built using the traditional configure make dance starting > with a standard Python 2.2.2 tgz, then freeze was hacked to make the > output a dylib rather than an executable. > > The client is suggesting a mismatch between the quark version of > strncpy > and the one that python wants to use I think the problem may have to do with 2.2 linking with a flat namespace (which was the standard way before OSX 10.2 came out). There is a good chance that switching to 2.3 will make the problem disappear. If that is not an option you could take the two-level namespace support from 2.3 and backport it to 2.2. From Chris.Barker at noaa.gov Thu Feb 12 15:57:47 2004 From: Chris.Barker at noaa.gov (Chris Barker) Date: Thu Feb 12 16:14:46 2004 Subject: [Pythonmac-SIG] Beginner's query: Path configuration in OS X 10.3 In-Reply-To: References: Message-ID: <402BE8CB.5030608@noaa.gov> Bob Ippolito wrote: > On Feb 12, 2004, at 2:54 PM, Jeffrey Dean wrote: >> I'm running Python 2.3 in Mac OS X 10.3.2 How are you running it? > files to that directory, so I've put my exercise modules in >> /Users/Myname/Documents/Python. How the heck do I get Python to look >> there >> for modules to import them? > The site-packages in /System/Library/Frameworks/Python.framework is a > symlink to /Library/Python/2.3, which should be writable by anyone in > the admin group. > > Python also looks in the Library/Python/2.3/site-packages location > inside your home folder As the names indicate, those are good places to put what might be called a "library" of python modules--ones you want to use use from various other python scripts. For just playing around, learning, and developing new code, you probably want to put the *.py files wherever in your home folder makes sense to you. What you want to do is make the "working directory", the same as the one you are , well, working in. Python will look in the working directory for modules. I generally run python from the command line in Terminal, so I first cd to the directory my files are in, then run python. (I found a nifty script on the web that puts a button on the finder that will launch a terminal in the directory currently selected, which makes this easy) If you're using the IDE, I'm pretty sure there is a way to set the working directory, but I don't recall what it is at the moment. I abandoned the IDE as soon as OS-X gave me a command line. You can also set the working directory from within Python with: os.chdir(path) I'm kind of a Linux geek, but this seems like the logical way to do things to me. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From jeffrey.dean at stingrayoffice.com Thu Feb 12 17:04:48 2004 From: jeffrey.dean at stingrayoffice.com (Jeffrey Dean) Date: Thu Feb 12 17:18:20 2004 Subject: [Pythonmac-SIG] Beginner's query: Path configuration in OS X 10.3 In-Reply-To: Message-ID: Thanks to Bob Ippolito and Louis Pecora for their helpful replies. Unfortunately Bob's advice is only partly correct for my system, and Louis's doesn't work at all (the only Environment.plist file I can find is in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Framewor ks/LangAnalysis.framework/Versions/A/Support/JapaneseAnalysisPlugIn.bundle[/ Contents/Resources/Environment.plist] -- I don't THINK this is the file Louis was advising me to update). Bob wrote: > The site-packages in /System/Library/Frameworks/Python.framework is a > symlink to /Library/Python/2.3, which should be writable by anyone in > the admin group. This works great. (I note that the README file here says, "This directory exists so that 3rd party packages can be installed here. Read the source for site.py for more details." I haven't done this yet.) But Bob went on: > Python also looks in the Library/Python/2.3/site-packages location > inside your home folder, which is definitely writable even if you are > not an admin. This doesn't work for me. Further, within the Library/Python folder I found one entitled "IDE-Scripts", with a null file inside entitled "Place your scripts here...", which looked really promising, but it didn't help either. This folder, incidentally, was the only thing visible within the /Users/Myname/Library/Python folder. I created subfolders "2.3" and "site-packages" to try to follow Bob's advice. Perhaps I did this wrongly. FWIW, this is what I get from sys.path (which only works from within PythonIDE and not from the Terminal when running Python): ['/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources', '/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/IDE', '/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat -darwin', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat -mac', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat -mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib- tk', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib- dynload', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site -packages'] When I placed my scripts in /Library/Python/2.3 as Bob suggested, the identification line in the output of the reload call was: I'm a little confused as to how this agrees with where I can see the files really are, but I'm satisfied that it doesn't really matter. ---------------------------------------------------------------- Jeffrey Dean The Stingray Office Manchester, England ================================================================ From Jack.Jansen at cwi.nl Thu Feb 12 17:28:01 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Thu Feb 12 17:28:04 2004 Subject: [Pythonmac-SIG] Beginner's query: Path configuration in OS X 10.3 In-Reply-To: References: Message-ID: On 12 Feb 2004, at 23:04, Jeffrey Dean wrote: > This doesn't work for me. Further, within the Library/Python folder I > found > one entitled "IDE-Scripts", with a null file inside entitled "Place > your > scripts here...", which looked really promising, but it didn't help > either. > This folder, incidentally, was the only thing visible within the > /Users/Myname/Library/Python folder. I created subfolders "2.3" and > "site-packages" to try to follow Bob's advice. Perhaps I did this > wrongly. No, this is what you should have done.... I don't understand why it didn't work, are you sure you didn't have any typos? Or, to recap, the full name of the folder should be "/Users/Myname/Library/Python/2.3/site-packages". > > FWIW, this is what I get from sys.path (which only works from within > PythonIDE and not from the Terminal when running Python): > > ['/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources', > '/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/ > IDE', > '/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources', > '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python23.zip', > '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3', > '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/plat > -darwin', > '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/plat > -mac', > '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/plat > -mac/lib-scriptpackages', > '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/lib- > tk', > '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/lib- > dynload', > '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/site > -packages'] Mine has '/Users/jack/Library/Python/2.3/site-packages' appended at the very end... > > When I placed my scripts in /Library/Python/2.3 as Bob suggested, the > identification line in the output of the reload call was: > > '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/site > -packages/script4.py'> That's because of the symlink. Python thinks that site-packages is at the "normal" location of System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/ site-packages, it is unaware of the symlink to /Library/Python/2.3. So, it's nothing to worry about. From rowen at cesmail.net Thu Feb 12 17:51:25 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Thu Feb 12 17:51:30 2004 Subject: [Pythonmac-SIG] Re: Macpython/Tkinter newbie question References: <5.0.2.1.2.20040213081036.01e38b20@mail.phy.auckland.ac.nz> Message-ID: In article <5.0.2.1.2.20040213081036.01e38b20@mail.phy.auckland.ac.nz>, rjk wrote: > Hi All, > > Sorry in advance if this question/bug has already been reported. > > I am trying to run a python script that uses Tkinter on a Mac that was > originally written on a PC. The Mac is running OSX 10.2.3 and MacPython 2.3. > > I think the problem can be simplified to the following: >... > from Tkinter import Tk > from tkSimpleDialog import askinteger > root=Tk() > myInt=askinteger('title','prompt') > >...creates a dialog which lacks a title bar and does not render the title. It gets worse when I try to use an 'initialvalue' for the integer on the Mac -- the 'textbox' renders on top of the 'prompt'. I can confirm this on my MacOS X 10.3.2 box. I have no explanation, however. I also tested this using Python 2.3.3 built to use X11 (again on MacOS X 10.3.2). That worked just fine. Finally, I compared the two versions of tkSimpleDialog.py (for 2.3 as installed in the built-in Python and for 2.3.3) and found no differences. So the bug is either elsewhere (but I can't imagine where), or (surely not likely?) the version of tkSimpleDialog being used by the Framework python doesn't properly match the text version. If you are OK using X11 instead of Aqua, it's a quite reasonable way to go. (Contact me if you want instructions). Also if you really are running 10.2.x then you could build a new Framework python 2.3.3 by building from source. Don't try this on 10.3.x, however, as it collides in some way with the built in Python. -- Russell From rowen at cesmail.net Thu Feb 12 17:56:44 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Thu Feb 12 17:56:49 2004 Subject: [Pythonmac-SIG] Re: Beginner's query: Path configuration in OS X 10.3 References: Message-ID: In article , Jeffrey Dean wrote: > I'm just getting started, aiming to learn Python for use in scripting > FontLab for typeface design. I'm using Lutz & Ascher, _Learning Python_, 2nd > edn (O'Reilly 2004), which I'm finding really helpful. But I've hit a snag > very close to the beginning. I have no doubt there's an obvious solution to > my problem, but I haven't found it yet. > > I'm running Python 2.3 in Mac OS X 10.3.2 (I've installed Jack's addons for > Panther), so Python is located in /System/Library/Frameworks. I can't write > files to that directory, so I've put my exercise modules in > /Users/Myname/Documents/Python. How the heck do I get Python to look there > for modules to import them? Or, alternatively, where should I be saving the > files so Python can find them? I've read the documentation about PYTHONPATH > and .pth files, but I can't work out how to use them in OS X 10.3. My Unix > ability is very rudimentary. Putting the files in a location that is already searched, as already suggested, is the easiest thing to do (though please clear out experimental files when you're done!). You can also set the environment variable PYTHONPATH to point to additional locations. For simple command-line use only, you can edit a suitable login config file (e.g. .cshrc). But if you want this path to be seen by BBedit (i.e. for running Python scripts from within BBEdit) and other such apps, set it in ~/.MacOS/environment.plist, as described here: -- Russell From rowen at cesmail.net Thu Feb 12 19:15:37 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Thu Feb 12 19:16:01 2004 Subject: [Pythonmac-SIG] bundlebuilder tutorial available Message-ID: I have made a tutorial for bundlebuilder available at . It does not mention Bob Ippolito's nifty-sounding bundlebuilder2 preview as I wasn't sure how widely that should be advertised. Comments and corrections welcome, as always. I could try to put this on the FAQ wiki if folks think it worthwhile. Also, my instructions for installing Tkinter have been updated. They now include instructions for Aqua Tkinter--nearly trivial, of course--and also for X11 Tkinter . -- Russell From smithsm at samuelsmith.org Thu Feb 12 19:18:09 2004 From: smithsm at samuelsmith.org (Samuel M. Smith) Date: Thu Feb 12 19:18:22 2004 Subject: [Pythonmac-SIG] time.clock() and profile In-Reply-To: References: Message-ID: <1A237D20-5DBA-11D8-9C92-000A95C4B360@samuelsmith.org> Is time.clock() in the time module broken on Python 2.3 Mac OSX 10.3.2 It seems to give out very slowly changing times. As in minutes to change anything. I ran the profile module on some of my code and all the times came up zeros. From kevin at macosx.com Thu Feb 12 22:58:59 2004 From: kevin at macosx.com (kevin) Date: Thu Feb 12 23:00:04 2004 Subject: [Pythonmac-SIG] Beginner's query: Path configuration in OS X 10.3 Message-ID: seems like a big source of confusion. I always forget this too and am hoping that this makes it into the FAQ as the FAQ seems to be filled with stuff for folks who are powerusers and precious little for folks who are just setting out. It seems that we need super clear entries for: 1. setting python up so that it you can execute scripts form the terminal (setting your path) (both Jag and Panther) 2. setting up python so that it knows where to look for imports (is this now the same thing? or is this setenv PYTHONPATH???) 3. When, why, and how one would need to set the ~/.MacOSX/environment.plist file If i was clear on this and knew how to do it on both Peanut-butter (10.3) & Jelly (10.2), i'd do it.... (-_-), but alas... I know that on 10.2 setting up all my ~/Library/init/tcsh files : aliases.mine completions.mine environment.mine path rc.mine was a bit of an adventure as this was changed in the jump from 10.1 to 10.2, now of course Panther has bash as its shell. It seems like lots of folks are moving over from OS 9, windoze, and other UNIX platforms so maybe this would ease their pain. -kp-- From wfolta at netmail.to Fri Feb 13 00:07:03 2004 From: wfolta at netmail.to (Wayne Folta) Date: Fri Feb 13 00:07:15 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? Message-ID: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> Anyone out there experienced with how Palm hotsync works? With Palm abandoning it's Mac Palm Desktop software, we really need a sync solution. I imagine Apple might fill the void, but based on iSync so far, I'm not confident it will be a palatable solution. An Open Source, Python-based project would be very cool and would allow us to make sure things like Notes get sync'd even though Apple's iSync only currently supports Calendar (iCal) and Addresses (Address Book). Once someone who knows the ins and outs of syncing have written the basic package, others of us could work on other details to expand it. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2363 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040213/1a2aa4df/smime.bin From kranki2 at earthlink.net Fri Feb 13 00:11:10 2004 From: kranki2 at earthlink.net (Robert White) Date: Fri Feb 13 00:11:20 2004 Subject: [Pythonmac-SIG] Setting up Python Path for 10.3 using Bash Message-ID: <093B987F-5DE3-11D8-BD5B-000A95A94FC8@earthlink.net> Enclosed is my "~/.bash_profile" which among other things extends Python Path to look in "~/bin" which can easily be changed to something else. Please let me know if you see anything that I should update. Thanks. Hope this helps. Bob -------- .bash_profile -------------- # .bash_profile for Darwin 7.0 (MacOSX 10.3) # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs if [ -d "/Developer/Tools" ]; then export PATH=$PATH:/Developer/Tools fi if [ -d "/usr/local/bin" ]; then export PATH=$PATH:/usr/local/bin fi if [ -d "/usr/local/mysql/bin" ]; then export PATH="$PATH:/usr/local/mysql/bin" fi # Set up DarwinPorts if it is available. if [ -d "/opt/local" ]; then export CFLAGS="${CFLAGS} -I/opt/local/include" export INFOPATH=/usr/share/info:/opt/local/share/info export LDLAGS="${LDLAGS} -L/opt/local/lib" export MANPATH=/usr/share/man:/usr/local/man:/opt/local/man export PATH="/opt/local/bin:$PATH" fi export PATH="$HOME/bin:$PATH" export BASH_ENV=$HOME/.bashrc export PYTHONPATH=".:$HOME/bin" export CVS_RSH=/usr/bin/ssh if [ "super01" = "$USER" ]; then export CVSROOT="/common01/CvsRepository" else export CVSROOT=":pserver:${USER}@192.168.1.10:/common01/CvsRepository" fi # Set up Fink if it is available. #if [ -f "/sw/bin/init.sh" ]; then # . /sw/bin/init.sh #fi unset USERNAME # ~/bin/Folding1.sh # ~/bin/Folding2.sh -------- end of .bash_profile ------------ From rob at pyrite.org Fri Feb 13 05:34:53 2004 From: rob at pyrite.org (Rob Tillotson) Date: Fri Feb 13 05:43:19 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> (Wayne Folta's message of "Fri, 13 Feb 2004 00:07:03 -0500") References: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> Message-ID: <87d68jp8s2.fsf@mally.pyrite.org> Wayne Folta writes: > Anyone out there experienced with how Palm hotsync works? With Palm > abandoning it's Mac Palm Desktop software, we really need a sync > solution. I imagine Apple might fill the void, but based on iSync so > far, I'm not confident it will be a palatable solution. I have some experience in this area... back in 1999 or so, I had a project called Pyrite, which was aimed at being a python-based Palm sync manager. By the time I abandoned it in early 2000, it had a conoduit framework (using pilot-link for communication), backup and install conduits, and a lot of the infrastructure needed to sync the builtin apps. I gave up because I was spending too much time building infrastructure unrelated to Palm stuff, and getting bogged down... anyway, here are my thoughts on the current situation: The problem with Palm not supporting the Mac goes deeper than just having a desktop interface. The problem is that if Palm doesn't provide at least the HotSync portion of Palm Desktop, *nothing* can talk to the palmtop, not even iSync. It seems highly likely that Palm will be changing the HotSync protocol for Cobalt, especially considering that there have already been changes which render the current Mac HotSync library incapable of talking to some *current* models that run OS5. The problem has, in effect, already started. So, at the bare minimum, communication must be possible. We can only hope that pilot-link manages to become Cobalt-compatible at some point, which would take care of all the low-level stuff on the wire. Pilot-link is portable Unixy code; it works fine on OSX and its library can easily be wrapped in Python (I did a SWIG based wrapper for it long ago). The next issue is the conduit API. Somehow, the sync system has to allow third party conduits to hook into it... and if that is going to work in practice, there has to be exactly one conduit API for third party developers to use. It will be hard enough to convince third parties to support the Mac now that Palm is officially dropping support, but if the replacement for the Palm HotSync manager does not carry the authority of being THE conduit API for Palms and OSX, getting third party support will be close to impossible instead of merely very hard. Ideally, it should not only be the only reasonable choice available, but it should also be endorsed by Apple and/or some existing developers, even if it is only a de facto endorsement like making iSync work with it. Given the need for standardization, I think the best way to go, development-wise, is Objective-C with as much Cocoa-friendliness as possible, conduits as loadable bundles, etc. (The Palm stuff currently is, I believe, a Carbon app with a C++-based API. If we have to reinvent it all, I see no reason not to do it the Cocoa way.) Python would be an excellent language to implement the actual conduits in, though, given an Objective-C framework to work in. Unfortunately, I'm not very optimistic about any of this right now. People have been working on Palm syncing stuff for Unix for years now and there are still a plethora of different conduit/desktop systems out there. There is basically no third party support, and I think a big part of the reason for that is the lack of a single target for developers. Now, the Mac is being dumped into the same boat... I hope that someone can step in with something that will be worthy of use on OSX. (Ideally, I'd like to see Apple do it.) Anyway, I'm currently too annoyed with Palm to even consider working on something like this, but since I have done some of it before I'd be happy to discuss my experiences with anyone trying to start such a project... --Rob -- Rob Tillotson N9MTB From Jack.Jansen at cwi.nl Fri Feb 13 08:02:54 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 13 08:03:10 2004 Subject: [Pythonmac-SIG] time.clock() and profile In-Reply-To: <1A237D20-5DBA-11D8-9C92-000A95C4B360@samuelsmith.org> References: <1A237D20-5DBA-11D8-9C92-000A95C4B360@samuelsmith.org> Message-ID: On 13-feb-04, at 1:18, Samuel M. Smith wrote: > Is time.clock() in the time module broken on Python 2.3 Mac OSX 10.3.2 > > It seems to give out very slowly changing times. As in minutes to > change anything. Note that time.clock() does not return realtime (use time.time() for that), it returns CPU seconds used by the current process. So if you type time.clock(), then do nothing for three days, then type time.clock() again the two values should be almost the same. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Fri Feb 13 08:05:28 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 13 08:05:45 2004 Subject: [Pythonmac-SIG] Beginner's query: Path configuration in OS X 10.3 In-Reply-To: References: Message-ID: <4BDEE730-5E25-11D8-8F64-000A958D1666@cwi.nl> On 13-feb-04, at 4:58, kevin wrote: > seems like a big source of confusion. I always forget this too and am > hoping that this makes it into the FAQ as the FAQ seems to be filled > with stuff for folks who are powerusers and precious little for folks > who are just setting out. Definitely! I'm adding all the questions (and answers) that appear here to the FAQ, but I could definitely use some proofreading. And proofreading by a novice is especially welcome, because I'm definitely going to think some things are obvious, while they may be obvious to me but not to the rest of the world. So please read the FAQ and comment on it, -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From jeffrey.dean at stingrayoffice.com Fri Feb 13 10:31:53 2004 From: jeffrey.dean at stingrayoffice.com (Jeffrey Dean) Date: Fri Feb 13 10:31:56 2004 Subject: [Pythonmac-SIG] Beginner's query: Path configuration in OS X 10.3 In-Reply-To: Message-ID: On 12.02.2004 10:28 pm, "Jack Jansen" wrote: > > On 12 Feb 2004, at 23:04, Jeffrey Dean wrote: >> This doesn't work for me. Further, within the Library/Python folder I >> found >> one entitled "IDE-Scripts", with a null file inside entitled "Place >> your >> scripts here...", which looked really promising, but it didn't help >> either. >> This folder, incidentally, was the only thing visible within the >> /Users/Myname/Library/Python folder. I created subfolders "2.3" and >> "site-packages" to try to follow Bob's advice. Perhaps I did this >> wrongly. > > No, this is what you should have done.... I don't understand why it > didn't work, are you sure you didn't have any typos? Or, to recap, the > full name of the folder should be > "/Users/Myname/Library/Python/2.3/site-packages". This is precisely what I've got. Any advice on how to troubleshoot this? Would Chris Barker's advice on making this my working directory solve this problem and the following discrepancy? >> >> FWIW, this is what I get from sys.path (which only works from within >> PythonIDE and not from the Terminal when running Python): >> >> ['/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources', >> '/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/ >> IDE', >> '/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources', >> '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ >> python23.zip', >> '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ >> python2.3', >> '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ >> python2.3/plat >> -darwin', >> '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ >> python2.3/plat >> -mac', >> '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ >> python2.3/plat >> -mac/lib-scriptpackages', >> '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ >> python2.3/lib- >> tk', >> '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ >> python2.3/lib- >> dynload', >> '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ >> python2.3/site >> -packages'] > > Mine has '/Users/jack/Library/Python/2.3/site-packages' appended at the > very end... > Chris Barker wrote: > I generally run python from the command line in Terminal, so I first cd > to the directory my files are in, then run python. (I found a nifty > script on the web that puts a button on the finder that will launch a > terminal in the directory currently selected, which makes this easy) Can you give me a link to this handy script, or suggest useful search terms? Thanks to all, Jeff ---------------------------------------------------------------- Jeffrey Dean The Stingray Office Manchester, England ================================================================ From hamish.sanderson at virgin.net Fri Feb 13 09:51:22 2004 From: hamish.sanderson at virgin.net (has) Date: Fri Feb 13 10:37:28 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released Message-ID: Hi all, Get it here: http://freespace.virgin.net/hamish.sanderson/appscript.html Note the name change from 'AppScripting' to 'appscript', which is (barring any better suggestions) what I'm going to go with. More an interim release, as there's still a few holes in the foundation to fill; e.g. AEAddressDesc support is still weak, so still no Address Book scripting. The API is pretty much done and dusted though, and the new application terminology handling is a big improvement over the old code. Only thing still bugging me is that Python doesn't have magic methods for overridding 'and', 'or' and 'not' operators directly, as writing test expressions is clumsy without it. (Do you think we should submit a PEP for this?) Feedback welcome. has -- http://freespace.virgin.net/hamish.sanderson/ From skip at pobox.com Fri Feb 13 10:43:17 2004 From: skip at pobox.com (Skip Montanaro) Date: Fri Feb 13 10:43:26 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> References: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> Message-ID: <16428.61589.394305.861056@montanaro.dyndns.org> Wayne> Anyone out there experienced with how Palm hotsync works? With Wayne> Palm abandoning it's Mac Palm Desktop software, we really need a Wayne> sync solution. I imagine Apple might fill the void, but based on Wayne> iSync so far, I'm not confident it will be a palatable solution. There are Python bindings for pilot-link: http://www.pilot-link.org/ Pilot-link is available as part of fink, so it should certainly be portable to Mac OS X. Skip From mwh at python.net Fri Feb 13 10:49:16 2004 From: mwh at python.net (Michael Hudson) Date: Fri Feb 13 10:49:21 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: (has's message of "Fri, 13 Feb 2004 14:51:22 +0000") References: Message-ID: <2mptcj6kub.fsf@starship.python.net> has writes: > Only thing still bugging me is that Python doesn't have magic methods > for overridding 'and', 'or' and 'not' operators directly, as writing > test expressions is clumsy without it. (Do you think we should submit > a PEP for this?) No. They're control flow constructs. What you can do is: 1) override the bitwise operators 2) create a class-or-staticmethod Term.and_(cls,*things) Cheers, mwh -- For every complex problem, there is a solution that is simple, neat, and wrong. -- H. L. Mencken From cpr at emsoftware.com Fri Feb 13 10:55:56 2004 From: cpr at emsoftware.com (Chris Ryland) Date: Fri Feb 13 10:55:33 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: Message-ID: <1BE0C882-5E3D-11D8-A81C-000393DC534A@emsoftware.com> On Friday, February 13, 2004, at 09:51 AM, has wrote: > Only thing still bugging me is that Python doesn't have magic methods > for overridding 'and', 'or' and 'not' operators directly, as writing > test expressions is clumsy without it. (Do you think we should submit > a PEP for this?) Isn't the classical solution to define your datatypes such that and/or/not/etc. are re-mapped as appropriate? That's what some of the relational bindings packages (and some symbolic logic packages) do. Cheers! --Chris Ryland / Em Software, Inc. / www.emsoftware.com From smithsm at samuelsmith.org Fri Feb 13 11:37:22 2004 From: smithsm at samuelsmith.org (Samuel M. Smith) Date: Fri Feb 13 11:37:28 2004 Subject: [Pythonmac-SIG] SO_REUSEADDR not work In-Reply-To: <1A237D20-5DBA-11D8-9C92-000A95C4B360@samuelsmith.org> References: <1A237D20-5DBA-11D8-9C92-000A95C4B360@samuelsmith.org> Message-ID: According to my understanding of the socket library a port can be made reusable or used by another socket with the socket option SO_REUSEADDR however I can't seem to get it to work. here is my test code in file practice.py def TestReuse(host = '', port = 46000): #socket reusable error s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #make socket address reusable s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) ha = (host,port) #bind to Host Address Port s.bind(ha) return s Here is a test >>> import practice >>> s = practice.TestReuse() >>> s >>> t = practice.TestReuse() Traceback (most recent call last): File "", line 1, in ? File "/Users/smithsm/Data/Adept/Products/code/pylon/practice.py", line 370, in TestReuse s.bind(ha) File "", line 1, in bind socket.error: (48, 'Address already in use') >>> s.close() >>> t = practice.TestReuse() >>> t >>> I get a reuse error. If I exit out of python and then restart I do not get the reuse error. If I open another shell and run another copy of python I also get the reuse error. Is this a bug or do I just misunderstand how it is supposed to work. What does exiting python do to opened sockets. From gherman at darwin.in-berlin.de Fri Feb 13 11:52:58 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri Feb 13 11:51:49 2004 Subject: [Pythonmac-SIG] Extracting frames from Quicktime movies? Message-ID: <13C37DA2-5E45-11D8-8D67-00039345C610@darwin.in-berlin.de> Hi, does anybody have a few Python lines of code for extracting a frame from a Quicktime movie? I'm actually only interested in the first frame, but a more general solution would also be nice. Thanks! Dinu -- Dinu C. Gherman - http://python.net/~gherman ...................................................................... "The best way to predict the future is to invent it." (Alan Kay) From smithsm at samuelsmith.org Fri Feb 13 11:59:44 2004 From: smithsm at samuelsmith.org (Samuel M. Smith) Date: Fri Feb 13 11:59:49 2004 Subject: [Pythonmac-SIG] time.clock() and profile In-Reply-To: References: <1A237D20-5DBA-11D8-9C92-000A95C4B360@samuelsmith.org> Message-ID: <057F9D84-5E46-11D8-9C92-000A95C4B360@samuelsmith.org> On Feb 13, 2004, at 06:02, Jack Jansen wrote: >> Is time.clock() in the time module broken on Python 2.3 Mac OSX 10.3.2 >> >> It seems to give out very slowly changing times. As in minutes to >> change anything. > > Note that time.clock() does not return realtime (use time.time() for > that), it returns > CPU seconds used by the current process. So if you type time.clock(), > then do nothing > for three days, then type time.clock() again the two values should be > almost the same. Now I get it! CPU time is elapsed time used by the CPU for a particular process. I ran some tests and the minimum resolution of CPU time returned by time.clock() on the Mac OSX Python is effectively .01 seconds. Anything less is zero. (actually I could sometimes get .009999999980195 for the min resolution) From hengist.podd at virgin.net Fri Feb 13 12:03:02 2004 From: hengist.podd at virgin.net (has) Date: Fri Feb 13 12:03:15 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <1BE0C882-5E3D-11D8-A81C-000393DC534A@emsoftware.com> References: <1BE0C882-5E3D-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: Chris Ryland wrote: >>Only thing still bugging me is that Python doesn't have magic >>methods for overridding 'and', 'or' and 'not' operators directly, >>as writing test expressions is clumsy without it. (Do you think we >>should submit a PEP for this?) > >Isn't the classical solution to define your datatypes such that >and/or/not/etc. are re-mapped as appropriate? Unfortunately, the only magic method Python provides is __nonzero__(), which doesn't help me as I need to know which operator was used and return an object rather than a boolean. (This is what it already does with comparison operators.) >That's what some of the relational bindings packages (and some >symbolic logic packages) do. Yep, same idea here: sweeten an otherwise drab-n-dreary API with some tasty syntactic sugar. Downside's when you start stubbing your toes on other folk's YAGNIs. :) -- Michael Hudson wrote: >No. They're control flow constructs. Hum. You mean like it's an underlying implementation issue? I'd simply assumed these three were operators like any others. >What you can do is: > >1) override the bitwise operators I've tried this (it's still supported, albeit as an undocumented feature, if you want to try it yourself). The problem is that the bitwise operators have higher precedence than the comparison operators, and I think it'll be too easy for users to forget to put parentheses around the operands. ie: items.test((its.size > 12) & (its.color == [0,0,0])) # items whose size > 12 and color = {0,0,0} and not: ref.test(its.size > 12 & its.color == [0,0,0]) which'll cause an error when Python tries to evaluate '12 & its.color' instead of ' & '. >2) create a class-or-staticmethod Term.and_(cls,*things) Yeah. Currently the following syntax forms are all supported for evaluation purposes (this'll be cut down to one in the final release): ref.test( (its.size > 12) & (its.color == [0,0,0]) ) ref.test( (its.size > 12).AND(its.color == [0,0,0]) ) ref.test( AND(its.size > 12, its.color == [0,0,0]) ) The middle one is the form that's currently documented; it approximates to infix syntax, avoids namespace pollution, and more or less ensures that folk'll use it correctly. However, it's fiddly to type and unpleasant to read, imo, which is a problem for ease-of-use (a key feature). Probably the easiest thing's to play with all three for a bit, and see which you feel is least awful. Then decide which'll be easier: living with the kludge, or getting a 'magic method' PEP past the BDFL. :) Lemme know what you think. Thanks, has -- http://freespace.virgin.net/hamish.sanderson/ From mwh at python.net Fri Feb 13 12:21:50 2004 From: mwh at python.net (Michael Hudson) Date: Fri Feb 13 12:21:54 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: (has's message of "Fri, 13 Feb 2004 17:03:02 +0000") References: <1BE0C882-5E3D-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: <2mlln67v4h.fsf@starship.python.net> has writes: > Michael Hudson wrote: > >>No. They're control flow constructs. > > Hum. You mean like it's an underlying implementation issue? No. > I'd simply assumed these three were operators like any others. You can do things like if d.has_key('thing') and d['thing'] > 0: ... and not ever get KeyErrors (ok, this is a daft example, but...). You *can* override && and so in C++ but it's a really daft idea, for the same reason. >>What you can do is: >> >>1) override the bitwise operators > > I've tried this (it's still supported, albeit as an undocumented > feature, if you want to try it yourself). The problem is that the > bitwise operators have higher precedence than the comparison > operators, and I think it'll be too easy for users to forget to put > parentheses around the operands. ie: > > items.test((its.size > 12) & (its.color == [0,0,0])) # items whose > size > 12 and color = {0,0,0} This kind of thing is I'm not a big fan of operator overloading, in general. > and not: > > ref.test(its.size > 12 & its.color == [0,0,0]) > > which'll cause an error when Python tries to evaluate '12 & its.color' > instead of ' & '. Huh? I think there's an __rand__ method, isn't there? >>2) create a class-or-staticmethod Term.and_(cls,*things) > > Yeah. Currently the following syntax forms are all supported for > evaluation purposes (this'll be cut down to one in the final release): > > ref.test( > (its.size > 12) & (its.color == [0,0,0]) > ) > > ref.test( > (its.size > 12).AND(its.color == [0,0,0]) > ) > > ref.test( > AND(its.size > 12, its.color == [0,0,0]) > ) > > > The middle one is the form that's currently documented; it > approximates to infix syntax, avoids namespace pollution, and more or > less ensures that folk'll use it correctly. However, it's fiddly to > type and unpleasant to read, imo, which is a problem for ease-of-use > (a key feature). I think I prefer something like 3), but admittedly, I haven't used that style for anything much... > Probably the easiest thing's to play with all three for a bit, and see > which you feel is least awful. Then decide which'll be easier: living > with the kludge, or getting a 'magic method' PEP past the BDFL. :) You have zero chance of the last, believe me. Cheers, mwh -- For the record, the NTL telephone voicemaze jail is almost as well-planned. I dialled the status recording, which is information- rich in much the same way as 10 Angstroms is a long way... -- Dan Barlow vs NTL: http://ww.telent.net/diary/2002/6/#18.8983 From oussoren at cistron.nl Fri Feb 13 12:23:05 2004 From: oussoren at cistron.nl (Ronald Oussoren) Date: Fri Feb 13 12:22:57 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: References: <1BE0C882-5E3D-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: <49040F88-5E49-11D8-BDD1-0003931CFE24@cistron.nl> On 13-feb-04, at 18:03, has wrote: > > Michael Hudson wrote: > >> No. They're control flow constructs. > > Hum. You mean like it's an underlying implementation issue? I'd simply > assumed these three were operators like any others. They are shortcircuited, the second argument is not evaluated if it is not needed to calculate the result. E.g. 'c = a or b' is more or less equivalent to: c = a if not c: c = b Ronald From cpr at emsoftware.com Fri Feb 13 12:39:35 2004 From: cpr at emsoftware.com (Chris Ryland) Date: Fri Feb 13 12:39:10 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: Message-ID: <96C1813A-5E4B-11D8-A81C-000393DC534A@emsoftware.com> You could always take some method's code and walk it like a compiler, doing special things for the special forms && and || etc. On Friday, February 13, 2004, at 12:03 PM, has wrote: > Chris Ryland wrote: > >>> Only thing still bugging me is that Python doesn't have magic >>> methods for overridding 'and', 'or' and 'not' operators directly, as >>> writing test expressions is clumsy without it. (Do you think we >>> should submit a PEP for this?) >> >> Isn't the classical solution to define your datatypes such that >> and/or/not/etc. are re-mapped as appropriate? > > Unfortunately, the only magic method Python provides is __nonzero__(), > which doesn't help me as I need to know which operator was used and > return an object rather than a boolean. (This is what it already does > with comparison operators.) > > >> That's what some of the relational bindings packages (and some >> symbolic logic packages) do. > > > Yep, same idea here: sweeten an otherwise drab-n-dreary API with some > tasty syntactic sugar. Downside's when you start stubbing your toes on > other folk's YAGNIs. :) > > -- > > Michael Hudson wrote: > >> No. They're control flow constructs. > > Hum. You mean like it's an underlying implementation issue? I'd simply > assumed these three were operators like any others. > > >> What you can do is: >> >> 1) override the bitwise operators > > I've tried this (it's still supported, albeit as an undocumented > feature, if you want to try it yourself). The problem is that the > bitwise operators have higher precedence than the comparison > operators, and I think it'll be too easy for users to forget to put > parentheses around the operands. ie: > > items.test((its.size > 12) & (its.color == [0,0,0])) # items whose > size > 12 and color = {0,0,0} > > and not: > > ref.test(its.size > 12 & its.color == [0,0,0]) > > which'll cause an error when Python tries to evaluate '12 & its.color' > instead of ' & '. > > >> 2) create a class-or-staticmethod Term.and_(cls,*things) > > Yeah. Currently the following syntax forms are all supported for > evaluation purposes (this'll be cut down to one in the final release): > > ref.test( > (its.size > 12) & (its.color == [0,0,0]) > ) > > ref.test( > (its.size > 12).AND(its.color == [0,0,0]) > ) > > ref.test( > AND(its.size > 12, its.color == [0,0,0]) > ) > > > The middle one is the form that's currently documented; it > approximates to infix syntax, avoids namespace pollution, and more or > less ensures that folk'll use it correctly. However, it's fiddly to > type and unpleasant to read, imo, which is a problem for ease-of-use > (a key feature). > > Probably the easiest thing's to play with all three for a bit, and see > which you feel is least awful. Then decide which'll be easier: living > with the kludge, or getting a 'magic method' PEP past the BDFL. :) > > > Lemme know what you think. > > Thanks, > > has > > -- > http://freespace.virgin.net/hamish.sanderson/ > > Cheers! --Chris Ryland / Em Software, Inc. / www.emsoftware.com From bob at redivi.com Fri Feb 13 12:59:27 2004 From: bob at redivi.com (Bob Ippolito) Date: Fri Feb 13 12:56:21 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <96C1813A-5E4B-11D8-A81C-000393DC534A@emsoftware.com> References: <96C1813A-5E4B-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: <5D6803C6-5E4E-11D8-A4CE-000A95686CD8@redivi.com> For that case, you would need to do something pretty funny.. ref.test(lambda obj: obj.size > 12 and obj.color == [0,0,0]) It is altogether possible, I suppose... but you more or less need to use lambda. It would be 'fun' to write the code, but it might be too confusing/magical for most people? On Feb 13, 2004, at 12:39 PM, Chris Ryland wrote: > You could always take some method's code and walk it like a compiler, > doing special things for the special forms && and || etc. > > On Friday, February 13, 2004, at 12:03 PM, has wrote: > >> Chris Ryland wrote: >> >>>> Only thing still bugging me is that Python doesn't have magic >>>> methods for overridding 'and', 'or' and 'not' operators directly, >>>> as writing test expressions is clumsy without it. (Do you think we >>>> should submit a PEP for this?) >>> >>> Isn't the classical solution to define your datatypes such that >>> and/or/not/etc. are re-mapped as appropriate? >> >> Unfortunately, the only magic method Python provides is >> __nonzero__(), which doesn't help me as I need to know which operator >> was used and return an object rather than a boolean. (This is what it >> already does with comparison operators.) >> >> >>> That's what some of the relational bindings packages (and some >>> symbolic logic packages) do. >> >> >> Yep, same idea here: sweeten an otherwise drab-n-dreary API with some >> tasty syntactic sugar. Downside's when you start stubbing your toes >> on other folk's YAGNIs. :) >> >> -- >> >> Michael Hudson wrote: >> >>> No. They're control flow constructs. >> >> Hum. You mean like it's an underlying implementation issue? I'd >> simply assumed these three were operators like any others. >> >> >>> What you can do is: >>> >>> 1) override the bitwise operators >> >> I've tried this (it's still supported, albeit as an undocumented >> feature, if you want to try it yourself). The problem is that the >> bitwise operators have higher precedence than the comparison >> operators, and I think it'll be too easy for users to forget to put >> parentheses around the operands. ie: >> >> items.test((its.size > 12) & (its.color == [0,0,0])) # items whose >> size > 12 and color = {0,0,0} >> >> and not: >> >> ref.test(its.size > 12 & its.color == [0,0,0]) >> >> which'll cause an error when Python tries to evaluate '12 & >> its.color' instead of ' & '. >> >> >>> 2) create a class-or-staticmethod Term.and_(cls,*things) >> >> Yeah. Currently the following syntax forms are all supported for >> evaluation purposes (this'll be cut down to one in the final >> release): >> >> ref.test( >> (its.size > 12) & (its.color == [0,0,0]) >> ) >> >> ref.test( >> (its.size > 12).AND(its.color == [0,0,0]) >> ) >> >> ref.test( >> AND(its.size > 12, its.color == [0,0,0]) >> ) >> >> >> The middle one is the form that's currently documented; it >> approximates to infix syntax, avoids namespace pollution, and more or >> less ensures that folk'll use it correctly. However, it's fiddly to >> type and unpleasant to read, imo, which is a problem for ease-of-use >> (a key feature). >> >> Probably the easiest thing's to play with all three for a bit, and >> see which you feel is least awful. Then decide which'll be easier: >> living with the kludge, or getting a 'magic method' PEP past the >> BDFL. :) >> >> >> Lemme know what you think. >> >> Thanks, >> >> has >> >> -- >> http://freespace.virgin.net/hamish.sanderson/ >> >> > > Cheers! > --Chris Ryland / Em Software, Inc. / www.emsoftware.com > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From wfolta at netmail.to Fri Feb 13 13:25:35 2004 From: wfolta at netmail.to (Wayne Folta) Date: Fri Feb 13 13:25:47 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: <87d68jp8s2.fsf@mally.pyrite.org> References: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> <87d68jp8s2.fsf@mally.pyrite.org> Message-ID: <045FB7B7-5E52-11D8-8730-000A959CB2EC@netmail.to> To be honest, I would even consider switching to a Linux-based PDA. I definitely, totally depend on one. I agree that Python should be the conduit-making tool. I think that opening up the process like that would result in conduits that we haven't even thought of yet. (First off would be Stickies<-->Notes. Then would come various Web/RSS conduits, etc.) Yeah, Palm are software idiots. I mean OS5 is so stinkingly primitive compared to the Newton. External and built-in memory are treated totally differently, for crying out loud. The only good thing they've done so far was adopting Palm Desktop, which used to be Claris something-or-other I think. I for one would love to hear more about how we could go about doing what you've suggested. I have many years of programming experience, though none with C++/Objective-C. (Mostly C and perl, though also Smalltalk, etc.) It may be that before the conversation is over, Apple will have a big announcement about an Apple PDA or maybe iSync will step it up three or four notches and fill in the gap. > provide at least the HotSync portion of Palm Desktop, *nothing* can > talk to the palmtop, not even iSync. It seems highly likely that Palm > will be changing the HotSync protocol for Cobalt, especially > considering that there have already been changes which render the > current Mac HotSync library incapable of talking to some *current* > models that run OS5. The problem has, in effect, already started. > > So, at the bare minimum, communication must be possible. We can only > hope that pilot-link manages to become Cobalt-compatible at some > point, which would take care of all the low-level stuff on the wire. > Pilot-link is portable Unixy code; it works fine on OSX and its > library can easily be wrapped in Python (I did a SWIG based wrapper > for it long ago). > > The next issue is the conduit API. Somehow, the sync system has to > allow third party conduits to hook into it... and if that is going to > work in practice, there has to be exactly one conduit API for third > party developers to use. It will be hard enough to convince third > parties to support the Mac now that Palm is officially dropping > support, but if the replacement for the Palm HotSync manager does not > carry the authority of being THE conduit API for Palms and OSX, > getting third party support will be close to impossible instead of > merely very hard. Ideally, it should not only be the only reasonable > choice available, but it should also be endorsed by Apple and/or some > existing developers, even if it is only a de facto endorsement like > making iSync work with it. > > Given the need for standardization, I think the best way to go, > development-wise, is Objective-C with as much Cocoa-friendliness as > possible, conduits as loadable bundles, etc. (The Palm stuff > currently is, I believe, a Carbon app with a C++-based API. If we > have to reinvent it all, I see no reason not to do it the Cocoa way.) > Python would be an excellent language to implement the actual conduits > in, though, given an Objective-C framework to work in. > > Unfortunately, I'm not very optimistic about any of this right now. > People have been working on Palm syncing stuff for Unix for years now > and there are still a plethora of different conduit/desktop systems > out there. There is basically no third party support, and I think a > big part of the reason for that is the lack of a single target for > developers. Now, the Mac is being dumped into the same boat... I hope > that someone can step in with something that will be worthy of use on > OSX. (Ideally, I'd like to see Apple do it.) > > Anyway, I'm currently too annoyed with Palm to even consider working > on something like this, but since I have done some of it before I'd be > happy to discuss my experiences with anyone trying to start such a > project... > > --Rob > > -- > Rob Tillotson N9MTB > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2363 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040213/4360a8d0/smime-0001.bin From hengist.podd at virgin.net Fri Feb 13 14:01:38 2004 From: hengist.podd at virgin.net (has) Date: Fri Feb 13 14:01:44 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <96C1813A-5E4B-11D8-A81C-000393DC534A@emsoftware.com> References: <96C1813A-5E4B-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: Chris Ryland wrote: >You could always take some method's code and walk it like a >compiler, doing special things for the special forms && and || etc. Can you clarify? Thanks, has -- http://freespace.virgin.net/hamish.sanderson/ From bob at redivi.com Fri Feb 13 14:08:08 2004 From: bob at redivi.com (Bob Ippolito) Date: Fri Feb 13 14:05:04 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: References: <96C1813A-5E4B-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: On Feb 13, 2004, at 2:01 PM, has wrote: > Chris Ryland wrote: > >> You could always take some method's code and walk it like a compiler, >> doing special things for the special forms && and || etc. > > Can you clarify? He means, take the Python bytecode, disassemble it, and turn that into your test ref form. -bob From janssen at parc.com Fri Feb 13 14:19:08 2004 From: janssen at parc.com (Bill Janssen) Date: Fri Feb 13 14:19:26 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: Your message of "Fri, 13 Feb 2004 10:25:35 PST." <045FB7B7-5E52-11D8-8730-000A959CB2EC@netmail.to> Message-ID: <04Feb13.111911pst."58611"@synergy1.parc.xerox.com> Perhaps you would consider doing this as part of the Open Source Application Foundation's Chandler project. Chandler is a Python project which aims at developing "a Personal Information Manager (PIM) intended for use in everyday information and communication tasks, such as composing and reading email, managing an appointment calendar and keeping a contact list." Sounds like just the thing you want to sync to your Palm. www.osafoundation.org. Bill From cpr at emsoftware.com Fri Feb 13 14:32:39 2004 From: cpr at emsoftware.com (Chris Ryland) Date: Fri Feb 13 14:32:15 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: Message-ID: <629A11DE-5E5B-11D8-A81C-000393DC534A@emsoftware.com> On Friday, February 13, 2004, at 02:08 PM, Bob Ippolito wrote: > On Feb 13, 2004, at 2:01 PM, has wrote: >> Chris Ryland wrote: >>> You could always take some method's code and walk it like a >>> compiler, doing special things for the special forms && and || etc. >> Can you clarify? > He means, take the Python bytecode, disassemble it, and turn that into > your test ref form. Right-ho, something along those lines, using a lambda form to defer execution. There's no way we'll ever get the BDFL to change the language to suit this kind of macro-like usage (where ordinary, existing forms take on special meanings)--too bad--so the only other way is extreme cleverness involving compiling the AST or bytecode into your own semantics. Hey, maybe you could do something clever with iterators to avoid the lambda form... Cheers! --Chris Ryland / Em Software, Inc. / www.emsoftware.com From eichin at metacarta.com Fri Feb 13 14:37:53 2004 From: eichin at metacarta.com (eichin@metacarta.com) Date: Fri Feb 13 14:38:01 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> References: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> Message-ID: <7gn07mu5wu.fsf@pikespeak.metacarta.com> It's especially sad given the extent to which the Palm ABIs are classic (68k) Mac abi's at their roots. Missing Sync stepped up with a promise to (sometime later this year) release mac-compatible cobalt and garnet tools, but that's just a press release, not code... and doesn't have Apple stepping up and saying they'll make sure it works with iSync... This is the kind of thing that sparks rumours of apple pdas: the only reason they'd support palms this badly is that they want to supplant them with iPDAs :-) [On a more relevant note - pilot-link9-python *is* in fink, though I haven't tried it yet...] From Chris.Barker at noaa.gov Fri Feb 13 14:31:43 2004 From: Chris.Barker at noaa.gov (Chris Barker) Date: Fri Feb 13 14:41:38 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <2mlln67v4h.fsf@starship.python.net> References: <1BE0C882-5E3D-11D8-A81C-000393DC534A@emsoftware.com> <2mlln67v4h.fsf@starship.python.net> Message-ID: <402D261F.3080006@noaa.gov> Michael Hudson wrote: >>Probably the easiest thing's to play with all three for a bit, and see >>which you feel is least awful. Then decide which'll be easier: living >>with the kludge, or getting a 'magic method' PEP past the BDFL. :) > > > You have zero chance of the last, believe me. To reinforce Michael's believability, "rich comparisons", which is what overloading the >,<, etc. operators was called, was added as of Python 2.1 (I think) largely to support NumPy. NumPy would ahve loved to have beena ble to oeverload "and", "or" and friends as well, but that was not added for the reasons others have stated. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From hinsen at cnrs-orleans.fr Fri Feb 13 14:48:18 2004 From: hinsen at cnrs-orleans.fr (hinsen@cnrs-orleans.fr) Date: Fri Feb 13 14:47:33 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: <045FB7B7-5E52-11D8-8730-000A959CB2EC@netmail.to> References: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> <87d68jp8s2.fsf@mally.pyrite.org> <045FB7B7-5E52-11D8-8730-000A959CB2EC@netmail.to> Message-ID: <91F2F9DE-5E5D-11D8-B2EC-000A95AB5F10@cnrs-orleans.fr> On 13.02.2004, at 19:25, Wayne Folta wrote: > To be honest, I would even consider switching to a Linux-based PDA. I > definitely, totally depend on one. You are not alone... I have an old Palm III that I am still happy with, with two exceptions: so much dust has accumulated under the top screen layer that it has become hard to read, and I can't connect it to my iBook, the USB adapter is no longer available. I tried a non-Palm USB to serial adapter, but without success. Then I also have a Zaurus (5500), which I carry around as a mini-laptop, but never used as a PDA. There is no decent sync solution for any desktop I'd care to use, and its USB hardware is so notoriously unreliable that syncing would be a pain anyway. For file transfers I use CompactFlash cards. The Zaurus PIM software isn't so great either, compared to Palm. What I'd love to have (but don't have the time to write) is a set of Python PIM software that runs both on the desktop and on the Zaurus, with syncing of course. PyQt would make it sufficiently portable on the desktop side. > Yeah, Palm are software idiots. I mean OS5 is so stinkingly primitive > compared to the Newton. External and built-in memory are treated > totally Oh, right, I have a Newton as well. Model 120. Very elegant, very useless. Much too big, to start with. Konrad. From hengist.podd at virgin.net Fri Feb 13 14:53:39 2004 From: hengist.podd at virgin.net (has) Date: Fri Feb 13 14:53:45 2004 Subject: clarification re. test references (Re: [Pythonmac-SIG] [ann] appscript 0.4.0 released) In-Reply-To: <5D6803C6-5E4E-11D8-A4CE-000A95686CD8@redivi.com> References: <96C1813A-5E4B-11D8-A81C-000393DC534A@emsoftware.com> <5D6803C6-5E4E-11D8-A4CE-000A95686CD8@redivi.com> Message-ID: Hi all, Just to clarify how appscript's 'test expressions' work, since I haven't gone into it yet: - Comparison tests (e.g. its.size > 1024) have the form: - Logical tests would ideally have the form: Comparison expressions evaluate to a ComparisonTest instance, while logical expressions evaluate to a LogicalTest instance. It's a basic capture mechanism: these objects 'record' a test expression's structure, allowing it to be reconstructed as AEDescs. Actually evaluating the expression as an expression is left to the scriptable app; appscript doesn't do this itself. Pretty straightforward once you wrap your head around it. (Would be simpler though if you could use Lisp-style macros to buzz through the AST instead. Ah well.) (BTW, next job's to work on the documentation, particularly the implementation stuff. This'll make things much clearer.) HTH has -- http://freespace.virgin.net/hamish.sanderson/ From skip at pobox.com Fri Feb 13 15:02:40 2004 From: skip at pobox.com (Skip Montanaro) Date: Fri Feb 13 15:02:59 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: <91F2F9DE-5E5D-11D8-B2EC-000A95AB5F10@cnrs-orleans.fr> References: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> <87d68jp8s2.fsf@mally.pyrite.org> <045FB7B7-5E52-11D8-8730-000A959CB2EC@netmail.to> <91F2F9DE-5E5D-11D8-B2EC-000A95AB5F10@cnrs-orleans.fr> Message-ID: <16429.11616.554095.730723@montanaro.dyndns.org> Konrad> I have an old Palm III that I am still happy with, with two Konrad> exceptions: so much dust has accumulated under the top screen Konrad> layer that it has become hard to read, and I can't connect it to Konrad> my iBook, the USB adapter is no longer available. Try googling for "USB PalmConnect cable". There's bound to be someone out there who still has one in stock. (Of course there's always Ebay.) If you need a part number, it is (if my aging eyes didn't mislead me) #163-0069. How does dust get underneath anything? I've never had a problem with my Palm III. Skip From delza at blastradius.com Fri Feb 13 15:12:25 2004 From: delza at blastradius.com (Dethe Elza) Date: Fri Feb 13 15:12:36 2004 Subject: [Pythonmac-SIG] Menus from pyobjc Message-ID: Hi folks, I'm working on a demo app using PyObjC for the UI, but without using a .nib file. I'm running it using pythonw and mostly it works OK, but I'm having trouble with menus. It defaults to a Python menu, but when I query the app.mainMenu() it reports None, when I use app.setMainMenu_(mymenu) at only the Python menu shows up. Further symptoms: * When I click on the menubar my new menus (submenus of mymenu) show up, but are disabled, even if I explicitly enable them or provide appropriate targets/actions. * Even though I've set the main menu, the Python menu still shows up, but is empty. Any suggestions? I can provide some example code, but it's kind of jumbled right now. If you're wondering what the point is, I'm hoping to work towards something like Renaissance/XUL (i.e., driving the UI from XML rather than from .nibs). At this point I'm just trying to pull together a proof-of-concept to see if it can be done. TIA! --Dethe "And you think you're so clever and classless and free" ? John Lennon on prototype-based programming -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2371 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040213/1cc8bb53/smime.bin From bob at redivi.com Fri Feb 13 15:21:29 2004 From: bob at redivi.com (Bob Ippolito) Date: Fri Feb 13 15:18:25 2004 Subject: [Pythonmac-SIG] Menus from pyobjc In-Reply-To: References: Message-ID: <34C3B674-5E62-11D8-A4CE-000A95686CD8@redivi.com> On Feb 13, 2004, at 3:12 PM, Dethe Elza wrote: > I'm working on a demo app using PyObjC for the UI, but without using a > .nib file. I'm running it using pythonw and mostly it works OK, but > I'm having trouble with menus. It defaults to a Python menu, but when > I query the app.mainMenu() it reports None, when I use > app.setMainMenu_(mymenu) at only the Python menu shows up. > > Further symptoms: > > * When I click on the menubar my new menus (submenus of mymenu) show > up, but are disabled, even if I explicitly enable them or provide > appropriate targets/actions. > * Even though I've set the main menu, the Python menu still shows up, > but is empty. > > Any suggestions? I can provide some example code, but it's kind of > jumbled right now. > > If you're wondering what the point is, I'm hoping to work towards > something like Renaissance/XUL (i.e., driving the UI from XML rather > than from .nibs). At this point I'm just trying to pull together a > proof-of-concept to see if it can be done. Use bundlebuilder to create a nib-less bundle for your app and run it from there. You're running it from the Python.app bundle (via pythonw), which does have a nib. -bob From hengist.podd at virgin.net Fri Feb 13 15:46:48 2004 From: hengist.podd at virgin.net (has) Date: Fri Feb 13 15:56:44 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <2mlln67v4h.fsf@starship.python.net> References: <1BE0C882-5E3D-11D8-A81C-000393DC534A@emsoftware.com> <2mlln67v4h.fsf@starship.python.net> Message-ID: Michael Hudson wrote: > >>1) override the bitwise operators > > > > items.test((its.size > 12) & (its.color == [0,0,0])) # items whose >> size > 12 and color = {0,0,0} > >This kind of thing is I'm not a big fan of operator overloading, in >general. Heh, I'm not a big fan of operators; know what you mean though. Reason I'm trying it here is that a conventional method call-based approach soon becomes unreadable when constructing an expression of any complexity; for example: items.test(its.size.greaterthan(12).AND(its.color.equals([0,0,0]))) versus: items.test(its.size > 12 and its.color == [0,0,0]) > > and not: >> > > ref.test(its.size > 12 & its.color == [0,0,0]) >> >> which'll cause an error when Python tries to evaluate '12 & its.color' >> instead of ' & '. > >Huh? Python's evaluation order is to do the bitwise AND before the comparison tests, so it sees: its.size > 12 & its.color == [0,0,0] as: its.size > (12 & its.color) == [0,0,0] instead of: (its.size > 12) & (its.color == [0,0,0]) which is what I want it to do. > > ref.test( >> (its.size > 12) & (its.color == [0,0,0]) >> ) >> >> ref.test( >> (its.size > 12).AND(its.color == [0,0,0]) >> ) >> > > ref.test( >> AND(its.size > 12, its.color == [0,0,0]) > > ) >> > >I think I prefer something like 3), but admittedly, I haven't used >that style for anything much... Worth playing around with to see what feels best to you. e.g. The third form should work quite well for users when there's only a single logical test involved, but may not work so well for more complex expressions, eg: (its.size > 12 and its.color == [0,0,0]) or (its.length > 0 and its.characters[1] != 'X') # ideal (true infix) OR(AND(its.size > 12, its.color == [0,0,0]), AND(its.length > 0, its.characters[1] != 'X')) # pseudo-prefix (its.size > 12).AND(its.color == [0,0,0]).OR(its.length > 0).AND(its.characters[1] != 'X') # pseudo-infix (Ech. Decisions, decisions... But hey; I'm just the bloke wot writes it, youse all are the ones what gotta use it.;) Thanks, has -- http://freespace.virgin.net/hamish.sanderson/ From hengist.podd at virgin.net Fri Feb 13 15:15:18 2004 From: hengist.podd at virgin.net (has) Date: Fri Feb 13 15:56:49 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <629A11DE-5E5B-11D8-A81C-000393DC534A@emsoftware.com> References: <629A11DE-5E5B-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: Chris Ryland wrote: >>He means, take the Python bytecode, disassemble it, and turn that >>into your test ref form. Ah right, gotcha. >Right-ho, something along those lines, using a lambda form to defer execution. > >There's no way we'll ever get the BDFL to change the language to >suit this kind of macro-like usage Yeah, pity. Still, can't blame the big man; there's a lot of good sense in _not_ trying to do and be everything to everyone. That way lies madness... (and C++) Say, how about we do a PEP for a "BDFL vs. SmugLispWeenies" Celebrity Deathmatch instead? ;) Thanks, has -- http://freespace.virgin.net/hamish.sanderson/ From berkowit at silcom.com Fri Feb 13 16:48:28 2004 From: berkowit at silcom.com (Paul Berkowitz) Date: Fri Feb 13 16:51:54 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: Message-ID: On 2/13/04 12:46 PM, "has" wrote: > Worth playing around with to see what feels best to you. e.g. The > third form should work quite well for users when there's only a > single logical test involved, but may not work so well for more > complex expressions, eg: > > (its.size > 12 and its.color == [0,0,0]) or (its.length > 0 and > its.characters[1] != 'X') # ideal (true infix) > > OR(AND(its.size > 12, its.color == [0,0,0]), AND(its.length > 0, > its.characters[1] != 'X')) # pseudo-prefix > > (its.size > 12).AND(its.color == [0,0,0]).OR(its.length > > 0).AND(its.characters[1] != 'X') # pseudo-infix > Just in case anyone thinks has is coming up with abstruse examples, he's not. Once you get used to the power of these types of filters, you find them indispensable. In AppleScript, I use complex 'whose' filters like this all the time. To my (biased) eyes, the first example is so much more readable and usable, but I have a different background form most of you (similar to has's). -- Paul Berkowitz From wfspotz at sandia.gov Fri Feb 13 17:51:43 2004 From: wfspotz at sandia.gov (Bill Spotz) Date: Fri Feb 13 17:51:57 2004 Subject: [Pythonmac-SIG] SciPy, atlas and weave on 10.3 Message-ID: <31A77751-5E77-11D8-AA42-0003930F2154@sandia.gov> I'm running in to a string of problems preventing me from successfully upgrading from 10.2 to 10.3. Under 10.2, I had installed scipy via fink and was using weave in one of my projects. Under 10.3, scipy is not yet available under fink, but others had reported being able to install it manually, so I decided to give it a try. I was unable to figure out how to get around the atlas requirement and use "-framework veclib" instead. Does anybody know if this is possible? Trying to install atlas via fink, the build process gets to the following point: ... cc -o xconfig config.c ./xconfig where it then appears to do nothing. Activity Monitor shows that xconfig takes up virtually no CPU, and it just sits indefinitely. Has anyone else seen this problem or know of a fix? Since I only needed weave, I decided to temporarily give up on scipy and just install weave. I downloaded weave-0.2.3 from the scipy web site and tried to build it. In addition to a bunch of reasonable-looking distutils output, I get the following when I build: dep: ['scipy_distutils', 'scipy_test'] /sw/lib/python2.3/distutils/dist.py:213: UserWarning: 'licence' distribution option is deprecated; use 'license' warnings.warn(msg) ... package init file '.../weave-0.2.3/weave/tests/__init__.py' not found (or not a regular file) If I go ahead and install it anyway, and try to use the blitz type converters in my project, I get: File "something.py", line 268, in computeResidualVector type_converters = weave.converters.blitz) AttributeError: 'module' object has no attribute 'converters' Any help would be appreciated. Thanks ** Bill Spotz ** ** Sandia National Laboratories Voice: (505)845-0170 ** ** P.O. Box 5800 Fax: (505)284-5451 ** ** Albuquerque, NM 87185-0316 Email: wfspotz@sandia.gov ** From delza at blastradius.com Fri Feb 13 18:50:31 2004 From: delza at blastradius.com (Dethe Elza) Date: Fri Feb 13 18:50:40 2004 Subject: [Pythonmac-SIG] Menus from pyobjc In-Reply-To: <34C3B674-5E62-11D8-A4CE-000A95686CD8@redivi.com> References: <34C3B674-5E62-11D8-A4CE-000A95686CD8@redivi.com> Message-ID: <6894E952-5E7F-11D8-B050-0003939B59E8@blastradius.com> Thanks, Bob. I suspected it might be that, but wasn't sure why. I'm calling on some external files, so as soon as I figure out how to tell bundlebuilder about them I'll give it a shot. I'll let you know how it turns out. --Dethe > Use bundlebuilder to create a nib-less bundle for your app and run it > from there. You're running it from the Python.app bundle (via > pythonw), which does have a nib. > > -bob There are only two industries that call their customers "users" -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2371 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040213/124d8b05/smime.bin From cpr at emsoftware.com Fri Feb 13 19:09:23 2004 From: cpr at emsoftware.com (Chris Ryland) Date: Fri Feb 13 19:08:58 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: Message-ID: <0B85D411-5E82-11D8-A81C-000393DC534A@emsoftware.com> On Friday, February 13, 2004, at 03:46 PM, has wrote: > Heh, I'm not a big fan of operators; know what you mean though. Reason > I'm trying it here is that a conventional method call-based approach > soon becomes unreadable when constructing an expression of any > complexity; for example: > > items.test(its.size.greaterthan(12).AND(its.color.equals([0,0,0]))) > > versus: > > items.test(its.size > 12 and its.color == [0,0,0]) items.test(lambda: its.size > 12 and its.color = [0, 0, 0])) would be great! And "all" you have to do is to walk the AST for the lambda (bytecodes are really too low-level and too late for different semantics) and ignore any Pythonic meanings, instead generating the AppleEvent equivalent code (typed Lisp, really). That gives you a lot of freedom! Cheers! --Chris Ryland / Em Software, Inc. / www.emsoftware.com From bob at redivi.com Sat Feb 14 11:59:25 2004 From: bob at redivi.com (Bob Ippolito) Date: Sat Feb 14 11:59:07 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <0B85D411-5E82-11D8-A81C-000393DC534A@emsoftware.com> References: <0B85D411-5E82-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: <25249E56-5F0F-11D8-8493-000A95686CD8@redivi.com> On Feb 13, 2004, at 7:09 PM, Chris Ryland wrote: > On Friday, February 13, 2004, at 03:46 PM, has wrote: > >> Heh, I'm not a big fan of operators; know what you mean though. >> Reason I'm trying it here is that a conventional method call-based >> approach soon becomes unreadable when constructing an expression of >> any complexity; for example: >> >> items.test(its.size.greaterthan(12).AND(its.color.equals([0,0,0]))) >> >> versus: >> >> items.test(its.size > 12 and its.color == [0,0,0]) > > items.test(lambda: its.size > 12 and its.color = [0, 0, 0])) > > would be great! And "all" you have to do is to walk the AST for the > lambda (bytecodes are really too low-level and too late for different > semantics) and ignore any Pythonic meanings, instead generating the > AppleEvent equivalent code (typed Lisp, really). That gives you a lot > of freedom! I don't think it's possible to get an AST, and "its" should be taken as an argument to the lambda. >>> import inspect >>> inspect.getsource(lambda its:its.size > 12) Traceback (most recent call last): File "", line 1, in ? File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/inspect.py", line 549, in getsource lines, lnum = getsourcelines(object) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/inspect.py", line 538, in getsourcelines lines, lnum = findsource(object) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/inspect.py", line 408, in findsource raise IOError('could not get source code') IOError: could not get source code >>> import dis >>> dis.dis(lambda its:its.size > 12 and its.color == [0,0,0]) 1 0 LOAD_FAST 0 (its) 3 LOAD_ATTR 1 (size) 6 LOAD_CONST 1 (12) 9 COMPARE_OP 4 (>) 12 JUMP_IF_FALSE 22 (to 37) 15 POP_TOP 16 LOAD_FAST 0 (its) 19 LOAD_ATTR 2 (color) 22 LOAD_CONST 2 (0) 25 LOAD_CONST 2 (0) 28 LOAD_CONST 2 (0) 31 BUILD_LIST 3 34 COMPARE_OP 2 (==) >> 37 RETURN_VALUE -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040214/02dcc48e/smime.bin From cpr at emsoftware.com Sat Feb 14 12:21:57 2004 From: cpr at emsoftware.com (Chris Ryland) Date: Sat Feb 14 12:21:32 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <25249E56-5F0F-11D8-8493-000A95686CD8@redivi.com> Message-ID: <4ACC5106-5F12-11D8-A81C-000393DC534A@emsoftware.com> On Saturday, February 14, 2004, at 11:59 AM, Bob Ippolito wrote: > I don't think it's possible to get an AST, and "its" should be taken > as an argument to the lambda. Well, I'm treading in waters I don't understand (block that metaphor!) but don't you have to load the compile package to deal with ASTs? Cheers! --Chris Ryland / Em Software, Inc. / www.emsoftware.com From bob at redivi.com Sat Feb 14 12:51:21 2004 From: bob at redivi.com (Bob Ippolito) Date: Sat Feb 14 12:48:18 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <4ACC5106-5F12-11D8-A81C-000393DC534A@emsoftware.com> References: <4ACC5106-5F12-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: <661A5CD2-5F16-11D8-8493-000A95686CD8@redivi.com> On Feb 14, 2004, at 12:21 PM, Chris Ryland wrote: > On Saturday, February 14, 2004, at 11:59 AM, Bob Ippolito wrote: > >> I don't think it's possible to get an AST, and "its" should be taken >> as an argument to the lambda. > > Well, I'm treading in waters I don't understand (block that metaphor!) > but don't you have to load the compile package to deal with ASTs? The input for the compiler package is source code... if you can't get the source code, you can't get an AST. -bob From hengist.podd at virgin.net Sat Feb 14 14:36:38 2004 From: hengist.podd at virgin.net (has) Date: Sat Feb 14 15:29:00 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <0B85D411-5E82-11D8-A81C-000393DC534A@emsoftware.com> References: <0B85D411-5E82-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: Chris Ryland wrote: >items.test(lambda: its.size > 12 and its.color = [0, 0, 0])) > >would be great! And "all" you have to do is to walk the AST for the lambda Quite neat. One question though: how would you tell the difference between these and ordinary lambdas? Thanks, has -- http://freespace.virgin.net/hamish.sanderson/ From cpr at emsoftware.com Sat Feb 14 15:34:04 2004 From: cpr at emsoftware.com (Chris Ryland) Date: Sat Feb 14 15:33:36 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: Message-ID: <2171E874-5F2D-11D8-A81C-000393DC534A@emsoftware.com> On Saturday, February 14, 2004, at 02:36 PM, has wrote: > Chris Ryland wrote: > >> items.test(lambda: its.size > 12 and its.color = [0, 0, 0])) >> >> would be great! And "all" you have to do is to walk the AST for the >> lambda > > Quite neat. One question though: how would you tell the difference > between these and ordinary lambdas? Well, as Bob has pointed out, this won't work, unless you start from the bytecodes. It would be a normal lambda passed to your function, which would interpret the bytecodes with completely different semantics (and limited to what could be compiled to AppleEvent tests). I suppose I should stop blathering about it if I'm not willing to do the work... Cheers! --Chris Ryland / Em Software, Inc. / www.emsoftware.com From hengist.podd at virgin.net Sat Feb 14 16:02:16 2004 From: hengist.podd at virgin.net (has) Date: Sat Feb 14 16:04:25 2004 Subject: [Pythonmac-SIG] [ann] appscript 0.4.0 released In-Reply-To: <2171E874-5F2D-11D8-A81C-000393DC534A@emsoftware.com> References: <2171E874-5F2D-11D8-A81C-000393DC534A@emsoftware.com> Message-ID: Chris Ryland wrote: >>>items.test(lambda: its.size > 12 and its.color = [0, 0, 0])) >>> >>>would be great! And "all" you have to do is to walk the AST for the lambda >> >>Quite neat. One question though: how would you tell the difference >>between these and ordinary lambdas? > >Well, as Bob has pointed out, this won't work, unless you start from >the bytecodes. > >It would be a normal lambda passed to your function, which would >interpret the bytecodes with completely different semantics (and >limited to what could be compiled to AppleEvent tests). > >I suppose I should stop blathering about it if I'm not willing to do >the work... Ah well; can't win 'em all. Back to the ol' drawing board then... Cheers, has -- http://freespace.virgin.net/hamish.sanderson/ From chris at fonnesbeck.org Sat Feb 14 16:32:57 2004 From: chris at fonnesbeck.org (Christopher Fonnesbeck) Date: Sat Feb 14 16:33:10 2004 Subject: [Pythonmac-SIG] SciPy, atlas and weave on 10.3 In-Reply-To: References: Message-ID: <5B756D40-5F35-11D8-B818-000A956FDAC0@fonnesbeck.org> On Feb 14, 2004, at 12:21 PM, pythonmac-sig-request@python.org wrote: > > I'm running in to a string of problems preventing me from successfully > upgrading from 10.2 to 10.3. Under 10.2, I had installed scipy via > fink and was using weave in one of my projects. Under 10.3, scipy is > not yet available under fink, but others had reported being able to > install it manually, so I decided to give it a try. > > I was unable to figure out how to get around the atlas requirement and > use "-framework veclib" instead. Does anybody know if this is > possible? > > Trying to install atlas via fink, the build process gets to the > following point: > > ... > cc -o xconfig config.c > ./xconfig > > where it then appears to do nothing. Activity Monitor shows that > xconfig takes up virtually no CPU, and it just sits indefinitely. Has > anyone else seen this problem or know of a fix? > > Since I only needed weave, I decided to temporarily give up on scipy > and just install weave. I downloaded weave-0.2.3 from the scipy web > site and tried to build it. In addition to a bunch of > reasonable-looking distutils output, I get the following when I build: > > dep: ['scipy_distutils', 'scipy_test'] > /sw/lib/python2.3/distutils/dist.py:213: UserWarning: 'licence' > distribution option is deprecated; use 'license' > warnings.warn(msg) > ... > package init file '.../weave-0.2.3/weave/tests/__init__.py' not found > (or not a regular file) > > If I go ahead and install it anyway, and try to use the blitz type > converters in my project, I get: > > File "something.py", line 268, in computeResidualVector > type_converters = weave.converters.blitz) > AttributeError: 'module' object has no attribute 'converters' > > Any help would be appreciated. > I would run scipy without using fink. I try not to use fink unless there is no other option. Once you get the developer tools loaded, building Scipy should be pretty straightforward. You just need to add: -framework vecLib to your compile flags to give you ATLAS, BLAS, &c. C. -- Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g ) Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia From contacto at rafaelguedez.com Sat Feb 14 18:18:07 2004 From: contacto at rafaelguedez.com (RAFA3L) Date: Sun Feb 15 15:47:14 2004 Subject: [Pythonmac-SIG] How compile pyRXP? Message-ID: <0C77E142-5F44-11D8-9CAA-0003933F4628@rafaelguedez.com> Hello all, I'm really newbie with Python. How I can compile the module PyRXP http://www.reportlab.org/pyrxp.html ? I put the unziped files in Library/Python/2.3/ but I get the same error when try one open application "ImportError: No module named pyRXP" Thanks! rafa3l.com From Jack.Jansen at cwi.nl Sun Feb 15 16:07:13 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sun Feb 15 16:07:12 2004 Subject: [Pythonmac-SIG] SO_REUSEADDR not work In-Reply-To: References: <1A237D20-5DBA-11D8-9C92-000A95C4B360@samuelsmith.org> Message-ID: On 13 Feb 2004, at 17:37, Samuel M. Smith wrote: > According to my understanding of the socket library a port can be made > reusable or used by another socket > with the socket option SO_REUSEADDR however I can't seem to get it to > work. I always forget what SO_REUSEADDR means exactly, but it is something obscure, I think it only has to do with reusing an (address, port) combination that is still in some sort of waiting state (after a connnection having aborted, for instance). I think what you want is SO_REUSEPORT. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Sun Feb 15 16:09:04 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sun Feb 15 16:12:24 2004 Subject: [Pythonmac-SIG] Extracting frames from Quicktime movies? In-Reply-To: <13C37DA2-5E45-11D8-8D67-00039345C610@darwin.in-berlin.de> References: <13C37DA2-5E45-11D8-8D67-00039345C610@darwin.in-berlin.de> Message-ID: <2FBC4B6B-5FFB-11D8-8F81-000D934FF6B4@cwi.nl> On 13 Feb 2004, at 17:52, Dinu Gherman wrote: > Hi, > > does anybody have a few Python lines of code for extracting > a frame from a Quicktime movie? I'm actually only interested > in the first frame, but a more general solution would also > be nice. [POOF!] Jack steps out of Guido's time machine, and points Dinu at plat-mac/videoreader.py in any 2.3 distribution. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Sun Feb 15 16:16:59 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sun Feb 15 16:20:23 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: <045FB7B7-5E52-11D8-8730-000A959CB2EC@netmail.to> References: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> <87d68jp8s2.fsf@mally.pyrite.org> <045FB7B7-5E52-11D8-8730-000A959CB2EC@netmail.to> Message-ID: <4AB40A91-5FFC-11D8-8F81-000D934FF6B4@cwi.nl> On 13 Feb 2004, at 19:25, Wayne Folta wrote: > It may be that before the conversation is over, Apple will have a big > announcement about an Apple PDA or maybe iSync will step it up three > or four notches and fill in the gap. This wouldn't surprise me in the least. Palm would be stark raving mad if they dropped the one market where they have a 100% marketshare: no-one with a Mac uses a WinCE PDA, and I think the same is true for Psions (in as far as they still exist). But then, I could be wrong, and maybe with the numerous splits and rejoins and resplits the-company-formerly-known-as-palm is now stark raving mad, -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From nbastin at opnet.com Sun Feb 15 16:21:01 2004 From: nbastin at opnet.com (Nick Bastin) Date: Sun Feb 15 16:21:09 2004 Subject: [Pythonmac-SIG] SO_REUSEADDR not work In-Reply-To: References: <1A237D20-5DBA-11D8-9C92-000A95C4B360@samuelsmith.org> Message-ID: On Feb 15, 2004, at 4:07 PM, Jack Jansen wrote: > > On 13 Feb 2004, at 17:37, Samuel M. Smith wrote: > >> According to my understanding of the socket library a port can be >> made reusable or used by another socket >> with the socket option SO_REUSEADDR however I can't seem to get it to >> work. > > I always forget what SO_REUSEADDR means exactly, but it is something > obscure, I think it only has to do with reusing an (address, port) > combination that is still in some sort of waiting state (after a > connnection having aborted, for instance). SO_REUSEADDR allows you to bind to a port that is already bound by someone else. This is mostly relevant if you want to bind to multiple (port, local_address) pairs with individual threads. All calls after the first would fail if you didn't use SO_REUSEADDR because bind doesn't know/care about which address you're listening on. Also, if you're doing something like Apache and spawing off clients from a listener and needing to restart the listener. -- Nick From stuart at stuartbishop.net Mon Feb 16 02:31:09 2004 From: stuart at stuartbishop.net (Stuart Bishop) Date: Mon Feb 16 02:31:28 2004 Subject: [Pythonmac-SIG] How compile pyRXP? In-Reply-To: <0C77E142-5F44-11D8-9CAA-0003933F4628@rafaelguedez.com> References: <0C77E142-5F44-11D8-9CAA-0003933F4628@rafaelguedez.com> Message-ID: <16EC61A0-6052-11D8-969A-000A95A06FC6@stuartbishop.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 15/02/2004, at 10:18 AM, RAFA3L wrote: > Hello all, > > I'm really newbie with Python. How I can compile the module PyRXP > http://www.reportlab.org/pyrxp.html ? You will probably be better off with building the CVS version, which comes with a standard distutils installer. Or asking ReportLab if they have a more recent tarball available for download. > I put the unziped files in Library/Python/2.3/ but I get the same > error when try one open application "ImportError: No module named > pyRXP" Do you mean /Library/Python/2.3 or ~/Library/Python/2.3. I think only the first will work. - -- Stuart Bishop http://www.stuartbishop.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (Darwin) iD8DBQFAMHHFAfqZj7rGN0oRAv6mAJ46tEYlLFKlpOLUOBjjHALdjRrNuQCeOUKL Zeftvg8YXwIkrZY77Yvrn0M= =Ckit -----END PGP SIGNATURE----- From gherman at darwin.in-berlin.de Mon Feb 16 02:58:58 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Mon Feb 16 02:57:48 2004 Subject: [Pythonmac-SIG] How compile pyRXP? In-Reply-To: <0C77E142-5F44-11D8-9CAA-0003933F4628@rafaelguedez.com> Message-ID: RAFA3L: > I'm really newbie with Python. How I can compile the module PyRXP > http://www.reportlab.org/pyrxp.html ? > > I put the unziped files in Library/Python/2.3/ but I get the same > error when try one open application "ImportError: No module named > pyRXP" The following works for me: % which python2.3 /usr/bin/python2.3 % % curl --url http://www.reportlab.com/ftp/pyRXP-0-9.tgz > pyRXP-0-9.tgz % mkdir pyRXP % cp pyRXP-0-9.tgz pyRXP % cd pyRXP % tar xfz pyRXP-0-9.tgz % python setup.py build % sudo python setup.py install % % python2.3 Python 2.3.3 (#1, Feb 2 2004, 19:00:54) [GCC 3.1 20020420 (prerelease)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import pyRXP >>> Dinu -- Dinu C. Gherman - http://python.net/~gherman ...................................................................... "I never apologize for the United States of America, I don't care what the facts are." (George Bush, Sr.) From paul at fxtech.com Mon Feb 16 17:42:39 2004 From: paul at fxtech.com (Paul Miller) Date: Mon Feb 16 17:41:30 2004 Subject: [Pythonmac-SIG] any tips on using MacPython 2.3 (Carbon) *embedded*? In-Reply-To: References: <0C77E142-5F44-11D8-9CAA-0003933F4628@rafaelguedez.com> Message-ID: <6.0.1.1.2.20040216164006.05129008@mail.fxtech.com> I've got an app that embeds the Python 2.3 interpreter. On Windows, I have the python23.dll in my application direction, and a subset of the Python23 Lib directory (contains random.pyc and zlib.pyd, since I import scripts from .zip files), and it works fine. I don't need to actually have Python "installed" per-se. Now I need to do the same thing for Mac, using MacPython 2.3 for Carbon in a CFM app. What hoops do I have to jump through to make something similar to my Windows setup work on Mac? (this will be so much simpler once I no longer need to support CFM...) From paul at fxtech.com Mon Feb 16 18:03:22 2004 From: paul at fxtech.com (Paul Miller) Date: Mon Feb 16 18:02:10 2004 Subject: [Pythonmac-SIG] building MacPython 2.3 with CW8 - possible? In-Reply-To: <6.0.1.1.2.20040216164006.05129008@mail.fxtech.com> References: <0C77E142-5F44-11D8-9CAA-0003933F4628@rafaelguedez.com> <6.0.1.1.2.20040216164006.05129008@mail.fxtech.com> Message-ID: <6.0.1.1.2.20040216170239.0513aec0@mail.fxtech.com> I'm running into tons of GUSI problems with time_t. I'm wondering if it'll be worth building Python at all with CW8, or if I should just install the binary package and get the bits I need. From delza at blastradius.com Mon Feb 16 18:08:07 2004 From: delza at blastradius.com (Dethe Elza) Date: Mon Feb 16 18:08:16 2004 Subject: [Pythonmac-SIG] Menus from pyobjc In-Reply-To: <34C3B674-5E62-11D8-A4CE-000A95686CD8@redivi.com> References: <34C3B674-5E62-11D8-A4CE-000A95686CD8@redivi.com> Message-ID: > Use bundlebuilder to create a nib-less bundle for your app and run it > from there. You're running it from the Python.app bundle (via > pythonw), which does have a nib. > > -bob OK, I've got my application working with bundlebuilder (had to copy in resource files and figure out how to get the current working directory from the list archives). But my app still has the same behaviour. Instead of a Python menu it has a "My Application" menu, where "My Application" is what I put into the bundlebuilder parameter. If I get app.mainMenu() it returns nil. If I set app.mainMenu() it shows "My Application" alone until I click it, then the default menu is empty and the menus I have set are disabled (with two "My Application" menus side by side). It also has some default behavior for hiding, quitting, etc. which I have not added explicitly, and which I don't think it had when I was running it from pythonw. So I'm still not sure how to deal with the menus when running nib-less. Or is there still a nib being included from somewhere? Do I have to tell bundlebuilder explicitly "No Nibs" or is it enough to not provide one? I can't find any sign of a nib in the resulting .app. TIA --Dethe "Why is Virtual Reality always posited in terms of space, when time is the only real commodity left?" --Rich Gold -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2371 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040216/395ba24c/smime.bin From bob at redivi.com Mon Feb 16 18:25:48 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 16 18:22:45 2004 Subject: [Pythonmac-SIG] Menus from pyobjc In-Reply-To: References: <34C3B674-5E62-11D8-A4CE-000A95686CD8@redivi.com> Message-ID: <74270F99-60D7-11D8-ACE9-000A95686CD8@redivi.com> On Feb 16, 2004, at 6:08 PM, Dethe Elza wrote: >> Use bundlebuilder to create a nib-less bundle for your app and run it >> from there. You're running it from the Python.app bundle (via >> pythonw), which does have a nib. > > OK, I've got my application working with bundlebuilder (had to copy in > resource files and figure out how to get the current working directory > from the list archives). > > But my app still has the same behaviour. Instead of a Python menu it > has a "My Application" menu, where "My Application" is what I put into > the bundlebuilder parameter. If I get app.mainMenu() it returns nil. > If I set app.mainMenu() it shows "My Application" alone until I click > it, then the default menu is empty and the menus I have set are > disabled (with two "My Application" menus side by side). > > It also has some default behavior for hiding, quitting, etc. which I > have not added explicitly, and which I don't think it had when I was > running it from pythonw. > > So I'm still not sure how to deal with the menus when running > nib-less. Or is there still a nib being included from somewhere? Do > I have to tell bundlebuilder explicitly "No Nibs" or is it enough to > not provide one? I can't find any sign of a nib in the resulting > .app. If you post a minimal sample of what you're trying to do, I'll [attempt to] fix it and make a PyObjC example out of it. IIRC, you have to do some undocumented voodoo to get the menus to do what you're asking... I did this in PyObjC for recentish versions of pygame (in macosx.py), though it's not particularly well tested because sane people use IB nibs ;) -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040216/1f42176c/smime.bin From robin at reportlab.com Mon Feb 16 18:24:24 2004 From: robin at reportlab.com (Robin Becker) Date: Mon Feb 16 18:25:26 2004 Subject: [Pythonmac-SIG] How compile pyRXP? In-Reply-To: References: <0C77E142-5F44-11D8-9CAA-0003933F4628@rafaelguedez.com> Message-ID: In article , Dinu Gherman writes ...there's probably a later tgz archive than the one that Dinu posted. I'll try to get a regularly updated thing available on the .org site and will post here when that is done. -- Robin Becker From oussoren at cistron.nl Tue Feb 17 01:53:01 2004 From: oussoren at cistron.nl (Ronald Oussoren) Date: Tue Feb 17 01:53:24 2004 Subject: [Pythonmac-SIG] Menus from pyobjc In-Reply-To: <74270F99-60D7-11D8-ACE9-000A95686CD8@redivi.com> References: <34C3B674-5E62-11D8-A4CE-000A95686CD8@redivi.com> <74270F99-60D7-11D8-ACE9-000A95686CD8@redivi.com> Message-ID: On 17-feb-04, at 0:25, Bob Ippolito wrote: > > On Feb 16, 2004, at 6:08 PM, Dethe Elza wrote: > >>> Use bundlebuilder to create a nib-less bundle for your app and run >>> it from there. You're running it from the Python.app bundle (via >>> pythonw), which does have a nib. >> >> OK, I've got my application working with bundlebuilder (had to copy >> in resource files and figure out how to get the current working >> directory from the list archives). >> [...] >> So I'm still not sure how to deal with the menus when running >> nib-less. Or is there still a nib being included from somewhere? Do >> I have to tell bundlebuilder explicitly "No Nibs" or is it enough to >> not provide one? I can't find any sign of a nib in the resulting >> .app. > > If you post a minimal sample of what you're trying to do, I'll > [attempt to] fix it and make a PyObjC example out of it. IIRC, you > have to do some undocumented voodoo to get the menus to do what you're > asking... I did this in PyObjC for recentish versions of pygame (in > macosx.py), though it's not particularly well tested because sane > people use IB nibs ;) Which brings us to a question nobody seems to have asked: why not use a nib in the first place? Even if you want to build you menu dynamicly you could include a minimal menu in the nib and extend that. Ronald -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 From hinsen at cnrs-orleans.fr Tue Feb 17 03:41:56 2004 From: hinsen at cnrs-orleans.fr (hinsen@cnrs-orleans.fr) Date: Tue Feb 17 03:41:11 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: <4AB40A91-5FFC-11D8-8F81-000D934FF6B4@cwi.nl> References: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> <87d68jp8s2.fsf@mally.pyrite.org> <045FB7B7-5E52-11D8-8730-000A959CB2EC@netmail.to> <4AB40A91-5FFC-11D8-8F81-000D934FF6B4@cwi.nl> Message-ID: <24776A48-6125-11D8-ADE2-000A95AB5F10@cnrs-orleans.fr> On 15.02.2004, at 22:16, Jack Jansen wrote: > This wouldn't surprise me in the least. Palm would be stark raving mad > if they dropped the one market where they have a 100% marketshare: no I think the more relevant number for them is the percentage of Palm customers that use a Macintosh. Konrad. From tconner at mac.com Tue Feb 17 09:33:20 2004 From: tconner at mac.com (Tim Conner) Date: Tue Feb 17 09:33:23 2004 Subject: [Pythonmac-SIG] Concatenate PDFS's with python In-Reply-To: References: Message-ID: <3B874001-6156-11D8-9002-000A956834C6@mac.com> I'm looking for some print house type solutions that use coregraphics/quartz and python to manipulate images, eps's, and pdfs. To get started on this quest it would be nice if someone could point me to examples or write a quick sub-routine that would take 2 pdfs and combine them into 1, 2-page pdf. I just need a stepping stone to get me rolling. I also need the same thing for jpegs, but once I see a pdf example, I should hope I can handle that on my own. Thanks, Tim From bob at redivi.com Tue Feb 17 10:02:50 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 17 09:59:55 2004 Subject: [Pythonmac-SIG] Concatenate PDFS's with python In-Reply-To: <3B874001-6156-11D8-9002-000A956834C6@mac.com> References: <3B874001-6156-11D8-9002-000A956834C6@mac.com> Message-ID: <5A9A4A4E-615A-11D8-B0CA-000A95686CD8@redivi.com> On Feb 17, 2004, at 9:33 AM, Tim Conner wrote: > I'm looking for some print house type solutions that use > coregraphics/quartz and python to manipulate images, eps's, and pdfs. > To get started on this quest it would be nice if someone could point > me to examples or write a quick sub-routine that would take 2 pdfs and > combine them into 1, 2-page pdf. I just need a stepping stone to get > me rolling. I also need the same thing for jpegs, but once I see a pdf > example, I should hope I can handle that on my own. OS X 10.3 comes with the CoreGraphics Python extension, and Xcode comes with examples. See /Developer/Examples/Quartz/Python . cover.py may be of particular interest to you. This functionality is not, and probably will never be, available from Python in OS X 10.2.x. -bob From bob at redivi.com Tue Feb 17 13:02:55 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 17 13:21:25 2004 Subject: [Pythonmac-SIG] Concatenate PDFS's with python In-Reply-To: <1114530.1077040627280.JavaMail.tconner@mac.com> References: <1114530.1077040627280.JavaMail.tconner@mac.com> Message-ID: <82E6469E-6173-11D8-B0CA-000A95686CD8@redivi.com> from cover.py, the example I recommended: def usage (): print ''' usage: python cover.py [OPTION]... PDF-FILES... *****Add***** a cover page to one or more PDF documents. ...... emphasis mine :) -bob On Feb 17, 2004, at 12:57 PM, Tim Conner wrote: > I've looked at those examples and they show how to create a pdf, not > manipulate an existing one. They are good py examples, but not for the > topic I'm looking for. :) > > Thanks, > > Tim > > On Tuesday, February 17, 2004, at 09:02AM, Bob Ippolito > wrote >> On Feb 17, 2004, at 9:33 AM, Tim Conner wrote: >> >>> I'm looking for some print house type solutions that use >>> coregraphics/quartz and python to manipulate images, eps's, and pdfs. >>> To get started on this quest it would be nice if someone could point >>> me to examples or write a quick sub-routine that would take 2 pdfs >>> and >>> combine them into 1, 2-page pdf. I just need a stepping stone to get >>> me rolling. I also need the same thing for jpegs, but once I see a >>> pdf >>> example, I should hope I can handle that on my own. >> >> OS X 10.3 comes with the CoreGraphics Python extension, and Xcode >> comes >> with examples. See /Developer/Examples/Quartz/Python . cover.py may >> be of particular interest to you. >> >> This functionality is not, and probably will never be, available from >> Python in OS X 10.2.x. >> >> -bob >> >> >> From tconner at mac.com Tue Feb 17 12:57:07 2004 From: tconner at mac.com (Tim Conner) Date: Tue Feb 17 13:21:31 2004 Subject: [Pythonmac-SIG] Concatenate PDFS's with python Message-ID: <1114530.1077040627280.JavaMail.tconner@mac.com> I've looked at those examples and they show how to create a pdf, not manipulate an existing one. They are good py examples, but not for the topic I'm looking for. :) Thanks, Tim On Tuesday, February 17, 2004, at 09:02AM, Bob Ippolito wrote >On Feb 17, 2004, at 9:33 AM, Tim Conner wrote: > >> I'm looking for some print house type solutions that use >> coregraphics/quartz and python to manipulate images, eps's, and pdfs. >> To get started on this quest it would be nice if someone could point >> me to examples or write a quick sub-routine that would take 2 pdfs and >> combine them into 1, 2-page pdf. I just need a stepping stone to get >> me rolling. I also need the same thing for jpegs, but once I see a pdf >> example, I should hope I can handle that on my own. > >OS X 10.3 comes with the CoreGraphics Python extension, and Xcode comes >with examples. See /Developer/Examples/Quartz/Python . cover.py may >be of particular interest to you. > >This functionality is not, and probably will never be, available from >Python in OS X 10.2.x. > >-bob > > > From chris at fonnesbeck.org Tue Feb 17 13:08:27 2004 From: chris at fonnesbeck.org (Christopher Fonnesbeck) Date: Tue Feb 17 13:22:07 2004 Subject: [Pythonmac-SIG] Python package directory confusion Message-ID: <4901E462-6174-11D8-86FB-000A956FDAC0@fonnesbeck.org> It seems as though my python installation on 10.3 is messed up. After installing some packages, python is unable to see some packages that are clearly present (e.g. Numeric). Upon inspection, I see that I have 2 package directories, /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/ site-packages/ and /Library/Python/2.3, the former being empty. Why are there 2 locations, and why is MacPython using the empty one? More importantly, how can I avoid this problem in the future? Thanks, C. -- Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g ) Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia From claird at lairds.com Tue Feb 17 13:52:51 2004 From: claird at lairds.com (Cameron Laird) Date: Tue Feb 17 13:53:01 2004 Subject: [Pythonmac-SIG] Concatenate PDFS's with python In-Reply-To: <3B874001-6156-11D8-9002-000A956834C6@mac.com> Message-ID: > From pythonmac-sig-bounces@python.org Tue Feb 17 09:33:51 2004 > . > . > . > I'm looking for some print house type solutions that use > coregraphics/quartz and python to manipulate images, eps's, and pdfs. > To get started on this quest it would be nice if someone could point me > to examples or write a quick sub-routine that would take 2 pdfs and > combine them into 1, 2-page pdf. I just need a stepping stone to get me > rolling. I also need the same thing for jpegs, but once I see a pdf > example, I should hope I can handle that on my own. > . > . > . I've got a lot to say on this subject, but no time now to cover it. You might want to start, though, with . From rowen at cesmail.net Tue Feb 17 16:25:36 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Tue Feb 17 16:26:19 2004 Subject: [Pythonmac-SIG] Re: Beginner's query: Path configuration in OS X 10.3 References: <4BDEE730-5E25-11D8-8F64-000A958D1666@cwi.nl> Message-ID: In article <4BDEE730-5E25-11D8-8F64-000A958D1666@cwi.nl>, Jack Jansen wrote: > On 13-feb-04, at 4:58, kevin wrote: > > > seems like a big source of confusion. I always forget this too and am > > hoping that this makes it into the FAQ as the FAQ seems to be filled > > with stuff for folks who are powerusers and precious little for folks > > who are just setting out. > > Definitely! > > > I'm adding all the questions (and answers) that appear here to the FAQ, > but I could definitely use some proofreading. And proofreading by a > novice is especially welcome, because I'm definitely going to think > some things are obvious, while they may be obvious to me but not to the > rest of the world. > > So please read the FAQ and comment on it, Setting up environment.plist (and why you may want to do it) is discussed at . Feel free to add that info or a link. -- Russell From rowen at cesmail.net Tue Feb 17 16:33:25 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Tue Feb 17 16:33:32 2004 Subject: [Pythonmac-SIG] Re: bundlebuilder tutorial available References: Message-ID: In article , "Russell E. Owen" wrote: > I have made a tutorial for bundlebuilder available at > . > > It does not mention Bob Ippolito's nifty-sounding bundlebuilder2 preview > as I wasn't sure how widely that should be advertised. > > Comments and corrections welcome, as always. I could try to put this on > the FAQ wiki if folks think it worthwhile. > > Also, my instructions for installing Tkinter have been updated. They now > include instructions for Aqua Tkinter--nearly trivial, of course--and > also for X11 Tkinter > . Somebody has added a nice bundlebuilder page to the FAQ, rendering my page obsolete. Thank you very much whoever did that! I have modified my home page to point to the wiki and have ditched my tutorial (though it included a more complex example that showed how to unzip the modules.zip file, so if anyone needs that, contact me). -- Russell From tconner at mac.com Tue Feb 17 17:04:18 2004 From: tconner at mac.com (Tim Conner) Date: Tue Feb 17 17:04:23 2004 Subject: [Pythonmac-SIG] Concatenate PDFS's with python Message-ID: <1026304.1077055458098.JavaMail.tconner@mac.com> My apologies, you were correct. I want to input multiple pdfs and have them combine. I'm sure the command is in there... we'll see how I do and I'll post the results here. Thanks, Tim On Tuesday, February 17, 2004, at 12:02PM, Bob Ippolito wrote: >from cover.py, the example I recommended: > >def usage (): > print ''' >usage: python cover.py [OPTION]... PDF-FILES... > >*****Add***** a cover page to one or more PDF documents. >...... > >emphasis mine :) > >-bob > >On Feb 17, 2004, at 12:57 PM, Tim Conner wrote: > >> I've looked at those examples and they show how to create a pdf, not >> manipulate an existing one. They are good py examples, but not for the >> topic I'm looking for. :) >> >> Thanks, >> >> Tim >> >> On Tuesday, February 17, 2004, at 09:02AM, Bob Ippolito >> wrote >>> On Feb 17, 2004, at 9:33 AM, Tim Conner wrote: >>> >>>> I'm looking for some print house type solutions that use >>>> coregraphics/quartz and python to manipulate images, eps's, and pdfs. >>>> To get started on this quest it would be nice if someone could point >>>> me to examples or write a quick sub-routine that would take 2 pdfs >>>> and >>>> combine them into 1, 2-page pdf. I just need a stepping stone to get >>>> me rolling. I also need the same thing for jpegs, but once I see a >>>> pdf >>>> example, I should hope I can handle that on my own. >>> >>> OS X 10.3 comes with the CoreGraphics Python extension, and Xcode >>> comes >>> with examples. See /Developer/Examples/Quartz/Python . cover.py may >>> be of particular interest to you. >>> >>> This functionality is not, and probably will never be, available from >>> Python in OS X 10.2.x. >>> >>> -bob >>> >>> >>> > > > From delza at blastradius.com Tue Feb 17 17:56:34 2004 From: delza at blastradius.com (Dethe Elza) Date: Tue Feb 17 17:56:42 2004 Subject: [Pythonmac-SIG] Menus from pyobjc In-Reply-To: References: <34C3B674-5E62-11D8-A4CE-000A95686CD8@redivi.com> <74270F99-60D7-11D8-ACE9-000A95686CD8@redivi.com> Message-ID: <88DA7582-619C-11D8-8E8C-0003939B59E8@blastradius.com> > On 17-feb-04, at 0:25, Bob Ippolito wrote: >> If you post a minimal sample of what you're trying to do, I'll >> [attempt to] fix it and make a PyObjC example out of it. IIRC, you >> have to do some undocumented voodoo to get the menus to do what >> you're asking... I did this in PyObjC for recentish versions of >> pygame (in macosx.py), though it's not particularly well tested >> because sane people use IB nibs ;) I'll try to put together a simple example tonight. On 16-Feb-04, at 10:53 PM, Ronald Oussoren wrote: > Which brings us to a question nobody seems to have asked: why not use > a nib in the first place? I don't like using code I don't understand, if I can help it. I've read that .nib files are serialized objects, so it should be possible to just instantiate the objects myself. I'm also interested in alternative ways of building UIs besided IB (nice as IB is), for example by using an XML description file in place of a nib file. > Even if you want to build you menu dynamicly you could include a > minimal menu in the nib and extend that. If there isn't another way then I'll certainly take that route, but I want to know a) that there isn't any other way, and b) why not. --Dethe As for intelligent machines taking over, a machine does not have to be intelligent to conquer the world; it merely has to be desireable. We've already lost a war to a synthetic species--the automobile--that has killed more than 15 million people; occupied all of our cities except Venice, Italy; and continues to exact crushing taxes in resources, wealth, and time from over half the planet--and everybody wants one. --Grant Thompson -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2371 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040217/7f5fcadc/smime.bin From delza at blastradius.com Tue Feb 17 18:14:05 2004 From: delza at blastradius.com (Dethe Elza) Date: Tue Feb 17 18:14:12 2004 Subject: [Pythonmac-SIG] Menus from pyobjc In-Reply-To: <74270F99-60D7-11D8-ACE9-000A95686CD8@redivi.com> References: <74270F99-60D7-11D8-ACE9-000A95686CD8@redivi.com> Message-ID: On 16-Feb-04, at 3:25 PM, Bob Ippolito wrote: > If you post a minimal sample of what you're trying to do, I'll [attempt > to] fix it and make a PyObjC example out of it. IIRC, you have to do > some undocumented voodoo to get the menus to do what you're asking... I > did this in PyObjC for recentish versions of pygame (in macosx.py), > though it's not particularly well tested because sane people use IB > nibs ;) Never let me be accused of being sane. My last job title was "Chief Mad Scientist." Here's a minimal example, for some value of "minimal". --Dethe import objc from Foundation import * from AppKit import * import random class TextView(NSTextView): def change(self): data = ('A stitch in time saves nine. Nine what?', 'Early to bed and early to rise, makes a man healthy, wealthy, and sleepy', 'The early bird gets the worm. He can have it.') currText = self.textStorage() newText = random.choice(data) length = currText.length() currText.replaceCharactersInRange_withString_((0,length), newText) class AppDelegate(NSObject): def setApp_(self, app): self.app = app def windowWillClose_(self, notification): self.app.terminate_(self) def initWindow(delegate): windowRect = NSMakeRect(100.0, 0.0, 282.0, 153.0) window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_( windowRect, NSTitledWindowMask | NSClosableWindowMask # | NSResizableWindowMask | NSMiniaturizableWindowMask | NSTexturedBackgroundWindowMask, NSBackingStoreBuffered, False) window.setTitle_('My Test App') window.setDelegate_(delegate) view = initView() window.contentView().addSubview_(view) window.contentView().addSubview_(initButton(view)) window.display() window.orderFrontRegardless() return window def initView(): graphicsRect = NSMakeRect(20.0, 40.0, 240.0, 110.0) view = TextView.alloc().initWithFrame_(graphicsRect) view.change() view.setFont_(NSFont.fontWithName_size_('Apple LiGothic Medium',24.0)) view.setAlignment_(NSCenterTextAlignment) view.setEditable_(False) return view def initButton(view): button = NSButton.alloc().initWithFrame_(((100,5),(80,30))) button.setBezelStyle_(NSRoundedBezelStyle) button.setTitle_('Think') button.setTarget_(view) button.setAction_('change') return button def main(): app = NSApplication.sharedApplication() delegate = AppDelegate.alloc().init() delegate.setApp_(app) setupMenus(app, delegate) window = initWindow(delegate) app.run() def setupMenus(app, delegate): mainmenu = NSMenu.alloc().init() app.setMainMenu_(mainmenu) appMenuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('My Sample App', 'sample', '') fileMenuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('File', 'file', '') editMenuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('Edit', 'edit', '') mainmenu.addItem_(appMenuItem) mainmenu.addItem_(fileMenuItem) mainmenu.addItem_(editMenuItem) appMenu = NSMenu.alloc().init() fileMenu = NSMenu.alloc().init() editMenu = NSMenu.alloc().init() appMenuItem.setSubmenu_(appMenu) fileMenuItem.setSubmenu_(fileMenu) editMenuItem.setSubmenu_(editMenu) appMenuItem.setEnabled_(True) fileMenuItem.setEnabled_(True) editMenuItem.setEnabled_(True) aboutItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('About My Sample App...', 'about', '') aboutItem.setTarget_(delegate) appMenu.addItem_(aboutItem) appMenu.addItemWithTitle_action_keyEquivalent_('Preferences...', 'prefs', '') appMenu.addItemWithTitle_action_keyEquivalent_('Hide My Sample App', 'hide', 'h') appMenu.addItemWithTitle_action_keyEquivalent_('Hide Others', 'hideOthers', '') quitItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('Quit', 'quit', 'q') quitItem.setTarget_(delegate) appMenu.addItem_(quitItem) fileMenu.addItemWithTitle_action_keyEquivalent_('Open', 'open', '') fileMenu.addItemWithTitle_action_keyEquivalent_('Close', 'close', 'w') editMenu.addItemWithTitle_action_keyEquivalent_('Cut', 'cut', 'x') editMenu.addItemWithTitle_action_keyEquivalent_('Copy', 'copy', 'c') editMenu.addItemWithTitle_action_keyEquivalent_('Paste', 'paste', 'v') if __name__ == '__main__': main() "the city carries such a cargo of pathos and longing that daily life there vaccinates us against revelation" -- Pain Not Bread, The Rise and Fall of Human Breath -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2371 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040217/04848ef1/smime-0001.bin From gherman at darwin.in-berlin.de Wed Feb 18 02:52:17 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Wed Feb 18 02:51:31 2004 Subject: [Pythonmac-SIG] Concatenate PDFS's with python In-Reply-To: <3B874001-6156-11D8-9002-000A956834C6@mac.com> Message-ID: <5F8F766E-61E7-11D8-BA21-00039345C610@darwin.in-berlin.de> Tim Conner: > I'm looking for some print house type solutions that use > coregraphics/quartz and python to manipulate images, eps's, and pdfs. > To get started on this quest it would be nice if someone could point > me to examples or write a quick sub-routine that would take 2 pdfs and > combine them into 1, 2-page pdf. I just need a stepping stone to get > me rolling. I also need the same thing for jpegs, but once I see a pdf > example, I should hope I can handle that on my own. I tried that on 10.2 using NSPDFView or something like that and it just did not have the right methods to accomplish that kind of task, i.e. picking/displaying single pages from a PDF would work, but not reassembling them in a new PDF file. I'd be grate- ful to know if that changed on 10.3... OTOH, there is ReportLab's PageCatcher module which I used to work with, but which has changing "usage philosophies", i.e. it used to be a standalone product, then it was bundled into some huge enterprise product, then it became sort of free for members of the ReportLab Developper Network. Now I'm pretty much lost... See also the links below. http://python.net/~gherman/RLTK.html http://www.reportlab.com/pagecatcher_index.html In former times I had written a Mac OS X app named Papaguino, which was a GUI around PageCatcher. Its still around, but re- quires a Python installation in /usr/local/bin. I could well repackage Papaguino into a pure Python app, but given the PageCatcher licensing uncertainties, I'm not very eager on doing that. http://python.net/~gherman/Papaguino.html Finally, you may want to try PDFpen which was recently reviewed favourably in a magazine, although it might be slow on huge docu- ments... It seems like it does all that Papaguino does, plus a few more things: http://www.smileonmymac.com/pdfpen/ Hope that helps, Dinu -- Dinu C. Gherman - http://python.net/~gherman ...................................................................... "The best way to predict the future is to invent it." (Alan Kay) From piet at cs.uu.nl Wed Feb 18 11:24:32 2004 From: piet at cs.uu.nl (Piet van Oostrum) Date: Wed Feb 18 11:24:31 2004 Subject: [Pythonmac-SIG] Python package directory confusion In-Reply-To: <4901E462-6174-11D8-86FB-000A956FDAC0@fonnesbeck.org> Message-ID: >>>>> Christopher Fonnesbeck (CF) wrote: CF> It seems as though my python installation on 10.3 is messed up. After CF> installing some packages, python is unable to see some packages that are CF> clearly present (e.g. Numeric). Upon inspection, I see that I have 2 CF> package directories, CF> /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/ CF> site-packages/ and /Library/Python/2.3, the former being empty. Why are CF> there 2 locations, and why is MacPython using the empty one? More CF> importantly, how can I avoid this problem in the future? /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages should be a symlink to /Library/Python/2.3, I think. And some package installation script may have messed it up. Python always looks in the former, but the latter is easier for you if you want to drop something in it. -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP] Private email: P.van.Oostrum@hccnet.nl From bob at redivi.com Wed Feb 18 11:49:44 2004 From: bob at redivi.com (Bob Ippolito) Date: Wed Feb 18 11:46:40 2004 Subject: [Pythonmac-SIG] Python package directory confusion In-Reply-To: <4901E462-6174-11D8-86FB-000A956FDAC0@fonnesbeck.org> References: <4901E462-6174-11D8-86FB-000A956FDAC0@fonnesbeck.org> Message-ID: <745E20E9-6232-11D8-B0CA-000A95686CD8@redivi.com> On Feb 17, 2004, at 1:08 PM, Christopher Fonnesbeck wrote: > It seems as though my python installation on 10.3 is messed up. After > installing some packages, python is unable to see some packages that > are clearly present (e.g. Numeric). Upon inspection, I see that I have > 2 package directories, > /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/site-packages/ and /Library/Python/2.3, the former being > empty. Why are there 2 locations, and why is MacPython using the empty > one? More importantly, how can I avoid this problem in the future? The former is supposed to be a symlink to the latter, not a folder. I don't know how that got screwed up, as I've never seen it happen. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040218/f0a55922/smime.bin From bob at redivi.com Wed Feb 18 12:22:28 2004 From: bob at redivi.com (Bob Ippolito) Date: Wed Feb 18 12:54:18 2004 Subject: [Pythonmac-SIG] Re: bundlebuilder tutorial available In-Reply-To: References: Message-ID: <06F1411E-6237-11D8-B0CA-000A95686CD8@redivi.com> On Feb 17, 2004, at 4:33 PM, Russell E. Owen wrote: > In article , > "Russell E. Owen" wrote: > >> I have made a tutorial for bundlebuilder available at >> . >> >> It does not mention Bob Ippolito's nifty-sounding bundlebuilder2 >> preview >> as I wasn't sure how widely that should be advertised. >> >> Comments and corrections welcome, as always. I could try to put this >> on >> the FAQ wiki if folks think it worthwhile. >> >> Also, my instructions for installing Tkinter have been updated. They >> now >> include instructions for Aqua Tkinter--nearly trivial, of course--and >> also for X11 Tkinter >> . > > Somebody has added a nice bundlebuilder page to the FAQ, rendering my > page obsolete. > > Thank you very much whoever did that! > > I have modified my home page to point to the wiki and have ditched my > tutorial (though it included a more complex example that showed how to > unzip the modules.zip file, so if anyone needs that, contact me). One of the features I'm going to add to bundlebuilder2 is a toggle for the zip import hook, which is often more trouble than it's worth... so that longer example will be unnecessary sometime soon. Not to mention the fact that bb2 can figure out what non-system frameworks you're using and appropriately relocate their mach-o headers and include them automagically. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040218/e9196065/smime.bin From israel at uandmedance.com Wed Feb 18 13:37:15 2004 From: israel at uandmedance.com (israel@uandmedance.com) Date: Wed Feb 18 13:36:54 2004 Subject: [Pythonmac-SIG] Concatenate PDFS's with python In-Reply-To: <5F8F766E-61E7-11D8-BA21-00039345C610@darwin.in-berlin.de> Message-ID: <7925CF8E-6241-11D8-A9EC-000393A47FF2@uandmedance.com> Hear is a little hint that I found on Macosxhints.com: http://www.macosxhints.com/article.php?story=20020714102702896 On Tuesday, February 17, 2004, at 11:52 PM, Dinu Gherman wrote: > Tim Conner: > >> I'm looking for some print house type solutions that use >> coregraphics/quartz and python to manipulate images, eps's, and pdfs. >> To get started on this quest it would be nice if someone could point >> me to examples or write a quick sub-routine that would take 2 pdfs >> and combine them into 1, 2-page pdf. I just need a stepping stone to >> get me rolling. I also need the same thing for jpegs, but once I see >> a pdf example, I should hope I can handle that on my own. > > I tried that on 10.2 using NSPDFView or something like that and > it just did not have the right methods to accomplish that kind > of task, i.e. picking/displaying single pages from a PDF would > work, but not reassembling them in a new PDF file. I'd be grate- > ful to know if that changed on 10.3... > > OTOH, there is ReportLab's PageCatcher module which I used to > work with, but which has changing "usage philosophies", i.e. it > used to be a standalone product, then it was bundled into some > huge enterprise product, then it became sort of free for members > of the ReportLab Developper Network. Now I'm pretty much lost... > See also the links below. > > http://python.net/~gherman/RLTK.html > http://www.reportlab.com/pagecatcher_index.html > > In former times I had written a Mac OS X app named Papaguino, > which was a GUI around PageCatcher. Its still around, but re- > quires a Python installation in /usr/local/bin. I could well > repackage Papaguino into a pure Python app, but given the > PageCatcher licensing uncertainties, I'm not very eager on > doing that. > > http://python.net/~gherman/Papaguino.html > > Finally, you may want to try PDFpen which was recently reviewed > favourably in a magazine, although it might be slow on huge docu- > ments... It seems like it does all that Papaguino does, plus a > few more things: > > http://www.smileonmymac.com/pdfpen/ > > Hope that helps, > > Dinu > > -- > Dinu C. Gherman - http://python.net/~gherman > ...................................................................... > "The best way to predict the future is to invent it." (Alan Kay) > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > > ~Israel~ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2508 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040218/d3c2f216/attachment.bin From bob at redivi.com Wed Feb 18 13:35:26 2004 From: bob at redivi.com (Bob Ippolito) Date: Wed Feb 18 14:14:08 2004 Subject: [Pythonmac-SIG] Concatenate PDFS's with python In-Reply-To: <5F8F766E-61E7-11D8-BA21-00039345C610@darwin.in-berlin.de> References: <5F8F766E-61E7-11D8-BA21-00039345C610@darwin.in-berlin.de> Message-ID: <38A4CF92-6241-11D8-8F69-000A95686CD8@redivi.com> On Feb 18, 2004, at 2:52 AM, Dinu Gherman wrote: > Tim Conner: > >> I'm looking for some print house type solutions that use >> coregraphics/quartz and python to manipulate images, eps's, and pdfs. >> To get started on this quest it would be nice if someone could point >> me to examples or write a quick sub-routine that would take 2 pdfs >> and combine them into 1, 2-page pdf. I just need a stepping stone to >> get me rolling. I also need the same thing for jpegs, but once I see >> a pdf example, I should hope I can handle that on my own. > > I tried that on 10.2 using NSPDFView or something like that and > it just did not have the right methods to accomplish that kind > of task, i.e. picking/displaying single pages from a PDF would > work, but not reassembling them in a new PDF file. I'd be grate- > ful to know if that changed on 10.3... You should use the lower level CoreGraphics framework to deal with these sorts of issues. Apple distributes a closed source SWIG wrapper for this CoreFoundation based C API with their Python 2.3.0 on OS X 10.3, but you could always use it from C (or Pyrex, etc.). There is a partial bgen-created CoreGraphics wrapper in Python, but last I checked it doesn't wrap enough stuff to be very useful at all. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040218/4bfc98d7/smime.bin From Larry.A.Meyn at nasa.gov Wed Feb 18 15:41:48 2004 From: Larry.A.Meyn at nasa.gov (Larry Meyn) Date: Wed Feb 18 15:42:07 2004 Subject: [Pythonmac-SIG] Python package directory confusion In-Reply-To: <4901E462-6174-11D8-86FB-000A956FDAC0@fonnesbeck.org> References: <4901E462-6174-11D8-86FB-000A956FDAC0@fonnesbeck.org> Message-ID: I had this problem a couple of weeks ago (see this list on Feb 4, 2004), with the symbolic link to the site-packages folder having been somehow converted into an empty folder. This occurred after I installed the latest Tcl/Tk, but that may have been a coincidence. The fix is to recreate the symbolic link. Larry Meyn On Feb 17, 2004, at 10:08 AM, Christopher Fonnesbeck wrote: > It seems as though my python installation on 10.3 is messed up. After > installing some packages, python is unable to see some packages that > are clearly present (e.g. Numeric). Upon inspection, I see that I have > 2 package directories, > /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/site-packages/ and /Library/Python/2.3, the former being > empty. Why are there 2 locations, and why is MacPython using the empty > one? More importantly, how can I avoid this problem in the future? > > Thanks, > C. > -- > Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g ) > Georgia Cooperative Fish & Wildlife Research Unit, University of > Georgia > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > > From chris at fonnesbeck.org Wed Feb 18 17:33:41 2004 From: chris at fonnesbeck.org (Christopher Fonnesbeck) Date: Wed Feb 18 17:33:51 2004 Subject: [Pythonmac-SIG] Python package directory confusion In-Reply-To: <8EA835D7-6262-11D8-8F69-000A95686CD8@redivi.com> References: <4901E462-6174-11D8-86FB-000A956FDAC0@fonnesbeck.org> <8EA835D7-6262-11D8-8F69-000A95686CD8@redivi.com> Message-ID: <80F73069-6262-11D8-B7A7-000A956FDAC0@fonnesbeck.org> On Feb 18, 2004, at 5:34 PM, Bob Ippolito wrote: > I would probably guess that a bad PackageManager package could do > this though. Hopefully it's one of Jack's and not mine ;) It would > be nice to know, either way. It **may** have been PyObjC, as it is the only thing I have installed recently through package manager. C. -- Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g ) Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia From bob at redivi.com Wed Feb 18 17:34:04 2004 From: bob at redivi.com (Bob Ippolito) Date: Wed Feb 18 17:41:32 2004 Subject: [Pythonmac-SIG] Python package directory confusion In-Reply-To: References: <4901E462-6174-11D8-86FB-000A956FDAC0@fonnesbeck.org> Message-ID: <8EA835D7-6262-11D8-8F69-000A95686CD8@redivi.com> I would say that installation of Tcl/Tk stomping over a single symlink in the Python.framework is rather unlikely, to say the least. I would probably guess that a bad PackageManager package could do this though. Hopefully it's one of Jack's and not mine ;) It would be nice to know, either way. -bob On Feb 18, 2004, at 3:41 PM, Larry Meyn wrote: > I had this problem a couple of weeks ago (see this list on Feb 4, > 2004), with the symbolic link to the site-packages folder having been > somehow converted into an empty folder. This occurred after I > installed the latest Tcl/Tk, but that may have been a coincidence. > The fix is to recreate the symbolic link. > > On Feb 17, 2004, at 10:08 AM, Christopher Fonnesbeck wrote: > >> It seems as though my python installation on 10.3 is messed up. After >> installing some packages, python is unable to see some packages that >> are clearly present (e.g. Numeric). Upon inspection, I see that I >> have 2 package directories, >> /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ >> python2.3/site-packages/ and /Library/Python/2.3, the former being >> empty. Why are there 2 locations, and why is MacPython using the >> empty one? More importantly, how can I avoid this problem in the >> future? From Larry.A.Meyn at nasa.gov Wed Feb 18 18:29:30 2004 From: Larry.A.Meyn at nasa.gov (Larry Meyn) Date: Wed Feb 18 18:29:40 2004 Subject: [Pythonmac-SIG] Python package directory confusion In-Reply-To: <80F73069-6262-11D8-B7A7-000A956FDAC0@fonnesbeck.org> References: <4901E462-6174-11D8-86FB-000A956FDAC0@fonnesbeck.org> <8EA835D7-6262-11D8-8F69-000A95686CD8@redivi.com> <80F73069-6262-11D8-B7A7-000A956FDAC0@fonnesbeck.org> Message-ID: <4CFACD08-626A-11D8-AB89-000A95A06CF6@nasa.gov> The last version of PyObjC I installed was the package from the sourceforge site, "pyobjc-1.1a0-panther.dmg", not the package manager. I tried reinstalling it, but the symlink was not altered, so the culprit is still a mystery. -Larry On Feb 18, 2004, at 2:33 PM, Christopher Fonnesbeck wrote: > > On Feb 18, 2004, at 5:34 PM, Bob Ippolito wrote: > >> I would probably guess that a bad PackageManager package could do >> this though. Hopefully it's one of Jack's and not mine ;) It would >> be nice to know, either way. > > It **may** have been PyObjC, as it is the only thing I have installed > recently through package manager. > > C. > > -- > Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g ) > Georgia Cooperative Fish & Wildlife Research Unit, University of > Georgia > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > > Larry Meyn Aerospace Operations Modeling Office M/S 210-10 NASA Ames Research Center Moffett Field, CA 94035-1000 E-mail: Larry.A.Meyn@nasa.gov Phone: (650) 604-5038 Fax: (650) 604-0222 E-Fax: (425) 944-5526 sent via e-mail -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1340 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040218/11458d02/attachment-0001.bin From bob at redivi.com Wed Feb 18 21:26:33 2004 From: bob at redivi.com (Bob Ippolito) Date: Wed Feb 18 21:23:23 2004 Subject: [Pythonmac-SIG] Plea for function/method syntax sugar (PEP 318, with a different syntax) Message-ID: <08F6B684-6283-11D8-8F69-000A95686CD8@redivi.com> Some time ago, mwh developed a patch that adds some syntactical sugar to def, which is equivalent to PEP 318 though it has a different and more flexible syntax... previous threads can be easily found here: http://www.google.com/search?q=+site:mail.python.org+%22meth-syntax- sugar%22 the latest version of mwh's patch is here: http://starship.python.net/crew/mwh/hacks/meth-syntax-sugar-3.diff Here's a quick overview: def foo(args) [sugary, expressions, list]: pass This is equivalent to: def foo(args): pass foo = list(expressions(sugary(foo))) This evaluation order is Guido approved, though at least one person wanted it to be the other way around One would use this in scenarios such as: class FooClass(object): def className(klass) [classmethod]: return klass.__name__ or, even more importantly (to me anyway): # we would change PyObjC to make this a built-in feature.. but, for completeness: import objc def signature(sig): def _signature(fn): return objc.selector(fn, signature=sig) return _signature class FooClass(NSObject): def returnsAnInteger(self) [signature('i@:')]: return 1 def returnsVoidTakesAnInteger_(self, anInteger) [signature('v@:i')]: pass With current syntax, PyObjC is extremely cumbersome: class FooClass(NSObject): def returnsAnInteger(self): return 1 returnsAnInteger = objc.selector(returnsAnInteger, signature='i@:') def returnsVoidTakesAnInteger_(self, anInteger): pass returnsVoidTakesAnInteger_ = objc.selector(returnsVoidTakesAnInteger_, signature='v@:i') # these are actually short examples, compare to something like: # textView_completions_forPartialWordRange_indexOfSelectedItem_ Why we need this: Without it, it's hard use PyObjC correctly. ObjC selector nomenclature is extremely verbose, and your fingers hurt after a while having to type each function name three times. The function __name__ is important, because the objc.selector type has to convert it to a selector:that:uses:colons:, or else the colon:using:name: would have to be specified manually. It makes classmethod/staticmethod/etc more palatable. What the patch doesn't do: lambda is not allowed in the "sugary expressions list" there's no *expansion and it won't take an actual list so if you want a prebaked list of transformations then you'll have to roll a callable that does it such as: def prebake(*expressions): def _prebake(fn): for transformation in expressions: fn = transformation(fn) return fn return fn This syntactical sugar for def is so unbelievably important to PyObjC (and likely other projects) that I am willing to distribute my own modified version of Python if it doesn't make 2.4 (though I would probably use Stackless as the base, but that's another plea for another day). The patch looks like it still applies to CVS HEAD, but there is a little fuzz on hunk 2. I have not tested it yet, but I have tested it against CVS HEAD of the 2.3.3 based Stackless. I'm willing to help however I can in order to get this into Python 2.4. -bob From lanceboyle at myrealbox.com Wed Feb 18 23:12:15 2004 From: lanceboyle at myrealbox.com (Lance Boyle) Date: Wed Feb 18 23:12:22 2004 Subject: [Pythonmac-SIG] Concatenate PDFS's with python In-Reply-To: <7925CF8E-6241-11D8-A9EC-000393A47FF2@uandmedance.com> References: <7925CF8E-6241-11D8-A9EC-000393A47FF2@uandmedance.com> Message-ID: Well, for that matter, I _think_ you can drag-and-drop into TextEdit and/or Preview and Save As.... That should be scriptable. macoshints might have covered that, too. Lance On Feb 18, 2004, at 11:37 AM, israel@uandmedance.com wrote: > Hear is a little hint that I found on Macosxhints.com: > > http://www.macosxhints.com/article.php?story=20020714102702896 > > > > On Tuesday, February 17, 2004, at 11:52 PM, Dinu Gherman wrote: > >> Tim Conner: >> >>> I'm looking for some print house type solutions that use >>> coregraphics/quartz and python to manipulate images, eps's, and >>> pdfs. To get started on this quest it would be nice if someone could >>> point me to examples or write a quick sub-routine that would take 2 >>> pdfs and combine them into 1, 2-page pdf. I just need a stepping >>> stone to get me rolling. I also need the same thing for jpegs, but >>> once I see a pdf example, I should hope I can handle that on my own. >> >> I tried that on 10.2 using NSPDFView or something like that and >> it just did not have the right methods to accomplish that kind >> of task, i.e. picking/displaying single pages from a PDF would >> work, but not reassembling them in a new PDF file. I'd be grate- >> ful to know if that changed on 10.3... >> >> OTOH, there is ReportLab's PageCatcher module which I used to >> work with, but which has changing "usage philosophies", i.e. it >> used to be a standalone product, then it was bundled into some >> huge enterprise product, then it became sort of free for members >> of the ReportLab Developper Network. Now I'm pretty much lost... >> See also the links below. >> >> http://python.net/~gherman/RLTK.html >> http://www.reportlab.com/pagecatcher_index.html >> >> In former times I had written a Mac OS X app named Papaguino, >> which was a GUI around PageCatcher. Its still around, but re- >> quires a Python installation in /usr/local/bin. I could well >> repackage Papaguino into a pure Python app, but given the >> PageCatcher licensing uncertainties, I'm not very eager on >> doing that. >> >> http://python.net/~gherman/Papaguino.html >> >> Finally, you may want to try PDFpen which was recently reviewed >> favourably in a magazine, although it might be slow on huge docu- >> ments... It seems like it does all that Papaguino does, plus a >> few more things: >> >> http://www.smileonmymac.com/pdfpen/ >> >> Hope that helps, >> >> Dinu >> >> -- >> Dinu C. Gherman - http://python.net/~gherman >> ...................................................................... >> "The best way to predict the future is to invent it." (Alan Kay) >> >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG@python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> >> > > > > ~Israel~ > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From oussoren at cistron.nl Thu Feb 19 02:02:43 2004 From: oussoren at cistron.nl (Ronald Oussoren) Date: Thu Feb 19 02:03:14 2004 Subject: [Pythonmac-SIG] Python package directory confusion In-Reply-To: <4CFACD08-626A-11D8-AB89-000A95A06CF6@nasa.gov> References: <4901E462-6174-11D8-86FB-000A956FDAC0@fonnesbeck.org> <8EA835D7-6262-11D8-8F69-000A95686CD8@redivi.com> <80F73069-6262-11D8-B7A7-000A956FDAC0@fonnesbeck.org> <4CFACD08-626A-11D8-AB89-000A95A06CF6@nasa.gov> Message-ID: <9D2F5DBC-62A9-11D8-8BF8-0003931CFE24@cistron.nl> On 19-feb-04, at 0:29, Larry Meyn wrote: > The last version of PyObjC I installed was the package from the > sourceforge site, "pyobjc-1.1a0-panther.dmg", not the package manager. > I tried reinstalling it, but the symlink was not altered, so the > culprit is still a mystery. The culprit is the PyObjC package, due to a packaging glitch it contains /System/Library/Python/.../site-packages. Sorry about the inconvenience. Ronald -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 504 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040219/24756ff2/attachment.bin From erik at letterror.com Thu Feb 19 03:33:47 2004 From: erik at letterror.com (Erik van Blokland) Date: Thu Feb 19 03:33:58 2004 Subject: [Pythonmac-SIG] list of *.pth files? Message-ID: <5657C6AC-62B6-11D8-B77C-000A956A726C@letterror.com> Folks, is there a record somewhere in Python of which *.pth files were read to fill sys.path? Cheers, Erik van Blokland From gherman at darwin.in-berlin.de Thu Feb 19 04:15:19 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu Feb 19 04:14:13 2004 Subject: [Pythonmac-SIG] Extracting frames from Quicktime movies? In-Reply-To: <2FBC4B6B-5FFB-11D8-8F81-000D934FF6B4@cwi.nl> Message-ID: <2342DBC0-62BC-11D8-A03B-00039345C610@darwin.in-berlin.de> Jack Jansen: > Jack steps out of Guido's time machine, and points Dinu at > plat-mac/videoreader.py in any 2.3 distribution. Heck... After sniffing into it I get basically this show-stopper code (used in videoreader.py): >>> path = "mymovie.mov" >>> from Carbon import QuickTime >>> fd = Qt.OpenMovieFile(path, 0)Traceback (most recent call last): File "", line 1, in ? MacOS.Error: (-2020, 'movieToolboxUninitialized') I'm using a vanilla Python 2.3.3 configure/make build. Is it a framework build that would help? Dinu -- Dinu C. Gherman - http://python.net/~gherman ...................................................................... "The best way to predict the future is to invent it." (Alan Kay) From bob at redivi.com Thu Feb 19 04:38:38 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Feb 19 04:38:12 2004 Subject: [Pythonmac-SIG] Extracting frames from Quicktime movies? In-Reply-To: <2342DBC0-62BC-11D8-A03B-00039345C610@darwin.in-berlin.de> References: <2342DBC0-62BC-11D8-A03B-00039345C610@darwin.in-berlin.de> Message-ID: <6568E262-62BF-11D8-A0EB-000A95686CD8@redivi.com> On Feb 19, 2004, at 4:15 AM, Dinu Gherman wrote: > Jack Jansen: > >> Jack steps out of Guido's time machine, and points Dinu at >> plat-mac/videoreader.py in any 2.3 distribution. > > Heck... After sniffing into it I get basically this show-stopper > code (used in videoreader.py): > > >>> path = "mymovie.mov" > >>> from Carbon import QuickTime > >>> fd = Qt.OpenMovieFile(path, 0)Traceback (most recent call last): > File "", line 1, in ? > MacOS.Error: (-2020, 'movieToolboxUninitialized') > > I'm using a vanilla Python 2.3.3 configure/make build. Is it > a framework build that would help? You're going to need to read and understand the QuickTime C API. Apple has lots of examples, but I think you need to download the QuickTime SDK separately from Xcode to get them. bgen wrappers don't do much for you above and beyond that, and none of this stuff has specific documentation for Python. In any case, you need Qt.EnterMovies() to happen before you call into the QuickTime API. You might end up needing to use a framework build (or at least something similarly bundleriffic) at some point, but that isn't your problem (yet). -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040219/a30135c5/smime.bin From mwh at python.net Thu Feb 19 06:24:06 2004 From: mwh at python.net (Michael Hudson) Date: Thu Feb 19 06:24:11 2004 Subject: [Pythonmac-SIG] list of *.pth files? In-Reply-To: <5657C6AC-62B6-11D8-B77C-000A956A726C@letterror.com> (Erik van Blokland's message of "Thu, 19 Feb 2004 09:33:47 +0100") References: <5657C6AC-62B6-11D8-B77C-000A956A726C@letterror.com> Message-ID: <2meksrxqg9.fsf@starship.python.net> Erik van Blokland writes: > Folks, > > is there a record somewhere in Python of which *.pth files were read > to fill sys.path? Doesn't look like it. The code that reads *.pth files is in site.py, by the way, so it shouldn't be too hard to find out what it does for yourself. Cheers, mwh -- Important data should not be entrusted to Pinstripe, as it may eat it and make loud belching noises. -- from the announcement of the beta of "Pinstripe" aka. Redhat 7.0 From gherman at darwin.in-berlin.de Thu Feb 19 06:59:01 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu Feb 19 06:57:50 2004 Subject: [Pythonmac-SIG] Extracting frames from Quicktime movies? In-Reply-To: <6568E262-62BF-11D8-A0EB-000A95686CD8@redivi.com> Message-ID: <0180E75A-62D3-11D8-A03B-00039345C610@darwin.in-berlin.de> Bob Ippolito: > You're going to need to read and understand the QuickTime C API. > Apple has lots of examples, but I think you need to download the > QuickTime SDK separately from Xcode to get them. bgen wrappers don't > do much for you above and beyond that, and none of this stuff has > specific documentation for Python. They say the SDK is bundled with 10.2 and higher. > In any case, you need Qt.EnterMovies() to happen before you call into > the QuickTime API. You might end up needing to use a framework build > (or at least something similarly bundleriffic) at some point, but that > isn't your problem (yet). Ok, I'm coming closer while tweaking Jack's videoreader.py to do what I want (see attached script). What I don't get is why it assumes it can save a frame as JPEG as it does? I'm doing this now for the first frame (I hope), but the output seems not to be JPEG at all... I wish there would be some Python Quicktime samples like this and would be happy to provide a couple of samples if someone gives me a helping hand... In any case I don't really feel like reading the 3000+ pages of the Quicktime API Reference... ;-) Regards, Dinu From gherman at darwin.in-berlin.de Thu Feb 19 06:59:51 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Thu Feb 19 06:58:43 2004 Subject: [Pythonmac-SIG] Extracting frames from Quicktime movies? In-Reply-To: <6568E262-62BF-11D8-A0EB-000A95686CD8@redivi.com> Message-ID: <1F86962B-62D3-11D8-A03B-00039345C610@darwin.in-berlin.de> Uhm, here's the file, too... Dinu -------------- next part -------------- A non-text attachment was scrubbed... Name: getMovieInfo.py Type: application/octet-stream Size: 2681 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040219/0ed9cb13/getMovieInfo-0001.obj From Jack.Jansen at cwi.nl Thu Feb 19 08:15:11 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Thu Feb 19 08:15:10 2004 Subject: [Pythonmac-SIG] Extracting frames from Quicktime movies? In-Reply-To: <0180E75A-62D3-11D8-A03B-00039345C610@darwin.in-berlin.de> References: <0180E75A-62D3-11D8-A03B-00039345C610@darwin.in-berlin.de> Message-ID: On 19-feb-04, at 12:59, Dinu Gherman wrote: > Ok, I'm coming closer while tweaking Jack's videoreader.py to do > what I want (see attached script). What I don't get is why it > assumes it can save a frame as JPEG as it does? I'm doing this now > for the first frame (I hope), but the output seems not to be JPEG > at all... If you're referring to the _test() main program: that will not work as-is in MacPython-OSX. It requires the "img" image package, which was included in the standard MacPython-OS9 distributions, but no longer so on OSX. And I now notice that I also don't make img available through PackageManager, so you won't get that bit of the code to work without modification. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From bob at redivi.com Thu Feb 19 11:26:57 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Feb 19 11:29:00 2004 Subject: [Pythonmac-SIG] Extracting frames from Quicktime movies? In-Reply-To: <0180E75A-62D3-11D8-A03B-00039345C610@darwin.in-berlin.de> References: <0180E75A-62D3-11D8-A03B-00039345C610@darwin.in-berlin.de> Message-ID: <70415D6D-62F8-11D8-A0EB-000A95686CD8@redivi.com> On Feb 19, 2004, at 6:59 AM, Dinu Gherman wrote: > Bob Ippolito: > >> You're going to need to read and understand the QuickTime C API. >> Apple has lots of examples, but I think you need to download the >> QuickTime SDK separately from Xcode to get them. bgen wrappers don't >> do much for you above and beyond that, and none of this stuff has >> specific documentation for Python. > > They say the SDK is bundled with 10.2 and higher. The headers and stuff are certainly here, but I don't see any QuickTime examples on my laptop's harddrive. >> In any case, you need Qt.EnterMovies() to happen before you call into >> the QuickTime API. You might end up needing to use a framework build >> (or at least something similarly bundleriffic) at some point, but >> that isn't your problem (yet). > > Ok, I'm coming closer while tweaking Jack's videoreader.py to do > what I want (see attached script). What I don't get is why it > assumes it can save a frame as JPEG as it does? I'm doing this now > for the first frame (I hope), but the output seems not to be JPEG > at all... > > I wish there would be some Python Quicktime samples like this and > would be happy to provide a couple of samples if someone gives me > a helping hand... In any case I don't really feel like reading the > 3000+ pages of the Quicktime API Reference... ;-) I didn't mean you had to read the QuickTime API reference, but you need to read some written-in-C examples, and then translate them to Python. The API's are almost the same, except some of the functions where you do SomeFunction(datatype, ...) have been converted to members of datatype, and most kinds of callbacks are not possible (yay bgen ;) Also, the image compression stuff wasn't wrapped, last I tried to use it (but Jack has put some work into QuickTime since 2.3.0).. so you might have a hard time saving it in a reasonable format. The only working Python example I know of is PyQTSequence ( http://undefined.org/python/#PyQTSequence ), mostly because I wrote it.. it includes a slightly modified _Qt.so that has some additional functionality like a portion of the image compression API. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040219/d8efbfef/smime.bin From vmarchetti at ameritech.net Thu Feb 19 11:55:05 2004 From: vmarchetti at ameritech.net (Vincent Marchetti) Date: Thu Feb 19 12:27:54 2004 Subject: [Pythonmac-SIG] How do you debug Cocoa GUI with PyObjC applications Message-ID: I'm asking how people trace/debug/watch Python applications that use a Cocoa based GUI via PyObjC. I've got the PyObjC examples set, and as I pretty much expected they crash outright when run from PythonIDE (conflicting event loops I imagine). When I fiddle and try to run from a Terminal window using "pythonw mainApp.py" I get an error message complaining about lack of an Info.plist file, and finally when using the method of building a clickable application using bundlebuilder the examples run, but there is no obvious way to trace through the execution except by throwing off a lot of alert windows. Any suggestions or example files would be welcome! Thanks Vince Marchetti From bob at redivi.com Thu Feb 19 12:47:56 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Feb 19 12:44:54 2004 Subject: [Pythonmac-SIG] How do you debug Cocoa GUI with PyObjC applications In-Reply-To: References: Message-ID: On Feb 19, 2004, at 11:55 AM, Vincent Marchetti wrote: > I'm asking how people trace/debug/watch Python applications that use a > Cocoa based GUI via > PyObjC. I've got the PyObjC examples set, and as I pretty much > expected they crash outright > when run from PythonIDE (conflicting event loops I imagine). When I > fiddle and try to run from a Terminal window using "pythonw > mainApp.py" I get an error message complaining about lack of an > Info.plist file, and finally when using the method of building a > clickable application using bundlebuilder the examples run, but there > is no obvious way to trace through the execution except by throwing > off a lot of alert windows. "pythonw objcguiapp.py" is never going to work because apps depending on AppKit need to live in a bundle and be called a certain way. There are ways around this, but they are hacky and require using private apple APIs. If you just want to look at the messages they spit out to the console, you can open /Applications/Utilities/Console.app. It will tail your console.log, which is basically stdout/stderr for processes that don't otherwise have one. If you want to interact with it, i.e. with pdb, or if you already have terminal open anyway.. here is how I do it: python buildapp.py --link build # build the app with a 'development' style `pwd`/build/AppName.app/Contents/MacOS/AppName # run the app by calling the executable with a full path Note that running under gdb is harder, if it's a real crash that you need to debug... I won't get into that right now. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040219/79faa6ff/smime.bin From theller at python.net Thu Feb 19 13:36:35 2004 From: theller at python.net (Thomas Heller) Date: Thu Feb 19 13:36:43 2004 Subject: [Pythonmac-SIG] Re: [Python-Dev] Plea for function/method syntax sugar (PEP 318, with a different syntax) In-Reply-To: <08F6B684-6283-11D8-8F69-000A95686CD8@redivi.com> (Bob Ippolito's message of "Wed, 18 Feb 2004 21:26:33 -0500") References: <08F6B684-6283-11D8-8F69-000A95686CD8@redivi.com> Message-ID: Bob Ippolito writes: > Here's a quick overview: > > def foo(args) [sugary, expressions, list]: > pass > > This is equivalent to: > > def foo(args): > pass > foo = list(expressions(sugary(foo))) > > This evaluation order is Guido approved, though at least one person > wanted it to be the other way around > > One would use this in scenarios such as: > > class FooClass(object): > def className(klass) [classmethod]: > return klass.__name__ > > or, even more importantly (to me anyway): > > # we would change PyObjC to make this a built-in feature.. but, for > # completeness: > import objc > def signature(sig): > def _signature(fn): > return objc.selector(fn, signature=sig) > return _signature > > class FooClass(NSObject): > def returnsAnInteger(self) [signature('i@:')]: > return 1 > def returnsVoidTakesAnInteger_(self, anInteger) [signature('v@:i')]: > pass I was thinking of a similar usecase for ctypes, defining C callback functions. In ctypes, you would be able to write """ WndProc = WINFUNCTYPE(c_int, HWND, MSG, WPARAM, LPARAM) def my_wndproc(hwnd, msg, wParam, lParam) [WndProc]: .... """ instead of this """ WndProc = WINFUNCTYPE(c_int, HWND, MSG, WPARAM, LPARAM) def my_wndproc(hwnd, msg, wParam, lParam): .... my_wndproc = WndProc(my_wndproc) """ BTW (I have this patch not yet applied), is it possible to use more than one line, in this way? def function(arg1, arg2, arg3, arg4, arg5, arg6) [dothis, dothat, doanother]: All in all, I'm +1 on the patch. Thomas From bob at redivi.com Thu Feb 19 13:46:30 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Feb 19 13:43:25 2004 Subject: [Pythonmac-SIG] Re: [Python-Dev] Plea for function/method syntax sugar (PEP 318, with a different syntax) In-Reply-To: References: <08F6B684-6283-11D8-8F69-000A95686CD8@redivi.com> Message-ID: On Feb 19, 2004, at 1:36 PM, Thomas Heller wrote: > Bob Ippolito writes: > >> Here's a quick overview: >> >> def foo(args) [sugary, expressions, list]: >> pass >> >> This is equivalent to: >> >> def foo(args): >> pass >> foo = list(expressions(sugary(foo))) [examples showing how much nicer it makes type annotation in ctypes and PyObjC] > BTW (I have this patch not yet applied), is it possible to use more > than > one line, in this way? > > def function(arg1, arg2, arg3, arg4, arg5, arg6) > [dothis, dothat, doanother]: > > All in all, I'm +1 on the patch. No, that is not valid syntax with the current patch.. you would need: def function(arg1, arg2, arg3, arg4, arg5, arg6 ) [dothis, dothat, doanother]: or def function(arg1, arg2, arg3, arg4, arg5, arg6) [ dothis, dothat, doanother]: (or some variation, that makes it obvious to Python that the def is not complete). -bob From gherman at darwin.in-berlin.de Fri Feb 20 03:31:58 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri Feb 20 03:30:46 2004 Subject: [Pythonmac-SIG] Extracting frames from Quicktime movies? In-Reply-To: <70415D6D-62F8-11D8-A0EB-000A95686CD8@redivi.com> Message-ID: <3F56A3DD-637F-11D8-B07D-00039345C610@darwin.in-berlin.de> Bob Ippolito: > The headers and stuff are certainly here, but I don't see any > QuickTime examples on my laptop's harddrive. True... I can only see this: http://developer.apple.com/samplecode/Sample_Code/QuickTime.htm > Also, the image compression stuff wasn't wrapped, last I tried to use > it (but Jack has put some work into QuickTime since 2.3.0).. so you > might have a hard time saving it in a reasonable format. Well, after a short chat with Jack I have a running script that does what I want, although I'm not sure it will do that for *all* Quicktime movies. It's using PIL now to save a frame in whatever format PIL can save (JPEG is hardwired). It only has to shift ARGB bytes into RGBA. Jack said, it might be possible to access the channels in the more usual order, but he hasn't seen yet my code (see attachment) and I was in a hurry yesterday. I have no clue why it is ARGB or how to directly extract RGBA. If anybody else has, please let me know so I can get rid off the byte order change... > The only working Python example I know of is PyQTSequence ( > http://undefined.org/python/#PyQTSequence ), mostly because I wrote > it.. it includes a slightly modified _Qt.so that has some additional > functionality like a portion of the image compression API. Surely, we could have some more interesting Python/Quicktime samples and I have all sorts of ideas for Quicktime tools/plug- ins after writing the little script yesterday, like automatic scene change detection, but the QT API universe is keeping me off... ;-) BTW, QT plugins in Python would be cool! Regards, Dinu -------------- next part -------------- A non-text attachment was scrubbed... Name: getMovieInfo.py Type: application/octet-stream Size: 2995 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040220/6f7489d7/getMovieInfo.obj -------------- next part -------------- -- Dinu C. Gherman - http://python.net/~gherman ...................................................................... "The best way to predict the future is to invent it." (Alan Kay) From bob at redivi.com Fri Feb 20 03:59:07 2004 From: bob at redivi.com (Bob Ippolito) Date: Fri Feb 20 03:55:56 2004 Subject: [Pythonmac-SIG] Extracting frames from Quicktime movies? In-Reply-To: <3F56A3DD-637F-11D8-B07D-00039345C610@darwin.in-berlin.de> References: <3F56A3DD-637F-11D8-B07D-00039345C610@darwin.in-berlin.de> Message-ID: <0AA57176-6383-11D8-A0EB-000A95686CD8@redivi.com> On Feb 20, 2004, at 3:31 AM, Dinu Gherman wrote: > Bob Ippolito: > >> Also, the image compression stuff wasn't wrapped, last I tried to use >> it (but Jack has put some work into QuickTime since 2.3.0).. so you >> might have a hard time saving it in a reasonable format. > > Well, after a short chat with Jack I have a running script that > does what I want, although I'm not sure it will do that for *all* > Quicktime movies. It's using PIL now to save a frame in whatever > format PIL can save (JPEG is hardwired). > > It only has to shift ARGB bytes into RGBA. Jack said, it might be > possible to access the channels in the more usual order, but he > hasn't seen yet my code (see attachment) and I was in a hurry > yesterday. > > I have no clue why it is ARGB or how to directly extract RGBA. If > anybody else has, please let me know so I can get rid off the byte > order change... ARGB *is* the normal order on a big endian machine. PIL *has no support whatsoever* for anything but RGBA. You need to use something like pygame surfaces or Numeric (as I did) to convert. Ideally, one would write a better version of PIL, but that would take a while ;) -bob From gherman at darwin.in-berlin.de Fri Feb 20 09:23:41 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Fri Feb 20 09:22:28 2004 Subject: [Pythonmac-SIG] Quicktime, versions, 3GPP Message-ID: <61DD329C-63B0-11D8-A030-00039345C610@darwin.in-berlin.de> Hi again, does anybody know if the Quicktime modules under Carbon do always support the currently installed/found version of Quicktime during compile time, or is it a more difficult story? I'm especially interested in Quicktime 6.3 and higher with their ability to save in 3GPP mode for mobile devices... Thanks, Dinu -- Dinu C. Gherman - http://python.net/~gherman ...................................................................... "The best way to predict the future is to invent it." (Alan Kay) From rowen at cesmail.net Fri Feb 20 15:47:22 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Fri Feb 20 15:47:44 2004 Subject: [Pythonmac-SIG] weird #! problem Message-ID: I am trying to make an easy-to-use build script and have stumbled across a very strange thing. Here is a minimal version of the script: script buildtui.py: #!/usr/bin/python import sys, bundlebuilder if len(sys.argv) == 1: sys.argv.append('build') bundlebuilder.buildapp(....) What I observe is if I run this script this way: % /usr/bin/python buildtui.py it works just fine. But if I run it this way: ./buildtui.py it fails. It *appears* to work (the output looks the same, and from poking around in the bundle the resulting app looks the same, but the resulting app fails with the following message in the Console: Fatal Python error: Interpreter not initialized (version mismatch?) I can't imagine how my build script can even tell the difference between the two means of execution. But I've confirmed this multiple times with variant scripts. Any idea what may be happening and what to do about it? I hope I'm not overlooking something really obvious, but I've put diagnostic printout in the script and I just can't see anything going on that is different. One thing I've not done is a byte-by-byte comparison of the two resulting applications. -- Russell From bob at redivi.com Fri Feb 20 16:09:35 2004 From: bob at redivi.com (Bob Ippolito) Date: Fri Feb 20 16:06:24 2004 Subject: [Pythonmac-SIG] weird #! problem In-Reply-To: References: Message-ID: <16095CF9-63E9-11D8-A0EB-000A95686CD8@redivi.com> Everything in MacPython 2.3 is *EXTREMELY* fragile if you have multiple copies of Python installed in the default places. I bet if you move your copy out of /Library/Frameworks, then everything would work fine. Also, the argv[0] is different (from C.. not Python) when you run "/usr/bin/python blah.py" vs "./blah.py", which can cause problems with some OS X facilities that talk to WindowServer (though bundlebuilder shouldn't have any). I can't even begin to guess at which little thing is causing your problem without examining the two resultant app bundles, but there are a lot of possible little things that can go wrong and cause such errors. I'm not masochistic enough to try and deal with two mutually exclusive framework Pythons at the same time, and I suggest you do the same. -bob On Feb 20, 2004, at 3:47 PM, Russell E. Owen wrote: > I am trying to make an easy-to-use build script and have stumbled > across > a very strange thing. Here is a minimal version of the script: > > script buildtui.py: > #!/usr/bin/python > import sys, bundlebuilder > if len(sys.argv) == 1: > sys.argv.append('build') > bundlebuilder.buildapp(....) > > What I observe is if I run this script this way: > % /usr/bin/python buildtui.py > it works just fine. But if I run it this way: > ./buildtui.py > it fails. It *appears* to work (the output looks the same, and from > poking around in the bundle the resulting app looks the same, but the > resulting app fails with the following message in the Console: > > Fatal Python error: Interpreter not initialized (version mismatch?) > > I can't imagine how my build script can even tell the difference > between > the two means of execution. But I've confirmed this multiple times with > variant scripts. > > Any idea what may be happening and what to do about it? > > I hope I'm not overlooking something really obvious, but I've put > diagnostic printout in the script and I just can't see anything going > on > that is different. One thing I've not done is a byte-by-byte comparison > of the two resulting applications. > > -- Russell > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From owen at astro.washington.edu Fri Feb 20 16:30:01 2004 From: owen at astro.washington.edu (Russell E Owen) Date: Fri Feb 20 16:33:57 2004 Subject: [Pythonmac-SIG] weird #! problem In-Reply-To: <16095CF9-63E9-11D8-A0EB-000A95686CD8@redivi.com> References: <16095CF9-63E9-11D8-A0EB-000A95686CD8@redivi.com> Message-ID: I do have two pythons, but only one is a framework python (the standard Panther install). The other is a vanilla unix-X11 python in the usual /usr/local/bin location. Still, it looks as if that may be the problem. I temporarily modified my PATH so /usr/local/bin was no longer on it, and that fixed the build problem. Weird. I wonder how the framework python had a clue that the other one existed? This is the first time I've seen any evidence of "crosstalk". -- Russell At 4:09 PM -0500 2004-02-20, Bob Ippolito wrote: >Everything in MacPython 2.3 is *EXTREMELY* fragile if you have >multiple copies of Python installed in the default places. I bet if >you move your copy out of /Library/Frameworks, then everything would >work fine. Also, the argv[0] is different (from C.. not Python) >when you run "/usr/bin/python blah.py" vs "./blah.py", which can >cause problems with some OS X facilities that talk to WindowServer >(though bundlebuilder shouldn't have any). > >I can't even begin to guess at which little thing is causing your >problem without examining the two resultant app bundles, but there >are a lot of possible little things that can go wrong and cause such >errors. > >I'm not masochistic enough to try and deal with two mutually >exclusive framework Pythons at the same time, and I suggest you do >the same. > >-bob > >On Feb 20, 2004, at 3:47 PM, Russell E. Owen wrote: > >>I am trying to make an easy-to-use build script and have stumbled across >>a very strange thing. Here is a minimal version of the script: >> >>script buildtui.py: >>#!/usr/bin/python >>import sys, bundlebuilder >>if len(sys.argv) == 1: >> sys.argv.append('build') >>bundlebuilder.buildapp(....) >> >>What I observe is if I run this script this way: >>% /usr/bin/python buildtui.py >>it works just fine. But if I run it this way: >>./buildtui.py >>it fails. It *appears* to work (the output looks the same, and from >>poking around in the bundle the resulting app looks the same, but the >>resulting app fails with the following message in the Console: >> >>Fatal Python error: Interpreter not initialized (version mismatch?) >> >>I can't imagine how my build script can even tell the difference between >>the two means of execution. But I've confirmed this multiple times with >>variant scripts. >> >>Any idea what may be happening and what to do about it? >> >>I hope I'm not overlooking something really obvious, but I've put >>diagnostic printout in the script and I just can't see anything going on >>that is different. One thing I've not done is a byte-by-byte comparison >>of the two resulting applications. >> >>-- Russell >> >> >>_______________________________________________ >>Pythonmac-SIG maillist - Pythonmac-SIG@python.org >>http://mail.python.org/mailman/listinfo/pythonmac-sig From Jack.Jansen at cwi.nl Fri Feb 20 18:01:41 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 20 18:01:27 2004 Subject: [Pythonmac-SIG] Quicktime, versions, 3GPP In-Reply-To: <61DD329C-63B0-11D8-A030-00039345C610@darwin.in-berlin.de> References: <61DD329C-63B0-11D8-A030-00039345C610@darwin.in-berlin.de> Message-ID: On 20 Feb 2004, at 15:23, Dinu Gherman wrote: > Hi again, > > does anybody know if the Quicktime modules under Carbon do always > support the currently installed/found version of Quicktime during > compile time, or is it a more difficult story? > > I'm especially interested in Quicktime 6.3 and higher with their > ability to save in 3GPP mode for mobile devices... It is a more difficult story (of course, I should add:-). The quicktime modules are built against a specific version of the API, but they use the implementation provided by the version of QuickTime you have installed on your machine. In other words, if exporting to 3GPP requires API calls that are newer than when the quicktime modules were built you will not be able to do it. But any new functionality sitting under existing APIs is immediately available. All that said: I've greatly enhanced the quicktime modules a month or so ago. The code is in the Python CVS repository, and I've done it in such a way that even though the code is in the 2.4 sourcetree it is possible to build the modules for 2.3. Unfortunately I've been really busy ever since, and I haven't had a chance to make the modules available through PackageManager. I promise I will do so as soon as I have the time. In the mean time you can check out Python from CVS and use your python2.3 interpreter to run setup.py in Mac/Modules/Qt to build the new stuff from source. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Fri Feb 20 18:38:33 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 20 18:38:20 2004 Subject: [Pythonmac-SIG] Quicktime, versions, 3GPP In-Reply-To: References: <61DD329C-63B0-11D8-A030-00039345C610@darwin.in-berlin.de> Message-ID: On 21 Feb 2004, at 00:01, Jack Jansen wrote: > In the mean time you can check out Python from CVS and use your > python2.3 interpreter to run setup.py in Mac/Modules/Qt to build the > new stuff from source. Ah, no, this bit is untrue:-( Where I got stuck was getting things to work in such a way that the new _Qt.so module (from 2.4, in /Library/Python/2.3) replaces the old _Qt.so (from 2.3, in $prefix/lib/python2.3/lib-dynload), but I haven't found a way yet to do it. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From gherman at darwin.in-berlin.de Sat Feb 21 04:14:31 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Sat Feb 21 04:13:22 2004 Subject: [Pythonmac-SIG] Bluetooth samples? Message-ID: <5BAB020A-644E-11D8-A030-00039345C610@darwin.in-berlin.de> Hi, I've just seen an announcement on c.l.p.a. about PySMS: http://www.wordhord.co.uk/pysms.html which provides inter- action with GSM phones via a serial interface - apparently on Windows/Linux only. I'd love to have that on Macs using Bluetooth... Anybody having a pointer to such a thing? Thanks, Dinu -- Dinu C. Gherman - http://python.net/~gherman ...................................................................... "The best way to predict the future is to invent it." (Alan Kay) From robin at reportlab.com Sat Feb 21 04:28:20 2004 From: robin at reportlab.com (Robin Becker) Date: Sat Feb 21 04:29:47 2004 Subject: [Pythonmac-SIG] re: Interpreting a crash dump Message-ID: I was able to solve the problem of mismatched strncpy in my dylib embedded python application by the following strategy. 1) Switch from -flat_namespace to -twolevel_namespace 2) Fix up a missing external _environ by using my own version. 3) Ensure the client was prepared for the double definition of _environ. It seems environ is normally supplied by crt1 (ie the main startup). How do other macpythoneers get round the problem (ie python internals refer to _environ). The linker seems unable to do a mixed strategy ie link evrything twolevel except for specified externals. -- Robin Becker From Jack.Jansen at cwi.nl Sat Feb 21 07:08:26 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sat Feb 21 07:08:12 2004 Subject: [Pythonmac-SIG] Bluetooth samples? In-Reply-To: <5BAB020A-644E-11D8-A030-00039345C610@darwin.in-berlin.de> References: <5BAB020A-644E-11D8-A030-00039345C610@darwin.in-berlin.de> Message-ID: On 21 Feb 2004, at 10:14, Dinu Gherman wrote: > Hi, > > I've just seen an announcement on c.l.p.a. about PySMS: > http://www.wordhord.co.uk/pysms.html which provides inter- > action with GSM phones via a serial interface - apparently > on Windows/Linux only. > > I'd love to have that on Macs using Bluetooth... Anybody > having a pointer to such a thing? While it would undoubtedly be fun to do this in Python there isn't really any point (in a practical sense): Address Book already allows you to send SMS messages over bluetooth... -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Sat Feb 21 07:13:43 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sat Feb 21 07:13:26 2004 Subject: [Pythonmac-SIG] re: Interpreting a crash dump In-Reply-To: References: Message-ID: <641A94E9-6467-11D8-8E9F-000D934FF6B4@cwi.nl> On 21 Feb 2004, at 10:28, Robin Becker wrote: > I was able to solve the problem of mismatched strncpy in my dylib > embedded python application by the following strategy. > > > 1) Switch from -flat_namespace to -twolevel_namespace > 2) Fix up a missing external _environ by using my own version. > 3) Ensure the client was prepared for the double definition of > _environ. > > It seems environ is normally supplied by crt1 (ie the main startup). > How > do other macpythoneers get round the problem (ie python internals refer > to _environ). The linker seems unable to do a mixed strategy ie link > evrything twolevel except for specified externals. Same strategy: provide your own _environ. The code is somewhere in posixmodule.c. As to the mixed strategy: Mach-O cannot really do this, there is no way to define references back from a shared library to the hosting program. On most unixen the distinction between shared libraries and plugins doesn't exist, so that probably takes care of the situation. Hmm, no, on second thoughts that isn't the complete story. I don't know why Apple aren't storing _environ in libc. (or libSystem.dylib, or whatever). -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From bob at redivi.com Sat Feb 21 10:02:59 2004 From: bob at redivi.com (Bob Ippolito) Date: Sat Feb 21 09:59:43 2004 Subject: [Pythonmac-SIG] re: Interpreting a crash dump In-Reply-To: <641A94E9-6467-11D8-8E9F-000D934FF6B4@cwi.nl> References: <641A94E9-6467-11D8-8E9F-000D934FF6B4@cwi.nl> Message-ID: <0A0F1E2C-647F-11D8-A0EB-000A95686CD8@redivi.com> On Feb 21, 2004, at 7:13 AM, Jack Jansen wrote: > > On 21 Feb 2004, at 10:28, Robin Becker wrote: > >> I was able to solve the problem of mismatched strncpy in my dylib >> embedded python application by the following strategy. >> >> >> 1) Switch from -flat_namespace to -twolevel_namespace >> 2) Fix up a missing external _environ by using my own version. >> 3) Ensure the client was prepared for the double definition of >> _environ. >> >> It seems environ is normally supplied by crt1 (ie the main startup). >> How >> do other macpythoneers get round the problem (ie python internals >> refer >> to _environ). The linker seems unable to do a mixed strategy ie link >> evrything twolevel except for specified externals. > > Same strategy: provide your own _environ. The code is somewhere in > posixmodule.c. > > As to the mixed strategy: Mach-O cannot really do this, there is no > way to > define references back from a shared library to the hosting program. > On most > unixen the distinction between shared libraries and plugins doesn't > exist, > so that probably takes care of the situation. > > Hmm, no, on second thoughts that isn't the complete story. I don't > know why > Apple aren't storing _environ in libc. (or libSystem.dylib, or > whatever). They are storing it in libc, as a function. /usr/include/crt_externs.h extern char ***_NSGetEnviron(void); -bob From robin at reportlab.com Sat Feb 21 12:51:19 2004 From: robin at reportlab.com (Robin Becker) Date: Sat Feb 21 12:51:47 2004 Subject: [Pythonmac-SIG] re: Interpreting a crash dump In-Reply-To: <0A0F1E2C-647F-11D8-A0EB-000A95686CD8@redivi.com> References: <641A94E9-6467-11D8-8E9F-000D934FF6B4@cwi.nl> <0A0F1E2C-647F-11D8-A0EB-000A95686CD8@redivi.com> Message-ID: <$9F+IVAXq5NAFwGZ@jessikat.fsnet.co.uk> ..... > >/usr/include/crt_externs.h > extern char ***_NSGetEnviron(void); > >-bob > > so is it the case that my make configure dance hasn't got the right _environ definition somehow? I can't find a reference to NSGetEnviron in the Python sources so I assume it has to be mentioned in a mac specific header. Perhaps this is one of the things that is better in Python-2.3. -- Robin Becker From robin at reportlab.com Sat Feb 21 13:11:56 2004 From: robin at reportlab.com (Robin Becker) Date: Sat Feb 21 13:13:04 2004 Subject: [Pythonmac-SIG] re: Interpreting a crash dump In-Reply-To: <$9F+IVAXq5NAFwGZ@jessikat.fsnet.co.uk> References: <641A94E9-6467-11D8-8E9F-000D934FF6B4@cwi.nl> <0A0F1E2C-647F-11D8-A0EB-000A95686CD8@redivi.com> <$9F+IVAXq5NAFwGZ@jessikat.fsnet.co.uk> Message-ID: In article <$9F+IVAXq5NAFwGZ@jessikat.fsnet.co.uk>, Robin Becker writes >..... >> >>/usr/include/crt_externs.h >> extern char ***_NSGetEnviron(void); >> >>-bob >> >> >so is it the case that my make configure dance hasn't got the right >_environ definition somehow? I can't find a reference to NSGetEnviron >in the Python sources so I assume it has to be mentioned in a mac >specific header. Perhaps this is one of the things that is better in >Python-2.3. I see in the 2.3.2 posixmodule.c that we use _NSGetEnviron if WITH_NEXT_FRAMEWORK is defined. It doesn't seem to be in 2.2.2 so I guess that was one of the improvements you mentioned earlier :) -- Robin Becker From jmillr at umich.edu Sat Feb 21 18:42:27 2004 From: jmillr at umich.edu (John Miller) Date: Sat Feb 21 18:42:00 2004 Subject: [Pythonmac-SIG] updating Panther to Python 2.3.3 In-Reply-To: References: Message-ID: <9B962B32-64C7-11D8-A2CE-00039303967A@umich.edu> I think this general topic was recently discussed, but I don't recall the following strategy being mentioned so I'd like to bring it up for feedback. My goal is to *replace* Apple's Python with the latest version with everything exactly as it is now (except updated, of course). I only want *one* version of Python on my machine, and I want that to be the latest. I'm not concerned with making changes to the /System folder; I think the extent of the changes are minimal (2.3 -> 2.3.3 with no path changes) and I understand that there is a danger that something in the future might 'break' because I'm messin' where I shouldn't be a messin'. Fine. Basically, I'm suggesting using the Makefile that Apple used for 2.3 to build and install 2.3.3. It'll probably be obvious in the way I express this suggestion, but let me make it clear: I have very little understanding of the way makefiles work, so this suggestion may seem ridiculously naive or unworkable. Anyway, on my stock Panther system (with Developer Tools installed) there is a Makefile located at: /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/ config/Makefile This config folder also has: install-sh config.c.in Setup python.o makesetup Setup.local config.c Setup.config which may prove helpful in the following scenario. I've downloaded the Python source and issued the './configure' command. Afterwards, I notice that a Makefile was generated. I compare this Makefile with the Apple one (using BBEdit's 'Find Differences...' command) and see quite a few differences. So, I'm tempted to simply replace the newly generated one in the Python-2.3.3 directory that I just downloaded and unpacked with the original one that Apple shipped with Panther. (However, what about all those other files in the 'config' directory; do all or some of them also need to be moved?) If I do that and then issue the 'make' command, followed by 'make install' (probably I'll have to be root to do that last step), will I have successfully upgraded Apple's Panther Python from 2.3 to 2.3.3? My guess is that I've missed something obvious, but I don't know what. I'd appreciate any feedback regarding this method. Thanks! John Miller, Ph.D. Interactive Communications and Simulations University of Michigan From bob at redivi.com Sat Feb 21 18:55:14 2004 From: bob at redivi.com (Bob Ippolito) Date: Sat Feb 21 18:52:05 2004 Subject: [Pythonmac-SIG] updating Panther to Python 2.3.3 In-Reply-To: <9B962B32-64C7-11D8-A2CE-00039303967A@umich.edu> References: <9B962B32-64C7-11D8-A2CE-00039303967A@umich.edu> Message-ID: <644886AC-64C9-11D8-847D-000A95686CD8@redivi.com> On Feb 21, 2004, at 6:42 PM, John Miller wrote: > I think this general topic was recently discussed, but I don't recall > the following strategy being mentioned so I'd like to bring it up for > feedback. My goal is to *replace* Apple's Python with the latest > version with everything exactly as it is now (except updated, of > course). I only want *one* version of Python on my machine, and I want > that to be the latest. I'm not concerned with making changes to the > /System folder; I think the extent of the changes are minimal (2.3 -> > 2.3.3 with no path changes) and I understand that there is a danger > that something in the future might 'break' because I'm messin' where I > shouldn't be a messin'. Fine. I highly recommend that you *do not* do this. If you install a version of Python to /Library/Frameworks and /usr/local/bin it *will always come first* so long as you change your PATH accordingly. It already comes first in link order, which is where most people run into trouble. -bob From bob at redivi.com Sat Feb 21 21:14:02 2004 From: bob at redivi.com (Bob Ippolito) Date: Sat Feb 21 21:10:48 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: <403807FF.6020408@shinners.org> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> Message-ID: On Feb 21, 2004, at 8:38 PM, Pete Shinners wrote: > enrike wrote: >> i would like to hear comments from people using python + pygame on >> OSX. I am interested on knowing about portability. I should be >> working on windows or linux and then port to OSX. >> I am not sure how difficult porting to osx is. I would like to know >> as well about dependencies, compatibilities etc.. > > I don't know where you can find a good explanation. For the most part > a pygame game just works on OSX. Solarwolf ran on the macs with no > changes at all. I think the biggest thing to keep in mind is file > paths. But if your game already handles the path differences between > windows and linux, it should be clean enough to run on OSX. Building self-contained applications on OS X that use pygame is currently a difficult matter, and getting pygame installed can be difficult for some (you actually need to read the Package Manager directions.. because some directory permissions need to be changed from the system default in order to install pygame). If you would like an OS X port of your pygame application, let me know. I'm not going to write a tutorial about how to do it, because I'm working on the software that will make it easy.. but in the meantime I will probably do it for you if you ask, mainly because it helps me test my packaging software with random bits of code not designed specifically to use it ;) Stuff you should avoid if possible are: runtime additions to sys.path intermingling of code and data (keep them in separate folders, please) using __file__ or similar mechanisms to find data (really a subissue of the previous) pygame does two of these things on its own, so that's one reason why it's not particularly easy. I think I'm going to workaround these issues for packages by having an online database of packaging hints (f.ex. there will be an XML file on pythonmac.org and/or undefined.org that says "pygame needs its .ttf, and must not use the zip import hook"). When the software is ready and the database is populated, applications that don't break the three rules above should be package-able with almost no effort. -bob From piet at cs.uu.nl Sun Feb 22 09:58:29 2004 From: piet at cs.uu.nl (Piet van Oostrum) Date: Sun Feb 22 09:58:15 2004 Subject: [Pythonmac-SIG] updating Panther to Python 2.3.3 In-Reply-To: <9B962B32-64C7-11D8-A2CE-00039303967A@umich.edu> References: Message-ID: >>>>> John Miller (JM) wrote: JM> I think this general topic was recently discussed, but I don't recall the JM> following strategy being mentioned so I'd like to bring it up for JM> feedback. My goal is to *replace* Apple's Python with the latest version JM> with everything exactly as it is now (except updated, of course). You can't. There is at least the CoreGraphics module for which no source code is available and the binary may not work properly with your new version. It was said that some system scripts depended on this. -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP] Private email: P.van.Oostrum@hccnet.nl From garsha at itg.uiuc.edu Sun Feb 22 16:54:53 2004 From: garsha at itg.uiuc.edu (garsha) Date: Sun Feb 22 16:54:54 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: <4AB40A91-5FFC-11D8-8F81-000D934FF6B4@cwi.nl> References: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> <87d68jp8s2.fsf@mally.pyrite.org> <045FB7B7-5E52-11D8-8730-000A959CB2EC@netmail.to> <4AB40A91-5FFC-11D8-8F81-000D934FF6B4@cwi.nl> Message-ID: <4039252D.1090004@itg.uiuc.edu> Some people already hack thier iPods to serve as primitive PDA's/portable hard drives, I can imagine an apple PDA with massive storage capacity+bluetooth in the works. It would be useful to have python based tools to communicate/sync with various PalmOS based devices; although some low-level reverse engineering will likely be required. I'm not sure I understand Palm's stance--thier best strategy would seem to be to have painless syncing tools that work on a variety of platforms (OSX, Linux, Win32). Making thier market share smaller doesn't seem very bright. It doesn't seem like it should be hugely technically difficult to come up with a cross-platform tool that can communicate to the PalmOS--didn't they (Palm) open up the source code? The missing OSX support is definately a pain where my Samsung i330 smart phone is concerned. MissingSync doesn't work with my newer 'AirPort Extreme' equipped powerbook for some reason, and so I have to sync with a Windows box and then rsync the files to various other machines; I haven't figured out where the files go for PalmDesktop OS X though, and I just don't have time to fiddle around that much. At any rate, I would be interested in any progress towards a solution (even if only for older PalmOS's). Best, Karl G. Jack Jansen wrote: > > On 13 Feb 2004, at 19:25, Wayne Folta wrote: > >> It may be that before the conversation is over, Apple will have a big >> announcement about an Apple PDA or maybe iSync will step it up three >> or four notches and fill in the gap. > > > This wouldn't surprise me in the least. Palm would be stark raving mad > if they dropped the one market where they have a 100% marketshare: > no-one with a Mac uses a WinCE PDA, and I think the same is true for > Psions (in as far as they still exist). > > But then, I could be wrong, and maybe with the numerous splits and > rejoins and resplits the-company-formerly-known-as-palm is now stark > raving mad, > -- > Jack Jansen, , http://www.cwi.nl/~jack > If I can't dance I don't want to be part of your revolution -- Emma > Goldman > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From khk at uiah.fi Sun Feb 22 17:13:00 2004 From: khk at uiah.fi (Kari-Hans Kommonen) Date: Sun Feb 22 17:12:59 2004 Subject: [Pythonmac-SIG] Python Palm hotsync software? In-Reply-To: <4039252D.1090004@itg.uiuc.edu> References: <76B7CEFC-5DE2-11D8-8730-000A959CB2EC@netmail.to> <87d68jp8s2.fsf@mally.pyrite.org> <045FB7B7-5E52-11D8-8730-000A959CB2EC@netmail.to> <4AB40A91-5FFC-11D8-8F81-000D934FF6B4@cwi.nl> <4039252D.1090004@itg.uiuc.edu> Message-ID: On the other side of the playing field, Nokia is putting Python as the scripting language of choice into its Symbian smartphones... http://www.mobilewhack.com/programming/python ...they are not the same thing as Palms today, but moving in that direction...and it is a nice display of attitude and strategy. (besides of having the iSync support as well. ...I'd like to manage all aspects of my phone with my mac using python...and selectively do similar things with the mac from the phone... khk At 15:54 -0600 22.2.2004, garsha wrote: >Some people already hack thier iPods to serve as primitive >PDA's/portable hard drives, I can imagine an apple PDA with massive >storage capacity+bluetooth in the works. It would be useful to >have python based tools to communicate/sync with various PalmOS >based devices; although some low-level reverse engineering will >likely be required. I'm not sure I understand Palm's stance--thier >best strategy would seem to be to have painless syncing tools that >work on a variety of platforms (OSX, Linux, Win32). Making thier >market share smaller doesn't seem very bright. It doesn't seem like >it should be hugely technically difficult to come up with a >cross-platform tool that can communicate to the PalmOS--didn't they >(Palm) open up the source code? > The missing OSX support is definately a pain where my Samsung >i330 smart phone is concerned. MissingSync doesn't work with my >newer 'AirPort Extreme' equipped powerbook for some reason, and so I >have to sync with a Windows box and then rsync the files to various >other machines; I haven't figured out where the files go for >PalmDesktop OS X though, and I just don't have time to fiddle around >that much. At any rate, I would be interested in any progress >towards a solution (even if only for older PalmOS's). Best, >Karl G. From garsha at itg.uiuc.edu Sun Feb 22 17:40:52 2004 From: garsha at itg.uiuc.edu (garsha) Date: Sun Feb 22 17:40:47 2004 Subject: [Pythonmac-SIG] Panther, Python 2.3, anydbm Message-ID: <40392FF4.7020902@itg.uiuc.edu> I've experienced problems with shelve and anydbm modules being broken in the context of macPython installs (10.2 and 10.3 addons)--I'm not sure if it is common knowledge or not, but I haven't seen much documentation of the issue on the web, so I felt I should bring it up in case someone else ends up searching for a solution. The most recent error refers to 'fast mutexes not available on this platform'--I wish I had saved text from the console so I could be more specific, but basically it seems to be a problem with the database libraries available on a stock Panther install. By downloading and building the Sleepycat BerkelyDB.4.2, manually editing the Modules/Setup file to build the bsdb module (after running ./configure --enable-framework --enable-toolbox-glue), the problem seems to have been resolved. I tried to download the official/unofficial _gdbm.so through the package manager, but the package manager wouldn't let me, stating that I had to manually install the library--which I couln't do becuase the 'make install' phase for building gdbm errors out stating illegal operators to /usr/bin/install. It would seem that Apple's python and the macPython binary installer are going out with broken anydbm and shelve builtins, and installing the BerkelyDB.4.2 and bsdb module fixes things (I also downloaded/built/installed the bsddb3 module for good measure). The sleepycat db distribution is the only one I could get to build and install without any headaches or having to resort to DarwinPorts or Fink. To some developers, particularly less experienced ones such as I, this may cause some frustration if they write code on some other platform which utilizes persistent data objects, and hope it will run on OS X (and be able to at least create and read new persistant data objects) unmodified. If anyone has a more elegant solution, or I'm just missing something elementary please let me know. I'm just offering the experience to the list in the event that it hasn't been documented yet. Regards, Karl G. From Jack.Jansen at cwi.nl Sun Feb 22 17:51:38 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sun Feb 22 17:51:41 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> Message-ID: On 22-feb-04, at 3:14, Bob Ippolito wrote: > Stuff you should avoid if possible are: > runtime additions to sys.path > intermingling of code and data (keep them in separate folders, please) > using __file__ or similar mechanisms to find data (really a subissue > of the previous) For the latter two we should invent something to help people. I know it should be a general Python solution, but as none seems to be forthcoming (lots of people have been asking about a way to access data files, and the party line still seem to be "put them in your package", even though that breaks with py2exe and zip imports and such) we should roll our own, I think. We already have a working example in macresource, which solves a similar problem (finding a resource file, if the resources don't happen to be in the resource fork of the current executable already). For opening data files the API would have to be something different, probably along the lines of filename = datafile.datafilename("mydatafile.txt", "mymodule"), where mydatafile.txt is first looked up in a directory specifically for datafiles (where it would be found if the program was run as a .app bundle), then in the same directory as mymodule.__file__. For OSX bundles the datafile-directory specified above would be Contents/Resources, and people on other platforms using py2exe or somesuch are free to tag on to the scheme and invent their own magic location:-) -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Sun Feb 22 17:58:31 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sun Feb 22 17:58:33 2004 Subject: [Pythonmac-SIG] updating Panther to Python 2.3.3 In-Reply-To: <9B962B32-64C7-11D8-A2CE-00039303967A@umich.edu> References: <9B962B32-64C7-11D8-A2CE-00039303967A@umich.edu> Message-ID: On 22-feb-04, at 0:42, John Miller wrote: > Basically, I'm suggesting using the Makefile that Apple used for 2.3 > to build and install 2.3.3. It'll probably be obvious in the way I > express this suggestion, but let me make it clear: I have very little > understanding of the way makefiles work, so this suggestion may seem > ridiculously naive or unworkable. Anyway, on my stock Panther system > (with Developer Tools installed) there is a Makefile located at: The problem is that Apple does a little more massaging before and after running that Makefile. I think that you would be pretty safe if you use their build procedure *and overwrite everything in /System*, and I think that, given Python's track record of micro-version-compatibility, the coregraphics module wouldn't notice the difference. But you definitely want to check out their darwin source repository, as they do some important things after building. I think all the details should be in the darwin repository. And, all that said, I'm definitely not going to try this myself. But if you're willing to try it out: by all means. I'll be under the table with my fingers in my ears, but just in case it does all work out as expected I'd be glad to hear it:-) -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From bob at redivi.com Sun Feb 22 18:13:23 2004 From: bob at redivi.com (Bob Ippolito) Date: Sun Feb 22 18:10:08 2004 Subject: [Pythonmac-SIG] Panther, Python 2.3, anydbm In-Reply-To: <40392FF4.7020902@itg.uiuc.edu> References: <40392FF4.7020902@itg.uiuc.edu> Message-ID: On Feb 22, 2004, at 5:40 PM, garsha wrote: > I've experienced problems with shelve and anydbm modules being broken > in the context of macPython installs (10.2 and 10.3 addons)--I'm not > sure if it is common knowledge or not, but I haven't seen much > documentation of the issue on the web, so I felt I should bring it up > in case someone else ends up searching for a solution. > The most recent error refers to 'fast mutexes not available on this > platform'--I wish I had saved text from the console so I could be more > specific, but basically it seems to be a problem with the database > libraries available on a stock Panther install. By downloading and > building the Sleepycat BerkelyDB.4.2, manually editing the > Modules/Setup file to build the bsdb module (after running ./configure > --enable-framework --enable-toolbox-glue), the problem seems to have > been resolved. I tried to download the official/unofficial _gdbm.so > through the package manager, but the package manager wouldn't let me, > stating that I had to manually install the library--which I couln't do > becuase the 'make install' phase for building gdbm errors out stating > illegal operators to /usr/bin/install. It would seem that Apple's > python and the macPython binary installer are going out with broken > anydbm and shelve builtins, and installing the BerkelyDB.4.2 and bsdb > module fixes things (I also downloaded/built/installed the bsddb3 > module for good measure). The sleepycat db distribution is the only > one I could get to build and install without any headaches or having > to resort to DarwinPorts or Fink. To some developers, particularly > less experienced ones such as I, this may cause some frustration if > they write code on some other platform which utilizes persistent data > objects, and hope it will run on OS X (and be able to at least create > and read new persistant data objects) unmodified. If anyone has a > more elegant solution, or I'm just missing something elementary please > let me know. I'm just offering the experience to the list in the event > that it hasn't been documented yet. Regards, Are you talking about _bsddb.so from the "official unofficial package repository" located at http://undefined.org/python/pimp/ ? This downloads and installs just fine anywhere I've ever tried it, and has no dependency on BerkeleyDB (it is statically linked in)... well, as long as you are using the stock Python 2.3.0 that comes with Panther (which is a requirement for the package repository). -bob From bob at redivi.com Sun Feb 22 18:24:19 2004 From: bob at redivi.com (Bob Ippolito) Date: Sun Feb 22 18:21:02 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> Message-ID: <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> On Feb 22, 2004, at 5:51 PM, Jack Jansen wrote: > > On 22-feb-04, at 3:14, Bob Ippolito wrote: > >> Stuff you should avoid if possible are: >> runtime additions to sys.path >> intermingling of code and data (keep them in separate folders, >> please) >> using __file__ or similar mechanisms to find data (really a subissue >> of the previous) > > For the latter two we should invent something to help people. I know > it should be a general Python solution, but as none seems to be > forthcoming (lots of people have been asking about a way to access > data files, and the party line still seem to be "put them in your > package", even though that breaks with py2exe and zip imports and > such) we should roll our own, I think. > > We already have a working example in macresource, which solves a > similar problem (finding a resource file, if the resources don't > happen to be in the resource fork of the current executable already). > > For opening data files the API would have to be something different, > probably along the lines of filename = > datafile.datafilename("mydatafile.txt", "mymodule"), where > mydatafile.txt is first looked up in a directory specifically for > datafiles (where it would be found if the program was run as a .app > bundle), then in the same directory as mymodule.__file__. > > For OSX bundles the datafile-directory specified above would be > Contents/Resources, and people on other platforms using py2exe or > somesuch are free to tag on to the scheme and invent their own magic > location:-) I agree completely, but it will also need some sort of manifest file so that bundlebuilder and py2exe know what data files are necessary. A future version of distutils should do this (package receipt with enough metadata to determine what data is essential, and what data is just examples, tests, help files). There's also the very real problem of getting package authors to change the way they're currently doing things, especially the ones with freakish distutils extensions like SciPy. This isn't a real problem for pygame though, since I maintain the OS X port and have commit access. I saw a system for including package resources (name eludes me at the moment) by converting the binaries to python code.. so that the resources ended up being Python strings(!!) on import.. I don't think this is a general solution, and it probably has the capability to increases memory consumption and load time considerably, but it *would* work as a hack ;) In any case, would anyone like to implement this? I am probably too busy to get around to it for a few weeks (and I honestly don't really want to write it), but I would be probably integrate it into bundlebuilder2 sooner than that if it sprung into existence. -bob From postman at mailhub-6.net.treas.gov Sun Feb 22 22:57:36 2004 From: postman at mailhub-6.net.treas.gov (postman@mailhub-6.net.treas.gov) Date: Sun Feb 22 22:57:40 2004 Subject: [Pythonmac-SIG] Virus Alert Message-ID: <200402230357.i1N3vaCP003100@mailhub-6.net.treas.gov> The mail message (file: attachment.zip) you sent to elley@notes.tcs.treas.gov contains a virus. (InterScan on mailhub-6) From mhalle at bwh.harvard.edu Mon Feb 23 01:27:59 2004 From: mhalle at bwh.harvard.edu (Michael Halle) Date: Mon Feb 23 01:28:01 2004 Subject: [Pythonmac-SIG] simultaneous X11 and Carbon _tkinters ? Message-ID: <6C7A8CC0-65C9-11D8-8842-000A95C85CA2@bwh.harvard.edu> If I have a _tkinter compiled for X11, is there any reasonable way to have it coexist with a _tkinter compiled for Carbon using the standard Panther python? Given that I need to have both around, what's my best bet for being able to switch between versions? Thanks. Michael Halle mhalle @ bwh.harvard.edu From jwblist at olympus.net Mon Feb 23 01:45:20 2004 From: jwblist at olympus.net (John W. Baxter) Date: Mon Feb 23 01:45:34 2004 Subject: [Pythonmac-SIG] updating Panther to Python 2.3.3 In-Reply-To: Message-ID: On 2/22/2004 14:58, "Jack Jansen" wrote: > And, all that said, I'm definitely not going to try this myself. But if > you're willing to try it out: by all means. I'll be under the table > with my fingers in my ears, but just in case it does all work out as > expected I'd be glad to hear it:-) John, using a sandbox machine for your first try would seem prudent. --John From hinsen at cnrs-orleans.fr Mon Feb 23 03:04:46 2004 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Mon Feb 23 03:04:05 2004 Subject: [Pythonmac-SIG] simultaneous X11 and Carbon _tkinters ? In-Reply-To: <6C7A8CC0-65C9-11D8-8842-000A95C85CA2@bwh.harvard.edu> References: <6C7A8CC0-65C9-11D8-8842-000A95C85CA2@bwh.harvard.edu> Message-ID: On 23.02.2004, at 07:27, Michael Halle wrote: > If I have a _tkinter compiled for X11, is there any > reasonable way to have it coexist with a _tkinter > compiled for Carbon using the standard Panther > python? Given that I need to have both > around, what's my best bet for being able to switch > between versions? > You could install both to different directories and set PYTHONPATH differently depending on which one you wish to use. Konrad. From kevin at macosx.com Mon Feb 23 03:16:07 2004 From: kevin at macosx.com (kevin) Date: Mon Feb 23 03:17:18 2004 Subject: [Pythonmac-SIG] mod search path In-Reply-To: <4BDEE730-5E25-11D8-8F64-000A958D1666@cwi.nl> Message-ID: <87A56102-65D8-11D8-9523-003065555ABC@macosx.com> hi... I built python from source on 10.2. (i also have apple python and MacPython so i am real confused). It built successfully and i have been using this in conjunction a program called rtcmix. (rtcmix was the reason that i had to build a new one from source as they didn't use distutils and linked statically, and they can't be convinced to do otherwise. They are unix old school and say that this is "always the way they have done it" so i am stuck having many many pythons. I use my MacPython for most everything. I use this built python for rtcmix and more less ignore apple's python). This new python lives in: /usr/local/src/Python-2.3.3 But unlike my MacPython and Apple Python, this one seems not to see any modules and as i am insanely confused i am not sure what i should do to make this new python also see my modules. My MacPython seems cool and seems to be happy finding every module in my path (set in /Users/kevin/Library/init/tcsh/path ) Anyway, anyone have any ideas as to how i can get the built from source Python to see modules? Why doesn't this look down the path set in my /Users/kevin/Library/init/tcsh/path file? hmm... (in case you are doing sound w/python you may want to look at: http://presto.music.virginia.edu/cmix_docs/RTcmix/ It is very worthwhile for music) From Jack.Jansen at cwi.nl Mon Feb 23 03:57:57 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Mon Feb 23 03:57:20 2004 Subject: [Pythonmac-SIG] Lots of spam from italy. Message-ID: <5FF182BE-65DE-11D8-AC6B-000A958D1666@cwi.nl> Folks, since a while most of the spam that has been sent to pythonmac-sig is coming from Italy. Note that the spam is stopped before it hits the list, but it still costs me time and effort, so could any Italians (especially italians running windows:-) please check their machines for viruses and/or ask their friends whether they've been infected? Just in case this rings a bell to someone: most of the load today came from what appears to be a cable-modem or DSL-connected machine through provider interbusiness.it. In some cases the machine pretended to be called "nome.it", but that is probably nonsense anyway (unless you know someone whose machine is called nome.it). -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Mon Feb 23 04:02:10 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Mon Feb 23 04:01:35 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> Message-ID: On 23-feb-04, at 0:24, Bob Ippolito wrote: > I saw a system for including package resources (name eludes me at the > moment) by converting the binaries to python code.. so that the > resources ended up being Python strings(!!) on import.. I don't think > this is a general solution, and it probably has the capability to > increases memory consumption and load time considerably, but it > *would* work as a hack ;) Brrrr :-) > In any case, would anyone like to implement this? I am probably too > busy to get around to it for a few weeks (and I honestly don't really > want to write it), but I would be probably integrate it into > bundlebuilder2 sooner than that if it sprung into existence. Implementation is going to be peanuts, design is what we want. We should investigate the paradigms people use nowadays to get at their datafiles, and come up with something that is as close as possible to that. How does pygame find its datafiles? -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Mon Feb 23 04:07:16 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Mon Feb 23 04:06:48 2004 Subject: [Pythonmac-SIG] mod search path In-Reply-To: <87A56102-65D8-11D8-9523-003065555ABC@macosx.com> References: <87A56102-65D8-11D8-9523-003065555ABC@macosx.com> Message-ID: On 23-feb-04, at 9:16, kevin wrote: > This new python lives in: > > /usr/local/src/Python-2.3.3 > > But unlike my MacPython and Apple Python, this one seems not to see > any modules and as i am insanely confused i am not sure what i should > do to make this new python also see my modules. > > My MacPython seems cool and seems to be happy finding every module in > my path (set in /Users/kevin/Library/init/tcsh/path ) First check that it can actually see what you've added to PYTHONPATH: fire up the new interactive interpreter, do >>> import sys >>> print sys.path and check that your path modifications are in there. If that is all as it should be then run that new python with the "-vv" option, and try to import a module that is somewhere on your non-standard path. "-vv" will not only print all successful imports, but it will also print all unsuccessful attempts. So this, together with the sys.path value from the previous step, should give you an idea. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From kevin at macosx.com Mon Feb 23 05:21:52 2004 From: kevin at macosx.com (kevin) Date: Mon Feb 23 05:23:02 2004 Subject: [Pythonmac-SIG] mod search path In-Reply-To: Message-ID: <18FC396A-65EA-11D8-8AE3-003065555ABC@macosx.com> hmm.. if i type: % setenv PYTHONPATH /Users/kevin:/Users/kevin/scripts:/Users/kevin/cmix:/Users/kevin/python Then launch python and type: >>> import sys >>> x = sys.path >>> for i in x: ... print i ... i get : /Users/kevin /Users/kevin/scripts /Users/kevin/cmix /Users/kevin/python /usr/local/python/lib/python23.zip /usr/local/src/Python-2.3.3/Lib /usr/local/src/Python-2.3.3/Lib/plat-darwin /usr/local/src/Python-2.3.3/Lib/plat-mac /usr/local/src/Python-2.3.3/Lib/plat-mac/lib-scriptpackages /usr/local/src/Python-2.3.3/Lib/lib-tk /usr/local/src/Python-2.3.3/Modules /usr/local/src/Python-2.3.3/build/lib.darwin-6.8-Power_Macintosh-2.3 /usr/local/python/lib/python2.3/site-packages --- so it all works as one would expect ... but if i put that same line in any of my ~/Library/init/tcsh files: aliases.mine completions.mine environment.mine path rc.mine log out, log back in and do the same dance, nothing is added to my PYTHONPATH. I am only doing this in the shell so i don't think that i would need to set this in the .MacOSX/environnment.plist so what gives? kind of crazy... Hmm... cheers, kevin From kevin at macosx.com Mon Feb 23 05:40:12 2004 From: kevin at macosx.com (kevin) Date: Mon Feb 23 05:41:23 2004 Subject: [Pythonmac-SIG] mod search path In-Reply-To: Message-ID: okay. i got it. I logged out and logged back in a second time and it seemed to work. I have no idea why it didn't the first time.. but likely it is *user* error (-_-) .... i might have done something goofy while fooling in the terminal... Nevertheless... i'll give your mail spools a rest and get back to work. Thanks, kevin From bob at redivi.com Mon Feb 23 11:47:13 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 23 11:46:52 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> Message-ID: On Feb 23, 2004, at 4:02 AM, Jack Jansen wrote: > > On 23-feb-04, at 0:24, Bob Ippolito wrote: >> I saw a system for including package resources (name eludes me at the >> moment) by converting the binaries to python code.. so that the >> resources ended up being Python strings(!!) on import.. I don't think >> this is a general solution, and it probably has the capability to >> increases memory consumption and load time considerably, but it >> *would* work as a hack ;) > > Brrrr :-) > >> In any case, would anyone like to implement this? I am probably too >> busy to get around to it for a few weeks (and I honestly don't really >> want to write it), but I would be probably integrate it into >> bundlebuilder2 sooner than that if it sprung into existence. > > Implementation is going to be peanuts, design is what we want. > We should investigate the paradigms people use nowadays to get at > their datafiles, and come up with something that is as close as > possible to that. > > How does pygame find its datafiles? pygame actually does it in a C extension when it's looking for its font file.. so it's not really typical usage. I will change pygame accordingly when method exists. In most cases, I've seen os.path.join(os.path.dirname(__file__), "resourcefile") -- maybe with an app-specific fallback if they have baked in support for py2exe. The more I think about it, the more I just want to recommend that the implementation use PyProtocols or something so that it's flexible. # bundlebuilder bootstrap from protocols import protocolForURI, Adapter, advise, NO_ADAPTER_NEEDED from Foundation import NSBundle # # use a URI protocol so that # (a) an implementation doesn't have to exist # (b) the user doesn't have to import it # IReadableFileLike = protocolForURI("org.python.packaging.readablefilelike") declareAdapter(NO_ADAPTER_NEEDED, provides=[IReadableFileLike], forTypes=[file]) def bundlebuilderFile(obj, protocol): """Loads a (module, filename) 2-tuple from Contents/Resources/ModuleData/%(moduleName)s/%(fileName)s""" module, filename = obj modulename = getattr(module, '__name__', module) if not isinstance(modulename, basestring): return None filepath = os.path.join(NSBundle.mainBundle().resourcePath(), 'ModuleData', modulename, filename) if not os.path.exists(filepath): return None return file(filepath) declateAdapterForType(IReadableFileLike, bundlebuilderFile, tuple) # user code import sys, os from protocols import protocolForURI, adapt IReadableFileLike = protocolForURI("org.python.packaging.readablefilelike") # sensible default method def defaultFactory((module, filename)): basedir = os.path.dirname(sys.modules.get(module, module).__file__) return file(os.path.join(basedir, filename)) myResourceFileObj = adapt((__module__, "resourcefilename"), IReadableFileLike, factory=defaultFactory) -bob From garsha at itg.uiuc.edu Mon Feb 23 13:13:47 2004 From: garsha at itg.uiuc.edu (Karl Garsha) Date: Mon Feb 23 13:13:30 2004 Subject: [Pythonmac-SIG] Panther, Python 2.3, anydbm In-Reply-To: References: <40392FF4.7020902@itg.uiuc.edu> Message-ID: <403A42DB.1090802@itg.uiuc.edu> That must be the problem I've experienced using the package manager--I'm not running the stock Panther python. I overwrote it with a build from source somewhere along the line trying to get wxWindows, VTK, Python and shelve to work. Lately I've just gone to a 2.3.3 build in the old /Library/Frameworks/ location rather than the /System/Library/Frameworks/ location. I guess I didn't realize the Apple Python 2.3.0 requirement for the package manager. -Karl Bob Ippolito wrote: > On Feb 22, 2004, at 5:40 PM, garsha wrote: > >> I've experienced problems with shelve and anydbm modules being broken >> in the context of macPython installs (10.2 and 10.3 addons)--I'm not >> sure if it is common knowledge or not, but I haven't seen much >> documentation of the issue on the web, so I felt I should bring it up >> in case someone else ends up searching for a solution. >> The most recent error refers to 'fast mutexes not available on >> this platform'--I wish I had saved text from the console so I could >> be more specific, but basically it seems to be a problem with the >> database libraries available on a stock Panther install. By >> downloading and building the Sleepycat BerkelyDB.4.2, manually >> editing the Modules/Setup file to build the bsdb module (after >> running ./configure --enable-framework --enable-toolbox-glue), the >> problem seems to have been resolved. I tried to download the >> official/unofficial _gdbm.so through the package manager, but the >> package manager wouldn't let me, stating that I had to manually >> install the library--which I couln't do becuase the 'make install' >> phase for building gdbm errors out stating illegal operators to >> /usr/bin/install. It would seem that Apple's python and the >> macPython binary installer are going out with broken anydbm and >> shelve builtins, and installing the BerkelyDB.4.2 and bsdb module >> fixes things (I also downloaded/built/installed the bsddb3 module for >> good measure). The sleepycat db distribution is the only one I could >> get to build and install without any headaches or having to resort to >> DarwinPorts or Fink. To some developers, particularly less >> experienced ones such as I, this may cause some frustration if they >> write code on some other platform which utilizes persistent data >> objects, and hope it will run on OS X (and be able to at least create >> and read new persistant data objects) unmodified. If anyone has a >> more elegant solution, or I'm just missing something elementary >> please let me know. I'm just offering the experience to the list in >> the event that it hasn't been documented yet. Regards, > > > Are you talking about _bsddb.so from the "official unofficial package > repository" located at http://undefined.org/python/pimp/ ? This > downloads and installs just fine anywhere I've ever tried it, and has > no dependency on BerkeleyDB (it is statically linked in)... well, as > long as you are using the stock Python 2.3.0 that comes with Panther > (which is a requirement for the package repository). > > -bob -- Karl Garsha Light Microscopy Specialist Imaging Technology Group Beckman Institute for Advanced Science and Technology University of Illinois at Urbana-Champaign 405 North Mathews Avenue Urbana, IL 61801 Office: B650J Phone: 217.244.6292 Fax: 217.244.6219 Mobile: 217.390.1874 www.itg.uiuc.edu From bob at redivi.com Mon Feb 23 13:34:15 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 23 13:31:05 2004 Subject: [Pythonmac-SIG] Panther, Python 2.3, anydbm In-Reply-To: <403A42DB.1090802@itg.uiuc.edu> References: <40392FF4.7020902@itg.uiuc.edu> <403A42DB.1090802@itg.uiuc.edu> Message-ID: If you read the header of the page OR the title of http://undefined.org/python/pimp/, it is VERY specific about what the database is for: Python Package Manager database for MacPython 2.3.0 on Mac OS X 10.3.2 (7D24) Should I make it larger, red, and blinking? What can I do so this is not confusing for people? -bob On Feb 23, 2004, at 1:13 PM, Karl Garsha wrote: > That must be the problem I've experienced using the package > manager--I'm not running the stock Panther python. I overwrote it with > a build from source somewhere along the line trying to get wxWindows, > VTK, Python and shelve to work. Lately I've just gone to a 2.3.3 build > in the old /Library/Frameworks/ location rather than the > /System/Library/Frameworks/ location. I guess I didn't realize the > Apple Python 2.3.0 requirement for the package manager. > -Karl > > Bob Ippolito wrote: > >> On Feb 22, 2004, at 5:40 PM, garsha wrote: >> >>> I've experienced problems with shelve and anydbm modules being >>> broken in the context of macPython installs (10.2 and 10.3 >>> addons)--I'm not sure if it is common knowledge or not, but I >>> haven't seen much documentation of the issue on the web, so I felt I >>> should bring it up in case someone else ends up searching for a >>> solution. >>> The most recent error refers to 'fast mutexes not available on >>> this platform'--I wish I had saved text from the console so I could >>> be more specific, but basically it seems to be a problem with the >>> database libraries available on a stock Panther install. By >>> downloading and building the Sleepycat BerkelyDB.4.2, manually >>> editing the Modules/Setup file to build the bsdb module (after >>> running ./configure --enable-framework --enable-toolbox-glue), the >>> problem seems to have been resolved. I tried to download the >>> official/unofficial _gdbm.so through the package manager, but the >>> package manager wouldn't let me, stating that I had to manually >>> install the library--which I couln't do becuase the 'make install' >>> phase for building gdbm errors out stating illegal operators to >>> /usr/bin/install. It would seem that Apple's python and the >>> macPython binary installer are going out with broken anydbm and >>> shelve builtins, and installing the BerkelyDB.4.2 and bsdb module >>> fixes things (I also downloaded/built/installed the bsddb3 module >>> for good measure). The sleepycat db distribution is the only one I >>> could get to build and install without any headaches or having to >>> resort to DarwinPorts or Fink. To some developers, particularly >>> less experienced ones such as I, this may cause some frustration if >>> they write code on some other platform which utilizes persistent >>> data objects, and hope it will run on OS X (and be able to at least >>> create and read new persistant data objects) unmodified. If >>> anyone has a more elegant solution, or I'm just missing something >>> elementary please let me know. I'm just offering the experience to >>> the list in the event that it hasn't been documented yet. Regards, >> >> >> Are you talking about _bsddb.so from the "official unofficial package >> repository" located at http://undefined.org/python/pimp/ ? This >> downloads and installs just fine anywhere I've ever tried it, and has >> no dependency on BerkeleyDB (it is statically linked in)... well, as >> long as you are using the stock Python 2.3.0 that comes with Panther >> (which is a requirement for the package repository). >> >> -bob > > > -- > Karl Garsha > Light Microscopy Specialist > Imaging Technology Group > Beckman Institute for Advanced Science and Technology > University of Illinois at Urbana-Champaign > 405 North Mathews Avenue > Urbana, IL 61801 > Office: B650J > Phone: 217.244.6292 > Fax: 217.244.6219 > Mobile: 217.390.1874 > www.itg.uiuc.edu > > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040223/ed9015d6/smime.bin From bob at redivi.com Mon Feb 23 14:46:14 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 23 14:43:14 2004 Subject: [Pythonmac-SIG] LaunchServices (was AppScripting 0.3.0) In-Reply-To: <3405CE64-301D-11D8-B3E2-000A27B19B96@cwi.nl> References: <3405CE64-301D-11D8-B3E2-000A27B19B96@cwi.nl> Message-ID: On Dec 16, 2003, at 6:11 PM, Jack Jansen wrote: > > On 16-dec-03, at 22:00, Bob Ippolito wrote: > >> I have a wrapper around his module that exposes the same API as my >> LaunchServices module if you're interested, but neither I nor Jack >> have a non-Panther version of the new LaunchServices package >> available (I'm guessing you still use Jaguar). > > I'm really waiting for one or two people to say: "LaunchServices is > good enough right now" and I'll move it to the official PackMan > database, and I'll do a Jaguar version too at that time. Jack, This is just a reminder.. it's been at least two and a half months, I believe has is already including your LaunchServices as part of appscript (he's compiling one or the other, hopefully yours and not mine). I just realized that you have not made it available via PackageManager when I was writing this blog entry: http://www.pycs.net/bob/weblog/2004/02/23.html I did notice a bug in the version that I have installed (at least as old as the message I'm replying to), kLSUnknownCreator comes through as an integer, not an OSType. I am not sure if this is fixed in CVS or not. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040223/01b4c44b/smime.bin From kmmcdonald at wisc.edu Mon Feb 23 20:24:11 2004 From: kmmcdonald at wisc.edu (Kenneth McDonald) Date: Mon Feb 23 20:25:58 2004 Subject: [Pythonmac-SIG] Using IDLE to run Tkinter programs in OS X? Message-ID: <268B0F94-6668-11D8-895F-000A956870AC@wisc.edu> Is there any way to have IDLE use pythonw, rather python, when it runs modules, so that I don't get the -606 error when working on programs that use Tkinter? Also, I'm curious if the "OS X look" in Aqua Tcl/Tk is a result of a "themable" ability in Tk, or is a special case thing for OS X only. I haven't used Tk for a number of years, and at the time, it had only one "look". Thanks, Ken McDonald From bob at redivi.com Mon Feb 23 20:50:56 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 23 20:47:40 2004 Subject: [Pythonmac-SIG] Using IDLE to run Tkinter programs in OS X? In-Reply-To: <268B0F94-6668-11D8-895F-000A956870AC@wisc.edu> References: <268B0F94-6668-11D8-895F-000A956870AC@wisc.edu> Message-ID: On Feb 23, 2004, at 8:24 PM, Kenneth McDonald wrote: > Is there any way to have IDLE use pythonw, rather python, when it runs > modules, so that I don't get the -606 error when working on programs > that use Tkinter? > > Also, I'm curious if the "OS X look" in Aqua Tcl/Tk is a result of a > "themable" ability in Tk, or is a special case thing for OS X only. I > haven't used Tk for a number of years, and at the time, it had only > one "look". The fact that it uses native widgets everywhere, and has so many bugs, is a TclTkAqua only feature. Pretty much everyone I've heard from is so disappointed with TclTkAqua that they ported to another framework, or ended up compiling their own Python and X11 based Tcl/Tk. That said, I'm not familiar enough with the IDLE source code to even guess where to look.. I would grep it for sys.executable and see what sys.executable is at runtime of your module. It should point somewhere in an .app bundle. -bob From mitchchapman at earthlink.net Mon Feb 23 21:42:55 2004 From: mitchchapman at earthlink.net (Mitch Chapman) Date: Mon Feb 23 21:42:10 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> Message-ID: <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> On Feb 23, 2004, at 2:02 AM, Jack Jansen wrote: > Implementation is going to be peanuts, design is what we want. > We should investigate the paradigms people use nowadays to get at > their datafiles, and come up with something that is as close as > possible to that. > > How does pygame find its datafiles? When we were involved in development with pygtk we stored data files in subdirectories of the toplevel Python package for ease of distribution. We found the data files by searching on the Python path. The technique is documented in this article: http://www2.linuxjournal.com/lj-issues/issue87/4702.html I have updated the module PathFinder.py described in the article. The new version recognizes zip files in the Python path. If one of the zip files contains the data file being sought, then the data file is extracted to a temporary directory, preserving filename suffix. The location of the extracted file is remembered in case another client seeks it. At the end of the Python session the temporary files are removed. Use of the module is pretty simple: import PathFinder try: jpegPathname = PathFinder.find("images/sample.jpg") except PathFinder.Error, info: ... If any of this sounds relevant I can post a tarball containing the module and a regression test. -- Mitch From bob at redivi.com Mon Feb 23 22:04:28 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon Feb 23 22:01:15 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> Message-ID: <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> On Feb 23, 2004, at 9:42 PM, Mitch Chapman wrote: > On Feb 23, 2004, at 2:02 AM, Jack Jansen wrote: >> Implementation is going to be peanuts, design is what we want. >> We should investigate the paradigms people use nowadays to get at >> their datafiles, and come up with something that is as close as >> possible to that. >> >> How does pygame find its datafiles? > > When we were involved in development with pygtk we stored data files in > subdirectories of the toplevel Python package for ease of distribution. > We found the data files by searching on the Python path. > > The technique is documented in this article: > http://www2.linuxjournal.com/lj-issues/issue87/4702.html > > I have updated the module PathFinder.py described in the article. The > new version recognizes zip files in the Python path. If one of the zip > files contains the data file being sought, then the data file is > extracted to a temporary directory, preserving filename suffix. The > location of the extracted file is remembered in case another client > seeks it. At the end of the Python session the temporary files are > removed. > > Use of the module is pretty simple: > > import PathFinder > try: > jpegPathname = PathFinder.find("images/sample.jpg") > except PathFinder.Error, info: > ... > > If any of this sounds relevant I can post a tarball containing the > module and a regression test. Extracting data from zip files is not strictly desired or necessary as we have bundles on OS X, temp files suck, most data files probably aren't going to compress very well anyhow. Things I don't like about this implementation: * It's up to the module developer to ensure that their "images/sample.jpg" is a unique filename that another module developer will not use or else PathFinder might find the wrong file. This is very bad, because if the module developers can screw this up they definitely will. Forcing them to specify a key, like __name__ or perhaps "org.pygame", is more sensible because it isolates packages from each other. * What if you want to make this all work over a network or something crazy like that? You have to go through all the trouble of injecting a different PathFinder, which is Really Hard because people are going to include PathFinder with their packages to reduce dependencies, especially because Python doesn't yet make non-relative imports easy. If we're stuffing something new down people's throats it should be extensible like my proposed interface-adaptation-based solution would be. The provider of this resource-finding-service should be up to the packaging software (py2exe, bundlebuilder, etc.) or a default stupid __file__ based implementation, not some do-everything-for-everyone-cross-platform-predict-the-future module. -bob From smiles at saysomething.com Tue Feb 24 00:18:37 2004 From: smiles at saysomething.com (Christopher Smith) Date: Tue Feb 24 00:19:10 2004 Subject: [Pythonmac-SIG] Re: Swig_for_Mac In-Reply-To: Message-ID: > I'm trying to use an extension I've downloaded (APSE, a "Python port > of the String::Approx module written for perl by Jarkko Hietaniemi."). > I downloaded Swig_for_Mac 1.3.11 and am trying to figure out how to > make one of the examples work before I try to process the apse.c file. > > I start up Swig_for_Mac and set the source to be the example.i file > and press run. A wrapper file is produced, example_wrap.c. > > Now I don't know what to do from here. I am having a hard time sifting > out what can/should be done with the Swig_for_Mac and what must be > done at the command line with gcc. > Thanks very much to those that sent suggestions as to what I should do to get Swig working under OS X. It was a large but not insurmountable learning curve, having been a mac user for many years, but not a seasoned unix user. For the record (and for anyone else like me) I report the following steps that I took to get the APSE extension working. (I abandoned work with Swig_for_Mac in favor of the unix swig.) * downloaded and installed the developer tools (Dec 2002 version) from Apple; without these, I got a "configure: error: C preprocessor "/lib/cpp" fails sanity check" under certain conditions and was told that the "string.h" file was missing under other conditions. * restarted the computer * downloaded the swig-1.3.20 file and installed that per unix instructions; this installed a binary in /usr/local/bin * issued the swig command (even after restarting) and got a "swig: command not found" error. This was remedied by editing (actually creating) a file named ".login" in my home directory containing (as suggested at http://forums.osxfaq.com/viewtopic.php?t=3012): set path = (. \ -/bin \ /Developer/Tools /Develooper/Applications \ /usr/local/bin /usr/bin /bin \ /sr/local/sbin /usr/sbin /sbin \ ) * threw away my old folder with the Apse failed work in it and re-unstuffed the Apse-0.1.tar file (with Stuffit Expander) on the desktop * started the "terminal" program; changed to the Apse directory (cd ~/Desktop/Apse-0.1) and issued the commands as in the readme: csmith% python setup.py build csmith% python setup.py install * and began using the Apse extension :-) Since this was the first time that I have built an extension, I had no idea that I needed the developer tools to do it. There was certainly a large chasm between me as a Mac user, and recent Python user and me as someone able to add to Python from other's extensions. I wonder if those of you that write extensions might include a few extra lines in your readme about building the extension under os x so as to point out that the developer tools and (perhaps) swig are necessary to build your extension. Without the input from a few others on the list here I would have been totally lost. From mitchchapman at earthlink.net Tue Feb 24 00:54:15 2004 From: mitchchapman at earthlink.net (Mitch Chapman) Date: Tue Feb 24 00:53:29 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> Message-ID: On Feb 23, 2004, at 8:04 PM, Bob Ippolito wrote: > Extracting data from zip files is not strictly desired or necessary as > we have bundles on OS X, temp files suck, most data files probably > aren't going to compress very well anyhow. > > Things I don't like about this implementation: > > * It's up to the module developer to ensure that their > "images/sample.jpg" is a unique filename that another module developer > will not use or else PathFinder might find the wrong file. This is > very bad, because if the module developers can screw this up they > definitely will. Forcing them to specify a key, like __name__ or > perhaps "org.pygame", is more sensible because it isolates packages > from each other. I think you may have misread the code. PathFinder uses the same path resolution techniques as Python itself (with the exception that it doesn't use sys.meta_path). That is, it searches every entry on sys.path, seeing if the relative path supplied by the caller can be resolved by joining with the current sys.path entry. The changes relating to zip file support are intended to mimic Python 2.3's support for importing from zip files. They do not require that the user's content be packaged in zip files. -- Mitch From bob at redivi.com Tue Feb 24 01:12:54 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 24 01:09:40 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> Message-ID: <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> On Feb 24, 2004, at 12:54 AM, Mitch Chapman wrote: > On Feb 23, 2004, at 8:04 PM, Bob Ippolito wrote: >> Extracting data from zip files is not strictly desired or necessary >> as we have bundles on OS X, temp files suck, most data files probably >> aren't going to compress very well anyhow. >> >> Things I don't like about this implementation: >> >> * It's up to the module developer to ensure that their >> "images/sample.jpg" is a unique filename that another module >> developer will not use or else PathFinder might find the wrong file. >> This is very bad, because if the module developers can screw this up >> they definitely will. Forcing them to specify a key, like __name__ >> or perhaps "org.pygame", is more sensible because it isolates >> packages from each other. > > I think you may have misread the code. PathFinder uses the same path > resolution techniques as Python itself (with the exception that it > doesn't use sys.meta_path). That is, it searches every > entry on sys.path, seeing if the relative path supplied by the caller > can be resolved by joining with the current sys.path entry. But the python import mechanism knows what module you're importing from, your API does not. sys.path is a fallback mechanism gets used if the module can not be found relative to the module doing the importing. Your mechanism ONLY uses the fallback mechanism, so if pygame wants "image/sample.jpg" and foobazmodule wants "image/sample.jpg", it's not really possible to have both of them get what they want without an API change. > The changes relating to zip file support are intended to mimic > Python 2.3's support for importing from zip files. They do not require > that the user's content be packaged in zip files. That's fine, I just don't think it's necessary. In any case, a more flexible version based on interfaces and adaptation would allow artbitrary-packaging-software to provide zip, rar, http, encrypted, or whatever data file support it needs. -bob From bob at redivi.com Tue Feb 24 01:24:36 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 24 01:21:24 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> Message-ID: <1E09E2B5-6692-11D8-BA2B-000A95686CD8@redivi.com> On Feb 24, 2004, at 1:12 AM, Bob Ippolito wrote: > > On Feb 24, 2004, at 12:54 AM, Mitch Chapman wrote: > >> On Feb 23, 2004, at 8:04 PM, Bob Ippolito wrote: >>> Extracting data from zip files is not strictly desired or necessary >>> as we have bundles on OS X, temp files suck, most data files >>> probably aren't going to compress very well anyhow. >>> >>> Things I don't like about this implementation: >>> >>> * It's up to the module developer to ensure that their >>> "images/sample.jpg" is a unique filename that another module >>> developer will not use or else PathFinder might find the wrong file. >>> This is very bad, because if the module developers can screw this >>> up they definitely will. Forcing them to specify a key, like >>> __name__ or perhaps "org.pygame", is more sensible because it >>> isolates packages from each other. >> >> I think you may have misread the code. PathFinder uses the same path >> resolution techniques as Python itself (with the exception that it >> doesn't use sys.meta_path). That is, it searches every >> entry on sys.path, seeing if the relative path supplied by the caller >> can be resolved by joining with the current sys.path entry. > > But the python import mechanism knows what module you're importing > from, your API does not. sys.path is a fallback mechanism gets used > if the module can not be found relative to the module doing the > importing. Your mechanism ONLY uses the fallback mechanism, so if > pygame wants "image/sample.jpg" and foobazmodule wants > "image/sample.jpg", it's not really possible to have both of them get > what they want without an API change. > >> The changes relating to zip file support are intended to mimic >> Python 2.3's support for importing from zip files. They do not >> require >> that the user's content be packaged in zip files. > > That's fine, I just don't think it's necessary. In any case, a more > flexible version based on interfaces and adaptation would allow > artbitrary-packaging-software to provide zip, rar, http, encrypted, or > whatever data file support it needs. Just to clarify, when I say interfaces and adaptation, I really mean "a global registry somewhere so the default implementation can be overridden", not unlike sys.path and import hooks. PyProtocols is just a great example of a well designed central registry with a lot of features that would make something like this extremely trivial, and it even has a PEP behind it. Zope X3's components, and Twisted's components are both also potentially usable (though the protocolForURI feature is key, and I'm not sure if either has that), but are far less generic and flexible (PyProtocols is actually flexible enough to integrate with either, but not vice versa). -bob From paul at fxtech.com Tue Feb 24 05:54:40 2004 From: paul at fxtech.com (Paul Miller) Date: Tue Feb 24 05:54:49 2004 Subject: [Pythonmac-SIG] Python.h include errors on OS X, using Python 2.3 framework In-Reply-To: <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> Message-ID: <6.0.1.1.2.20040224045229.02bfd3c8@mail.fxtech.com> I'm trying to include Python.h into a Mach-O bundle build using CW 8.3 on OS X 10.3. I have added /System/Library/Frameworks/Python.framework/Headers to my access paths, so I can #include "Python.h". When I include it, though, I get hundreds of errors, starting with problems in unistd.h (__dead). What gives? I have to be doing something wrong, but I can't figure out what. From Jack.Jansen at cwi.nl Tue Feb 24 07:33:33 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Tue Feb 24 07:33:17 2004 Subject: [Pythonmac-SIG] Python.h include errors on OS X, using Python 2.3 framework In-Reply-To: <6.0.1.1.2.20040224045229.02bfd3c8@mail.fxtech.com> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> <6.0.1.1.2.20040224045229.02bfd3c8@mail.fxtech.com> Message-ID: On 24 Feb 2004, at 11:54, Paul Miller wrote: > I'm trying to include Python.h into a Mach-O bundle build using CW 8.3 > on OS X 10.3. I think you're treading unknown ground, trying to use OSX Python from CodeWarrior. There's no reason why you shouldn't be able to get it to work, but as far as I know it hasn't been tried yet (i.e. if anyone else here tried it: please speak up!). > When I include it, though, I get hundreds of errors, starting with > problems in unistd.h (__dead). Which C library are you using? If you're using the default OSX library and includes I can't think of why this would be a problem. If you're using MSL (assuming MetroWorks have ported it to Mach-O by now, I haven't followed what they've been doing the last two releases) then you're going to run into problems anyway as your hosting application will probably use a different stdio than Python which will lead to all sorts of interesting problems (i.e. I wouldn't do this if I were you:-). -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From paul at fxtech.com Tue Feb 24 07:43:14 2004 From: paul at fxtech.com (Paul Miller) Date: Tue Feb 24 07:43:21 2004 Subject: [Pythonmac-SIG] Python.h include errors on OS X, using Python 2.3 framework In-Reply-To: References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> <6.0.1.1.2.20040224045229.02bfd3c8@mail.fxtech.com> Message-ID: <6.0.1.1.2.20040224063926.05a95010@mail.fxtech.com> >>I'm trying to include Python.h into a Mach-O bundle build using CW 8.3 on >>OS X 10.3. > >I think you're treading unknown ground, trying to use OSX Python from >CodeWarrior. There's no reason why you shouldn't be able to get it to >work, but as far as I know it hasn't been tried yet (i.e. if anyone else >here tried it: please speak up!). Why does everything on the Mac have to be so DIFFICULT? >>When I include it, though, I get hundreds of errors, starting with >>problems in unistd.h (__dead). > >Which C library are you using? If you're using the default OSX library and >includes I can't think of why this would be a problem. If you're using MSL >(assuming MetroWorks have ported it to Mach-O by now, I haven't followed >what they've been doing the last two releases) then you're going to run >into problems anyway as your hosting application will probably use a >different stdio than Python which will lead to all sorts of interesting >problems (i.e. I wouldn't do this if I were you:-). Yes, I'm using the default Mach-O stationary, so it is using MSL (their native OS X version). You know, I tried going the Mach-O bundle/framework route because I couldn't get MacPython PythonCoreCarbon to load with GetDiskFragment. My last resort would have been to build the Python code right into my shared library, but I can't get Python to build with CW either (something to do with GUSI). Three possible ways to solve the problem, all with massive blockers. From mitchchapman at earthlink.net Tue Feb 24 09:24:11 2004 From: mitchchapman at earthlink.net (Mitch Chapman) Date: Tue Feb 24 09:23:20 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> Message-ID: <1D2E8343-66D5-11D8-9E4B-000393D443CE@earthlink.net> On Feb 23, 2004, at 11:12 PM, Bob Ippolito wrote: >> I think you may have misread the code. PathFinder uses the same path >> resolution techniques as Python itself (with the exception that it >> doesn't use sys.meta_path). That is, it searches every >> entry on sys.path, seeing if the relative path supplied by the caller >> can be resolved by joining with the current sys.path entry. > > But the python import mechanism knows what module you're importing > from, your API does not. sys.path is a fallback mechanism gets used > if the module can not be found relative to the module doing the > importing. Your mechanism ONLY uses the fallback mechanism, so if > pygame wants "image/sample.jpg" and foobazmodule wants > "image/sample.jpg", it's not really possible to have both of them get > what they want without an API change. Yes, that's true: PathFinder.find needs always to be used as though the caller were importing the required data file from a package, and it requires Guido's recommended usage for package path specifiers. (From PEP 8: "Relative imports for intra-package imports are highly discouraged. Always use the absolute package path for all imports.") And that's not evident from the API. > In any case, a more flexible version based on interfaces and > adaptation would allow artbitrary-packaging-software to provide zip, > rar, http, encrypted, or whatever data file support it needs. In fact Python 2.3's import mechanism is also designed to support this, although it implements only zip and "regular file" imports at present. Jack asked for a focus on design. Maybe I should have responded to that before responding to his request for examples of how people are getting at data now. I'd like to see a system which locates data files in the same way as Python's import mechanism (so as _not_ to "stuff something new down people's throats"). It should produce the representations of loaded data required by consuming APIs (pathnames, in both my examples and my experience) "out of the box", while being extensible as you recommend. And it should present a simple end-user API. That's why I dislike this proposal -- it makes even the most common use case tedious: myResourceFileObj = adapt((__module__, "resourcefilename"), IReadableFileLike, factory=defaultFactory) The import implementation in Python 2.3 supports most of these requirements, except that it produces only loaded modules. Perhaps it would be a good starting point for a design. -- Mitch From bob at redivi.com Tue Feb 24 10:18:28 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 24 10:15:33 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: <1D2E8343-66D5-11D8-9E4B-000393D443CE@earthlink.net> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> <1D2E8343-66D5-11D8-9E4B-000393D443CE@earthlink.net> Message-ID: On Feb 24, 2004, at 9:24 AM, Mitch Chapman wrote: > On Feb 23, 2004, at 11:12 PM, Bob Ippolito wrote: >>> I think you may have misread the code. PathFinder uses the same >>> path resolution techniques as Python itself (with the exception that >>> it >>> doesn't use sys.meta_path). That is, it searches every >>> entry on sys.path, seeing if the relative path supplied by the caller >>> can be resolved by joining with the current sys.path entry. >> >> But the python import mechanism knows what module you're importing >> from, your API does not. sys.path is a fallback mechanism gets used >> if the module can not be found relative to the module doing the >> importing. Your mechanism ONLY uses the fallback mechanism, so if >> pygame wants "image/sample.jpg" and foobazmodule wants >> "image/sample.jpg", it's not really possible to have both of them get >> what they want without an API change. > > Yes, that's true: PathFinder.find needs always to be used as though > the caller were importing the required data file from a package, > and it requires Guido's recommended usage for package path specifiers. > (From PEP 8: "Relative imports for intra-package imports are highly > discouraged. Always use the absolute package path for all imports.") > And that's not evident from the API. Yeah, but people aren't going to do it that way if the API doesn't make it blatantly obvious. >> In any case, a more flexible version based on interfaces and >> adaptation would allow artbitrary-packaging-software to provide zip, >> rar, http, encrypted, or whatever data file support it needs. > > In fact Python 2.3's import mechanism is also designed to > support this, although it implements only zip and "regular file" > imports at present. Yeah, but writing import hooks is a real PITA. I'm sure you know this :) > Jack asked for a focus on design. Maybe I should have responded > to that before responding to his request for examples of how people > are getting at data now. > > I'd like to see a system which locates data files in the same way as > Python's import mechanism (so as _not_ to "stuff something new down > people's throats"). It should produce the representations of > loaded data required by consuming APIs (pathnames, in both my examples > and my experience) "out of the box", while being extensible as you > recommend. > > And it should present a simple end-user API. That's why > I dislike this proposal -- it makes even the most common use case > tedious: > > myResourceFileObj = adapt((__module__, "resourcefilename"), > IReadableFileLike, factory=defaultFactory) The example I gave was basically _the entire implementation_ sans PyProtocols, I wouldn't dare actually forcing that API on people. It would be wrapped up in a module that people would stuff in their packages. In fact, such a module could still work even if PyProtocols is not available by using dummy objects for the protocols and having adapt just call the factory.. which eliminates all dependencies. That's basically how ZODB works in relation to Zope X3's components, if it's not available it will just use dummy objects. PathFinder would be an example of an adapter that an adaptation-based solution could use as an alternative to the default os.path.join(...), and could even be the canonical implementation for say, py2exe based builds. > The import implementation in Python 2.3 supports most of these > requirements, except that it produces only loaded modules. Perhaps > it would be a good starting point for a design. My biggest problem is that it's going to be hard to get people to use a PathFinder-like solution if the user has to install the thing separately, unless it comes with Python or at least has a really good chance of coming with Python. It can't be usefully embedded in every package due to the fact that it needs to have a single global registry in order to do its job properly. PyProtocols was just an example of a PEP-backed single global registry. With the bonus that it also makes the implementation a whole lot simpler and easier to extend than say, import hooks. Of course, it would make your apps about 364k bigger on OS X if you include the whole thing (source, bytecode, module w/ debug symbols) but can be stripped down to 100k or less before compression by removing source, tests, and debugging symbols (most of this is typical executable-packager behavior anyway). -bob From tconner at mac.com Tue Feb 24 10:33:08 2004 From: tconner at mac.com (Tim Conner) Date: Tue Feb 24 10:33:11 2004 Subject: [Pythonmac-SIG] Use Quartz - CoreGraphics to Rotate PDF Message-ID: <11327956.1077636788689.JavaMail.tconner@mac.com> I've got another CoreGraphics question. I've been pooring over the help that I got on my last request for a pdf concatenator subroutine. Gus had the best solution for my needs, and he posted it to his weblog here: http://www.gusmueller.com/blog/archives/2004/2/18.html#1027 - thanks for all the help everyone. My second quest is to right a script that will look at the dimensions of a pdf and determine if it's landscape or portrait, and rotate it conditionally. Eg, if landscape, rotate to portrait. What I'm looking for from you pros is just an example of a pdf rotation using CoreGraphics, or what calls to use to achieve a rotate of a 1 or many paged document. Thanks, Tim From barry at python.org Tue Feb 24 10:50:03 2004 From: barry at python.org (Barry Warsaw) Date: Tue Feb 24 10:50:59 2004 Subject: [Pythonmac-SIG] Re: [Python-Dev] Plea for function/method syntax sugar (PEP 318, with a different syntax) In-Reply-To: <08F6B684-6283-11D8-8F69-000A95686CD8@redivi.com> References: <08F6B684-6283-11D8-8F69-000A95686CD8@redivi.com> Message-ID: <1077637802.20340.36.camel@anthem.wooz.org> On Wed, 2004-02-18 at 21:26, Bob Ippolito wrote: > the latest version of mwh's patch is here: > http://starship.python.net/crew/mwh/hacks/meth-syntax-sugar-3.diff Does anybody else have problems applying this patch? I get: % patch < meth-syntax-sugar-3.diff patch: **** File Grammar is not a regular file -- can't patch Grammar/Grammar sure seems like a regular file to me though. Standard RH9 patch(1), v 2.5.4. Above patch snagged with wget. -Barry From gherman at darwin.in-berlin.de Tue Feb 24 11:12:44 2004 From: gherman at darwin.in-berlin.de (Dinu Gherman) Date: Tue Feb 24 11:11:34 2004 Subject: [Pythonmac-SIG] How to find correct Carbon module(s)? Message-ID: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> Hi, I try to use some Carbon packages with vanilla Python 2.3, but I'm having trouble to find the right Carbon libs to import... Does anybody have a hint as of what to import to make the Carbon functions and constants below work in Python 2.3? Thanks, Dinu // mainWindow = ... void *ref = [mainWindow windowRef]; BOOL flag = YES; if (flag) ChangeWindowAttributes( ref, AM_kWindowIgnoreClicksAttribute, kWindowNoAttributes); else ChangeWindowAttributes( ref, kWindowNoAttributes, AM_kWindowIgnoreClicksAttribute); From sjoerd at acm.org Tue Feb 24 11:14:01 2004 From: sjoerd at acm.org (Sjoerd Mullender) Date: Tue Feb 24 11:16:15 2004 Subject: [Pythonmac-SIG] Re: [Python-Dev] Plea for function/method syntax sugar (PEP 318, with a different syntax) In-Reply-To: <1077637802.20340.36.camel@anthem.wooz.org> References: <08F6B684-6283-11D8-8F69-000A95686CD8@redivi.com> <1077637802.20340.36.camel@anthem.wooz.org> Message-ID: <403B7849.3050504@acm.org> Barry Warsaw wrote: > On Wed, 2004-02-18 at 21:26, Bob Ippolito wrote: > > >>the latest version of mwh's patch is here: >>http://starship.python.net/crew/mwh/hacks/meth-syntax-sugar-3.diff > > > Does anybody else have problems applying this patch? I get: > > % patch < meth-syntax-sugar-3.diff > patch: **** File Grammar is not a regular file -- can't patch > > Grammar/Grammar sure seems like a regular file to me though. Standard > RH9 patch(1), v 2.5.4. Above patch snagged with wget. Try patch -p0. Patch removes directory names by default. -- Sjoerd Mullender From barry at python.org Tue Feb 24 11:19:35 2004 From: barry at python.org (Barry Warsaw) Date: Tue Feb 24 11:19:55 2004 Subject: [Pythonmac-SIG] Re: [Python-Dev] Plea for function/method syntax sugar (PEP 318, with a different syntax) In-Reply-To: <403B7849.3050504@acm.org> References: <08F6B684-6283-11D8-8F69-000A95686CD8@redivi.com> <1077637802.20340.36.camel@anthem.wooz.org> <403B7849.3050504@acm.org> Message-ID: <1077639574.20340.45.camel@anthem.wooz.org> On Tue, 2004-02-24 at 11:14, Sjoerd Mullender wrote: > Try patch -p0. Patch removes directory names by default. Blah. D'uh. Thanks. -B From keithn at 2xtreme.net Tue Feb 24 11:34:36 2004 From: keithn at 2xtreme.net (Keith Nemitz) Date: Tue Feb 24 11:34:34 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX Message-ID: <55912BFC-66E7-11D8-9546-000393DB52E4@2xtreme.net> I'm currently developing a standalone app for OS X. I use a data folder in the resources folder to contain all of my app specific files. Now, from what I've read on this thread, it sounds like I should be experiencing access/permission difficulties. My app has run on three other Macs, and I just started having trouble with the third one. I think it might be an access issue, but I haven't confirmed it. My app reads and creates files in its data folder. Keith Nemitz Mousechief From bob at redivi.com Tue Feb 24 11:27:53 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 24 11:40:17 2004 Subject: [Pythonmac-SIG] How to find correct Carbon module(s)? In-Reply-To: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> References: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> Message-ID: <651B9144-66E6-11D8-BA2B-000A95686CD8@redivi.com> On Feb 24, 2004, at 11:12 AM, Dinu Gherman wrote: > I try to use some Carbon packages with vanilla Python 2.3, but > I'm having trouble to find the right Carbon libs to import... > Does anybody have a hint as of what to import to make the Carbon > functions and constants below work in Python 2.3? > > Thanks, > > Dinu > > > // mainWindow = ... > void *ref = [mainWindow windowRef]; > BOOL flag = YES; > > if (flag) > ChangeWindowAttributes( > ref, > AM_kWindowIgnoreClicksAttribute, > kWindowNoAttributes); > else > ChangeWindowAttributes( > ref, > kWindowNoAttributes, > AM_kWindowIgnoreClicksAttribute); -[NSWindow windowRef] looks like it's bridged to Carbon.Win.Window.. so you should be able to do: win = NSApplication.sharedApplication().mainWindow().windowRef() win.ChangeWindowAttributes(AM_kWindow...) I have no idea where those constants come from though. -bob From bob at redivi.com Tue Feb 24 11:44:20 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 24 11:41:03 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: <55912BFC-66E7-11D8-9546-000393DB52E4@2xtreme.net> References: <55912BFC-66E7-11D8-9546-000393DB52E4@2xtreme.net> Message-ID: On Feb 24, 2004, at 11:34 AM, Keith Nemitz wrote: > I'm currently developing a standalone app for OS X. I use a data > folder in the resources folder to contain all of my app specific > files. Now, from what I've read on this thread, it sounds like I > should be experiencing access/permission difficulties. My app has run > on three other Macs, and I just started having trouble with the third > one. I think it might be an access issue, but I haven't confirmed it. > > My app reads and creates files in its data folder. You've misunderstood. This is another issue entirely, having to do with packages inside applications that need data, not applications themselves that need data. In any case, it is an extremely bad idea to write to the application bundle, and that may have something to do with your trouble. The appropriate place for writing files would most likely be "/Library/Application Support/YourApplication" or "~/Library/Application Support/YourApplication", unless they are plist preferences.. -bob From keithn at 2xtreme.net Tue Feb 24 13:14:35 2004 From: keithn at 2xtreme.net (Keith Nemitz) Date: Tue Feb 24 13:30:01 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX Message-ID: <4D1E0CD5-66F5-11D8-A299-000393DB52E4@2xtreme.net> > > In any case, it is an extremely bad idea to write to the application > bundle, and that may have something to do with your trouble. The > appropriate place for writing files would most likely be > "/Library/Application Support/YourApplication" or > "~/Library/Application Support/YourApplication", unless they are plist > preferences.. > I think it would be an extremely good idea to allow an app to be able to write to itself. Currently, my app is 100% cross platform, thanks to the good people at py*. Now I'm going to have to sully my hands again with religious doctrine and programmer machismo. sigh, Keith Nemitz <-- sick of it all, after eight years of porting apps. From bob at redivi.com Tue Feb 24 13:40:08 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 24 13:36:50 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: <4D1E0CD5-66F5-11D8-A299-000393DB52E4@2xtreme.net> References: <4D1E0CD5-66F5-11D8-A299-000393DB52E4@2xtreme.net> Message-ID: On Feb 24, 2004, at 1:14 PM, Keith Nemitz wrote: >> In any case, it is an extremely bad idea to write to the application >> bundle, and that may have something to do with your trouble. The >> appropriate place for writing files would most likely be >> "/Library/Application Support/YourApplication" or >> "~/Library/Application Support/YourApplication", unless they are >> plist preferences.. >> > > I think it would be an extremely good idea to allow an app to be able > to write to itself. Currently, my app is 100% cross platform, thanks > to the good people at py*. Now I'm going to have to sully my hands > again with religious doctrine and programmer machismo. That's too bad :) Apple says don't do it with good reason. You can run into various locking/permissions problems (i.e. if the app was on a CD-ROM, on a Server, owned by another user, etc.) if you do, and they offer perfectly good alternatives that are flexible for almost any purpose and do not have such issues. You shouldn't be doing such things on any platform, especially not OS X. If you would like to modify your own app bundle, I strongly suggest making a copy of the app and changing that.. as is common for creating a self-contained presentation from a presentation-viewer, or a self-extracting archive, etc. -bob From tburbage3 at excite.com Tue Feb 24 14:50:36 2004 From: tburbage3 at excite.com (tburbage3@excite.com) Date: Tue Feb 24 14:50:43 2004 Subject: [Pythonmac-SIG] Capturing system screen pixels on OSX Message-ID: <20040224195036.2849A299A0@xprdmailfe21.nwk.excite.com> I'm experimenting with a means via Python to capture a rectangle of the screen for the purpose of software/UI testing. I'm using Python because I need a cross-platform solution: Windows, OS10.3.x -- eventually Linux. I'm using the latest "stable" versions of Python and the packages mentioned below. Jack (Jensen), I have your stuff installed and working, and also used the database from <http://undefined.org/python/pimp/> to get all of the packages installed properly. The script currently uses: OpenGL.GL, OpenGL.GLUT -- to establish a graphics context/display mode (RGB/single buffer) and gain access to pixel data in the framebuffer.Image (PIL) -- to save the buffer contents to file. The script specifically uses GLUT's 'glutEnterGameMode()' to establish the full screen as the viewport, then uses glReadPixels() to get the desired capture subregion (rect). This script works perfectly on Windows, but on OSX I end up with (seemingly) random RGB values.The script makes one critical assumption that on Windows at least is true: that when GLUT establishes it's graphics context and "takes over the screen buffer" the contents of the front buffer ARE the current screen contents until glClear() is called or some other drawing operation is done. Needless to say, there could be alot of reasons why my approach isn't working on OSX, so I thought it time to ask folks in the community familiar with graphics programming on OSX whether the approach I've generally describes sounds like it *should* work (meaning I might just need to keep tweaking) or that there might be a more effective approach. Thanks,Tom BurbageRedwood City, CA _______________________________________________ Join Excite! - http://www.excite.com The most personalized portal on the Web! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20040224/c77d23e5/attachment.html From oussoren at cistron.nl Tue Feb 24 16:52:37 2004 From: oussoren at cistron.nl (Ronald Oussoren) Date: Tue Feb 24 16:53:48 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX In-Reply-To: <4D1E0CD5-66F5-11D8-A299-000393DB52E4@2xtreme.net> References: <4D1E0CD5-66F5-11D8-A299-000393DB52E4@2xtreme.net> Message-ID: On 24-feb-04, at 19:14, Keith Nemitz wrote: >> >> In any case, it is an extremely bad idea to write to the application >> bundle, and that may have something to do with your trouble. The >> appropriate place for writing files would most likely be >> "/Library/Application Support/YourApplication" or >> "~/Library/Application Support/YourApplication", unless they are >> plist preferences.. >> > > I think it would be an extremely good idea to allow an app to be able > to write to itself. Writing to the application is a bad idea, on Linux/Unix, OSX and some flavors of Windows the application will only be writeable by administrative accounts. Anyone that manages a sizeable amount of desktops gets very nervous when ordinary users can modify applications, even for single user desktops. Modifying the application also makes it harder to support multiple users on a machine (shared preferences). Ronald -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 From Jack.Jansen at cwi.nl Tue Feb 24 18:03:44 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Tue Feb 24 18:03:48 2004 Subject: [Pythonmac-SIG] New experimental PackMan packages: QuickTime and LaunchServices Message-ID: I've added two new packages to the experimental PackMan database: 1. A new version of LaunchServices with the minor bug Bob reported fixed. This will go to the main database as soon as I get one or two "it works" reports. 2. The first release of the QuickTime package, which will replace Carbon.Qt for MacPython 2.4. This new version opens many more APIs, such as the Quicktime Music Architecure, image codecs and much more. I definitely need feedback on the usability of these new features, there's a good chance I missed some crucial API somewhere, so please try this one if you're interested in quicktime. Also note that I haven't had any feedback on the experimental OSA package yet. Please speak up folks! At the moment the experimental database os 10.3-only. However, if people on OSX 10.2 are willing to promise they'll test stuff and report back I'm willing to do the extra work of building a 10.2 experimental database too. Let me know. You'll find the experimental database at . -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From keithn at 2xtreme.net Tue Feb 24 18:46:12 2004 From: keithn at 2xtreme.net (Keith Nemitz) Date: Tue Feb 24 18:46:07 2004 Subject: [Pythonmac-SIG] python + pygame on OSX In-Reply-To: References: <4D1E0CD5-66F5-11D8-A299-000393DB52E4@2xtreme.net> Message-ID: Wow, is the 'one flavor suits all' concept still breathing? I would have thought that went out with Ronald Reagan and MS-DOS. I wrote 'would be' instead of 'should be' and 'allow' instead of 'require'. Some apps don't fit the 'place anywhere - run everywhere' model. In my case, the installer determines locality access and the app itself determines runtime access. As a user, I don't want certain apps to go running around dropping files all over my hard-drive, begging me to grant them su status during their install and having to clean up their mess in order to completely trash their app. Most users don't have a clue about their preferences/library folder, but many of them have run out of space on their hard drive. But now we're OT, and - crap MS-DOS IS still around... Keith Nemitz On Feb 24, 2004, at 1:52 PM, Ronald Oussoren wrote: > > Writing to the application is a bad idea, on Linux/Unix, OSX and some > flavors of Windows the application will only be writeable by > administrative accounts. Anyone that manages a sizeable amount of > desktops gets very nervous when ordinary users can modify > applications, even for single user desktops. > > Modifying the application also makes it harder to support multiple > users on a machine (shared preferences). > On Feb 24, 2004, at 10:40 AM, Bob Ippolito wrote: >> > > That's too bad :) Apple says don't do it with good reason. You can > run into various locking/permissions problems (i.e. if the app was on > a CD-ROM, on a Server, owned by another user, etc.) if you do, and > they offer perfectly good alternatives that are flexible for almost > any purpose and do not have such issues. You shouldn't be doing such > things on any platform, especially not OS X. > > If you would like to modify your own app bundle, I strongly suggest > making a copy of the app and changing that.. as is common for creating > a self-contained presentation from a presentation-viewer, or a > self-extracting archive, etc. > > -bob > From bob at redivi.com Tue Feb 24 19:32:07 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Feb 24 19:28:58 2004 Subject: [Pythonmac-SIG] python + pygame on OSX In-Reply-To: References: <4D1E0CD5-66F5-11D8-A299-000393DB52E4@2xtreme.net> Message-ID: <0AEEEF29-672A-11D8-8678-000A95686CD8@redivi.com> Apple has guidelines for many reasons and they obviously put quite a bit of thought and effort into making sure they are good for both application developers and users of their operating systems. This use case is clearly covered with another approach. If you feel that they are wrong, you should file a bug and/or contact Developer Technical Support. You're obviously free to do it any way you want, but you have been warned that what you're doing is a bad idea and we have tried to point you in the recommended direction. -bob On Feb 24, 2004, at 6:46 PM, Keith Nemitz wrote: > Wow, is the 'one flavor suits all' concept still breathing? I would > have thought that went out with Ronald Reagan and MS-DOS. I wrote > 'would be' instead of 'should be' and 'allow' instead of 'require'. > > Some apps don't fit the 'place anywhere - run everywhere' model. In my > case, the installer determines locality access and the app itself > determines runtime access. > > As a user, I don't want certain apps to go running around dropping > files all over my hard-drive, begging me to grant them su status > during their install and having to clean up their mess in order to > completely trash their app. Most users don't have a clue about their > preferences/library folder, but many of them have run out of space on > their hard drive. > > But now we're OT, and - crap MS-DOS IS still around... > Keith Nemitz > > > On Feb 24, 2004, at 1:52 PM, Ronald Oussoren wrote: >> >> Writing to the application is a bad idea, on Linux/Unix, OSX and some >> flavors of Windows the application will only be writeable by >> administrative accounts. Anyone that manages a sizeable amount of >> desktops gets very nervous when ordinary users can modify >> applications, even for single user desktops. >> >> Modifying the application also makes it harder to support multiple >> users on a machine (shared preferences). >> > > On Feb 24, 2004, at 10:40 AM, Bob Ippolito wrote: >>> >> >> That's too bad :) Apple says don't do it with good reason. You can >> run into various locking/permissions problems (i.e. if the app was on >> a CD-ROM, on a Server, owned by another user, etc.) if you do, and >> they offer perfectly good alternatives that are flexible for almost >> any purpose and do not have such issues. You shouldn't be doing such >> things on any platform, especially not OS X. >> >> If you would like to modify your own app bundle, I strongly suggest >> making a copy of the app and changing that.. as is common for >> creating a self-contained presentation from a presentation-viewer, or >> a self-extracting archive, etc. >> >> -bob >> > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From keithn at 2xtreme.net Tue Feb 24 20:25:41 2004 From: keithn at 2xtreme.net (Keith Nemitz) Date: Tue Feb 24 20:25:35 2004 Subject: [Pythonmac-SIG] python + pygame on OSX In-Reply-To: <0AEEEF29-672A-11D8-8678-000A95686CD8@redivi.com> References: <4D1E0CD5-66F5-11D8-A299-000393DB52E4@2xtreme.net> <0AEEEF29-672A-11D8-8678-000A95686CD8@redivi.com> Message-ID: <86990800-6731-11D8-AC92-000393DB52E4@2xtreme.net> First I should apologize for having taken a tongue-in-cheek attitude. I didn't think the topic was very serious. Bob, I want to thank you for your suggestions. They will help me isolate my current access bug. I am aware of Apple guidelines. I worked there for four years in their development tools group. I'm not up-to-date on their OS X rules, but the don't write to the app rule existed for the original Mac OS, and for all the reason's mentioned here. However, there were well known exceptions to the rule. A couple dev tools (ResEdit, probably also Resourcerer) and several games broke it, however, which DTS surreptitiously approved. In programming, like other crafts, one should master one's art within the rules, and only then might one be ready to break them. Keith Nemitz On Feb 24, 2004, at 4:32 PM, Bob Ippolito wrote: > Apple has guidelines for many reasons and they obviously put quite a > bit of thought and effort into making sure they are good for both > application developers and users of their operating systems. This use > case is clearly covered with another approach. If you feel that they > are wrong, you should file a bug and/or contact Developer Technical > Support. You're obviously free to do it any way you want, but you > have been warned that what you're doing is a bad idea and we have > tried to point you in the recommended direction. > > -bob > > On Feb 24, 2004, at 6:46 PM, Keith Nemitz wrote: > >> Wow, is the 'one flavor suits all' concept still breathing? I would >> have thought that went out with Ronald Reagan and MS-DOS. I wrote >> 'would be' instead of 'should be' and 'allow' instead of 'require'. >> >> Some apps don't fit the 'place anywhere - run everywhere' model. In >> my case, the installer determines locality access and the app itself >> determines runtime access. >> >> As a user, I don't want certain apps to go running around dropping >> files all over my hard-drive, begging me to grant them su status >> during their install and having to clean up their mess in order to >> completely trash their app. Most users don't have a clue about their >> preferences/library folder, but many of them have run out of space on >> their hard drive. >> >> But now we're OT, and - crap MS-DOS IS still around... >> Keith Nemitz >> >> >> On Feb 24, 2004, at 1:52 PM, Ronald Oussoren wrote: >>> >>> Writing to the application is a bad idea, on Linux/Unix, OSX and >>> some flavors of Windows the application will only be writeable by >>> administrative accounts. Anyone that manages a sizeable amount of >>> desktops gets very nervous when ordinary users can modify >>> applications, even for single user desktops. >>> >>> Modifying the application also makes it harder to support multiple >>> users on a machine (shared preferences). >>> >> >> On Feb 24, 2004, at 10:40 AM, Bob Ippolito wrote: >>>> >>> >>> That's too bad :) Apple says don't do it with good reason. You can >>> run into various locking/permissions problems (i.e. if the app was >>> on a CD-ROM, on a Server, owned by another user, etc.) if you do, >>> and they offer perfectly good alternatives that are flexible for >>> almost any purpose and do not have such issues. You shouldn't be >>> doing such things on any platform, especially not OS X. >>> >>> If you would like to modify your own app bundle, I strongly suggest >>> making a copy of the app and changing that.. as is common for >>> creating a self-contained presentation from a presentation-viewer, >>> or a self-extracting archive, etc. >>> >>> -bob >>> >> >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG@python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > From Jack.Jansen at cwi.nl Wed Feb 25 04:23:30 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Wed Feb 25 04:23:03 2004 Subject: [Pythonmac-SIG] How to find correct Carbon module(s)? In-Reply-To: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> References: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> Message-ID: <4687EE71-6774-11D8-9389-000A958D1666@cwi.nl> On 24-feb-04, at 17:12, Dinu Gherman wrote: > Hi, > > I try to use some Carbon packages with vanilla Python 2.3, but > I'm having trouble to find the right Carbon libs to import... > Does anybody have a hint as of what to import to make the Carbon > functions and constants below work in Python 2.3? I almost have a solution to this problem, but I need a bit of help for the last bit. If I create a module Carbon.Carbon that imports all APIs from the Carbon modules We're half way there: >>> Carbon.Carbon.Window >>> Carbon.Carbon.NewWindow >>> Carbon.Carbon.NewWindow.__module__ '_Win' The '_Win' bits aren't optimal, but that can probably be fixed into Carbon.Win somehow. The bit I don't know how to do is the methods of the various objects. They print the right thing when you repr() them: >>> Carbon.Carbon.Window.ChangeWindowAttributes but you really want to refer to it as "Carbon.Carbon.ChangeWindowAttributes". Does anyone have a suggestion for a way to loop over all the objects in your namespace, check each object for being a class or type, for each matching one that isn't a duplicate find all the methods and put them in your namespace too? Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From M.Laloux at mrw.wallonie.be Wed Feb 25 04:30:00 2004 From: M.Laloux at mrw.wallonie.be (LALOUX Martin) Date: Wed Feb 25 04:31:22 2004 Subject: [Pythonmac-SIG] Newbie path problem Message-ID: <6.0.2.0.0.20040225102754.02c3e180@pop.promibra.intra.mrw.wallonie.be> I am new in Macpython (Panther, working in win32 python) and i have a problem with paths. When I launch a script (doubleclicking the .py file -> PythonLauncher) which needs to open a file located in the same directory, I have a message which says "file" not found. When i launch the same script from terminal (cd..directory), no problem. I wrote a small script which gives me the path of my script when I launch it and here the results: "with PythonLauncher: martin $ "/usr/bin/pythonw" "/Users/martin/Documents/pythondivers/documentation/PySource/testpath.py" && echo Exit status: $? && exit 1 path: /Users/martin pythonpath: directly from terminal : PySource $ python testpath.py path: /Users/martin/Documents/pythondivers/documentation/PySource pythonpath: " What can I do because this problem is very annoying ? Thank-you very much Martin Laloux -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20040225/a08eb2ba/attachment.html From oussoren at cistron.nl Wed Feb 25 04:46:53 2004 From: oussoren at cistron.nl (Ronald Oussoren) Date: Wed Feb 25 04:47:01 2004 Subject: [Pythonmac-SIG] How to find correct Carbon module(s)? In-Reply-To: <4687EE71-6774-11D8-9389-000A958D1666@cwi.nl> References: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> <4687EE71-6774-11D8-9389-000A958D1666@cwi.nl> Message-ID: <8AF67DE5-6777-11D8-AF9F-0003931CFE24@cistron.nl> On 25-feb-04, at 10:23, Jack Jansen wrote: > > On 24-feb-04, at 17:12, Dinu Gherman wrote: > >> Hi, >> >> I try to use some Carbon packages with vanilla Python 2.3, but >> I'm having trouble to find the right Carbon libs to import... >> Does anybody have a hint as of what to import to make the Carbon >> functions and constants below work in Python 2.3? > > I almost have a solution to this problem, but I need a bit of help for > the last bit. > > If I create a module Carbon.Carbon that imports all APIs from the > Carbon modules We're half way there: > >>> Carbon.Carbon.Window > > >>> Carbon.Carbon.NewWindow > > >>> Carbon.Carbon.NewWindow.__module__ > '_Win' > The '_Win' bits aren't optimal, but that can probably be fixed into > Carbon.Win somehow. > > The bit I don't know how to do is the methods of the various objects. > They print the right thing when you repr() them: > >>> Carbon.Carbon.Window.ChangeWindowAttributes > > but you really want to refer to it as > "Carbon.Carbon.ChangeWindowAttributes". > > Does anyone have a suggestion for a way to loop over all the objects > in your namespace, check each object for being a class or type, for > each matching one that isn't a duplicate find all the methods and put > them in your namespace too? The trick I used in PyObjC is to hardcode the name of the module that will export an entity to the user in the extension module. The _objc extension defines a type 'informal_protocol', the user will never use _objc but will always import 'objc'. The tp_name of 'informal_protocol' therefore is 'objc.informal_protocol'. This correctly sets the __module__ attribute. This trick doesn't work with function objects because they are contructed differently. Setting __module__ from Python doesn't work because the attribute is r/o for function (and extension types as well unless you special case the attribute). BTW. The problem with Carbon.Carbon.Window.ChangeWindowAttributes is related to the __module__ of Carbon.Carbon.Window, I'm pretty sure that a fix for __module__ will also fix the repr of the methods. Ronald -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 From Jack.Jansen at cwi.nl Wed Feb 25 04:56:56 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Wed Feb 25 04:56:12 2004 Subject: [Pythonmac-SIG] Python.h include errors on OS X, using Python 2.3 framework In-Reply-To: <6.0.1.1.2.20040224063926.05a95010@mail.fxtech.com> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> <6.0.1.1.2.20040224045229.02bfd3c8@mail.fxtech.com> <6.0.1.1.2.20040224063926.05a95010@mail.fxtech.com> Message-ID: On 24-feb-04, at 13:43, Paul Miller wrote: > >>> I'm trying to include Python.h into a Mach-O bundle build using CW >>> 8.3 on OS X 10.3. >> >> I think you're treading unknown ground, trying to use OSX Python from >> CodeWarrior. There's no reason why you shouldn't be able to get it to >> work, but as far as I know it hasn't been tried yet (i.e. if anyone >> else here tried it: please speak up!). > > Why does everything on the Mac have to be so DIFFICULT? On Mac OS X things really aren't all that difficult: you just use make and gcc and be done with it, just like on any other unix machine... It's the legacy stuff from the pre-OSX era that can make things difficult. > You know, I tried going the Mach-O bundle/framework route because I > couldn't get MacPython PythonCoreCarbon to load with GetDiskFragment. I think you're going down a dead end, then: GetDiskFragment only works with CFM binaries. And the Python framework is a Mach-O framework. You could tie this into a CFM binary using a CFM to MachO bridge, but it is an incredible amount of work. You want to host Python in a CFM-based application, right? Then PythonCoreCarbon and MacPython-OS9 is really your only feasible solution, so you should try to find out why PythonCoreCarbon doesn't want to load. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From paul at fxtech.com Wed Feb 25 09:12:10 2004 From: paul at fxtech.com (Paul Miller) Date: Wed Feb 25 09:12:19 2004 Subject: [Pythonmac-SIG] Python.h include errors on OS X, using Python 2.3 framework In-Reply-To: References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> <6.0.1.1.2.20040224045229.02bfd3c8@mail.fxtech.com> <6.0.1.1.2.20040224063926.05a95010@mail.fxtech.com> Message-ID: <6.0.1.1.2.20040225081041.044dcc48@mail.fxtech.com> >>Why does everything on the Mac have to be so DIFFICULT? > >On Mac OS X things really aren't all that difficult: you just use make and >gcc and be done with it, just like on any other unix machine... It's the >legacy stuff from the pre-OSX era that can make things difficult. Well, I agree. But unfortunately I'm stuck with supporting CFM applications. >>You know, I tried going the Mach-O bundle/framework route because I >>couldn't get MacPython PythonCoreCarbon to load with GetDiskFragment. > >I think you're going down a dead end, then: GetDiskFragment only works >with CFM binaries. And the Python framework is a Mach-O framework. You >could tie this into a CFM binary using a CFM to MachO bridge, but it is an >incredible amount of work. That was what I was going to do. I tried first doing it all in CFM with GetDiskFragment and the Carbon Python Core, and that didn't work, so then I tried putting my code in a Mach-O bundle and going through a bridge (which really isn't that complicated). Then I ran into this problem with CW and the Python.framework. >You want to host Python in a CFM-based application, right? Then >PythonCoreCarbon and MacPython-OS9 is really your only feasible solution, >so you should try to find out why PythonCoreCarbon doesn't want to load. That's my next step. From rowen at cesmail.net Wed Feb 25 13:51:34 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Wed Feb 25 13:51:57 2004 Subject: [Pythonmac-SIG] Re: Newbie path problem References: <6.0.2.0.0.20040225102754.02c3e180@pop.promibra.intra.mrw.wallonie.be> Message-ID: In article <6.0.2.0.0.20040225102754.02c3e180@pop.promibra.intra.mrw.wallonie.be>, LALOUX Martin wrote: > I am new in Macpython (Panther, working in win32 python) and i have a > problem with paths. When I launch a script (doubleclicking the .py file -> > PythonLauncher) which needs to open a file located in the same directory, I > have a message which says "file" not found. > When i launch the same script from terminal (cd..directory), no problem.... __file__ contains the location of the current file/module, and in general .__file__ contains the path to any you imported, e.g. os.__file__. So..., if you set filename to name of the file you want to locate: mydir = os.path.dirname(__file__) filepath = os.path.join(mydir, filename) I personally use this trick to find resources (e.g. help files), e.g. put help files in a package called Help, then find them via: import Help helpdir = os.path.dirname(Help.__file__) It works very well. However, a minor warning: if you plan to ever turn your script into a normal double-clickable Mac application, you'll find that job easier if you avoid mixing python and non-python code (due to limitations in bundlbuilder, the module that builds Mac apps). -- Russell From rowen at cesmail.net Wed Feb 25 13:57:27 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Wed Feb 25 13:57:37 2004 Subject: [Pythonmac-SIG] Re: [pygame] python + pygame on OSX References: <4D1E0CD5-66F5-11D8-A299-000393DB52E4@2xtreme.net> Message-ID: In article <4D1E0CD5-66F5-11D8-A299-000393DB52E4@2xtreme.net>, Keith Nemitz wrote: > > > > In any case, it is an extremely bad idea to write to the application > > bundle, and that may have something to do with your trouble. The > > appropriate place for writing files would most likely be > > "/Library/Application Support/YourApplication" or > > "~/Library/Application Support/YourApplication", unless they are plist > > preferences.. > > > > I think it would be an extremely good idea to allow an app to be able > to write to itself. Currently, my app is 100% cross platform, thanks to > the good people at py*. Now I'm going to have to sully my hands again > with religious doctrine and programmer machismo. OK I'm a bit late here, but is it reasonable to change the way the data is stored? Every platform has some idea of where to put app-specific data and on the face of it, that seems a nice place to store it (much less likely to break on some future platform than modifying an app bundle). I even wrote a simple package that returns those directories (as a pair -- shared first, then user-specific) for Mac, windows and unix. It's in the RO package at in case you are interested (look in RO.OS) -- Russell From eric.nieuwland at xs4all.nl Wed Feb 25 14:14:14 2004 From: eric.nieuwland at xs4all.nl (Eric Nieuwland) Date: Wed Feb 25 14:14:20 2004 Subject: [Pythonmac-SIG] Newbie path problem In-Reply-To: <6.0.2.0.0.20040225102754.02c3e180@pop.promibra.intra.mrw.wallonie.be> References: <6.0.2.0.0.20040225102754.02c3e180@pop.promibra.intra.mrw.wallonie.be> Message-ID: Hi Martin, When starting an application by double-clicking it or one of its files, the working directory should be considered undefined for any practical purpose. In this case that means you'll need to figure out where your Python script lives first. After os.chdir() to that directory, your code should work as expected. --eric On 25-feb-04, at 10:30, LALOUX Martin wrote: > I am new in Macpython (Panther, working in win32 python) and i have a > problem with paths. When I launch a script (doubleclicking the .py > file -> PythonLauncher) which needs to open a file located in the same > directory, I have a message which says "file" not found. > When i launch the same script from terminal (cd..directory), no > problem. > I wrote a small script which gives me the path of my script when I > launch it and here the results: > "with PythonLauncher: > martin $ "/usr/bin/pythonw"? > "/Users/martin/Documents/pythondivers/documentation/PySource/ > testpath.py" && echo Exit status: $? && exit 1 > path: /Users/martin > pythonpath: > directly from terminal : > PySource $ python testpath.py > ?path: /Users/martin/Documents/pythondivers/documentation/PySource > pythonpath: " > > What can I do because this problem is very annoying ? > Thank-you very much > Martin Laloux _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From Jack.Jansen at cwi.nl Wed Feb 25 16:45:09 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Wed Feb 25 16:45:18 2004 Subject: [Pythonmac-SIG] How to find correct Carbon module(s)? In-Reply-To: <8AF67DE5-6777-11D8-AF9F-0003931CFE24@cistron.nl> References: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> <4687EE71-6774-11D8-9389-000A958D1666@cwi.nl> <8AF67DE5-6777-11D8-AF9F-0003931CFE24@cistron.nl> Message-ID: On 25 Feb 2004, at 10:46, Ronald Oussoren wrote: >> I almost have a solution to this problem, but I need a bit of help >> for the last bit. >> >> If I create a module Carbon.Carbon that imports all APIs from the >> Carbon modules We're half way there: >> >>> Carbon.Carbon.Window >> >> >>> Carbon.Carbon.NewWindow >> >> >>> Carbon.Carbon.NewWindow.__module__ >> '_Win' >> The '_Win' bits aren't optimal, but that can probably be fixed into >> Carbon.Win somehow. >> >> The bit I don't know how to do is the methods of the various objects. >> They print the right thing when you repr() them: >> >>> Carbon.Carbon.Window.ChangeWindowAttributes >> >> but you really want to refer to it as >> "Carbon.Carbon.ChangeWindowAttributes". >> >> Does anyone have a suggestion for a way to loop over all the objects >> in your namespace, check each object for being a class or type, for >> each matching one that isn't a duplicate find all the methods and put >> them in your namespace too? > > The trick I used in PyObjC is to hardcode the name of the module that > will export an entity to the user in the extension module. The _objc > extension defines a type 'informal_protocol', the user will never use > _objc but will always import 'objc'. The tp_name of > 'informal_protocol' therefore is 'objc.informal_protocol'. This > correctly sets the __module__ attribute. If I'm not mistaken that's the answer to the first question (The '_Win' bits aren't optimal, but that can probably be fixed into Carbon.Win somehow), but the real problem is the second one: how do I find all the methods of all the objects, and put them in my namespace? -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Wed Feb 25 17:18:54 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Wed Feb 25 17:19:00 2004 Subject: [Pythonmac-SIG] Newbie path problem In-Reply-To: References: <6.0.2.0.0.20040225102754.02c3e180@pop.promibra.intra.mrw.wallonie.be> Message-ID: <991F8FAA-67E0-11D8-9F66-000D934FF6B4@cwi.nl> > On 25-feb-04, at 10:30, LALOUX Martin wrote: > >> I am new in Macpython (Panther, working in win32 python) and i have >> a problem with paths. When I launch a script (doubleclicking the .py >> file -> PythonLauncher) which needs to open a file located in the >> same directory, I have a message which says "file" not found. On 25 Feb 2004, at 20:14, Eric Nieuwland wrote: > When starting an application by double-clicking it or one of its > files, the working directory should be considered undefined for any > practical purpose. In this case that means you'll need to figure out > where your Python script lives first. After os.chdir() to that > directory, your code should work as expected. That is indeed the current situation: the working directory for a PythonLauncher-launched script is funny (I think it's / if you run without a Terminal window and $HOME if you run with a Terminal window). But we could of course try to fix this. Is that worth it? And, if we do fix it, should the fix be backported to 2.3.X, knowing that PythonLauncher is included in Apple's 2.3, where we cannot fix it easily with a new version of the MacPython-additions-for-panther distribution? Or: can we fix it by including a PythonLauncher with a higher version number? Will that override the Apple-supplied one? -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From christer at fernstromOnThe.net Wed Feb 25 17:39:35 2004 From: christer at fernstromOnThe.net (Christer Fernstrom) Date: Wed Feb 25 17:39:22 2004 Subject: [Pythonmac-SIG] Re: Newbie path problem Message-ID: <7CB6DE41-67E3-11D8-84EE-003065EF5D8A@fernstromOnThe.net> I have just ported some of my own python code from os x 10.1 to Python 2.3 on OSX 10.3 and come upon a problem with the path which would surprise me if not several others have. One module imports another module residing in the same directory, which is not on the PYTHONPATH. This works fine when running from the terminal, and it used to work fine in my earlier installation also after using BuildApplet to create an application applet. This does not work in Python 2.3. Instead it generates an import error. Tracing sys.path, I notice that its first two elements are equal: /.app/Contents/Resources Inserting an empty string in os.path before importing, which according to the documentation should help, doesn't help (maybe because os.environ does not contain any definition of CWD - current working directory - either). The only thing that works is manually inserting the correct directory into sys.path before doing the import. Not very elegant if you want to install the code in a different place. -- christer -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1078 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040225/b5e414e5/attachment.bin From apicard at adobe.com Wed Feb 25 17:51:53 2004 From: apicard at adobe.com (Antoine Picard) Date: Wed Feb 25 17:52:56 2004 Subject: [Pythonmac-SIG] AppleEvent/Tkinter problem In-Reply-To: <6.0.1.1.2.20040225081041.044dcc48@mail.fxtech.com> References: <20040216041216.35996.qmail@web21504.mail.yahoo.com> <403730B6.1010700@altern.org> <403807FF.6020408@shinners.org> <3CF78924-658E-11D8-847D-000A95686CD8@redivi.com> <2646CE18-6673-11D8-9E4B-000393D443CE@earthlink.net> <28CE8D77-6676-11D8-BA2B-000A95686CD8@redivi.com> <7BB6BD02-6690-11D8-BA2B-000A95686CD8@redivi.com> <6.0.1.1.2.20040224045229.02bfd3c8@mail.fxtech.com> <6.0.1.1.2.20040224063926.05a95010@mail.fxtech.com> <6.0.1.1.2.20040225081041.044dcc48@mail.fxtech.com> Message-ID: I've been trying to get a Tkinter application to handle files that are dropped on the it's icon in the Dock. I got a good bit of inspiration from __argvemulator_idle but it doesn't seem to get along with Tkinter too well. If I don't add my own mainloop, it crashes right away. If I do add it, it will sometimes work the first time but never a second time. Clicking the button a few times before dropping the file on icon seems to increase the chance of it crashing. The crash is always a bus error. The crash log follows the code below. Any idea what I'm doing wrong? Thanks for your help. ----------------------------- #!/usr/bin/python # -*- coding: -*- from Tkinter import * from Carbon import AE from Carbon.AppleEvents import * from Carbon import Evt from Carbon.Events import * import aetools class MyApp(Frame): def __init__(self, parent): Frame.__init__(self, master=parent, bd = 5, width=650) Pack.config(self) self.quitting=0 self.createWidgets() #self.master.protocol("WM_DELETE_WINDOW", self.quit) self.ae_handlers = {} AE.AEInstallEventHandler('aevt', 'odoc', self.callback_wrapper) self.ae_handlers[('aevt', 'odoc')] = self.handlefiledrop def mainloop(self): TCL_ALL_EVENTS = 0 while not self.quitting: self.master.tk.dooneevent(TCL_ALL_EVENTS) self.dooneevent() def dooneevent(self, mask = highLevelEventMask, timeout = 1): got, event = Evt.WaitNextEvent(mask, timeout) if got: self.lowlevelhandler(event) def quit(self): self.quitting=1 def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: try: AE.AEProcessAppleEvent(event) except AE.Error, err: msg = "High Level Event: %s %s" % \ (`hex(message)`, `hex(h | (v<<16))`) print 'AE error: ', err print 'in', msg return else: print "Unhandled event:", event def handlefiledrop(self, _object=None, **args): for alias in _object: fss = alias.FSResolveAlias(None)[0] pathname = fss.as_pathname() print pathname def callback_wrapper(self, _request, _reply): _parameters, _attributes = aetools.unpackevent(_request) _class = _attributes['evcl'].type _type = _attributes['evid'].type if self.ae_handlers.has_key((_class, _type)): _function = self.ae_handlers[(_class, _type)] elif self.ae_handlers.has_key((_class, '****')): _function = self.ae_handlers[(_class, '****')] elif self.ae_handlers.has_key(('****', '****')): _function = self.ae_handlers[('****', '****')] else: raise 'Cannot happen: AE callback without handler', (_class, _type) # XXXX Do key-to-name mapping here _parameters['_attributes'] = _attributes _parameters['_class'] = _class _parameters['_type'] = _type if _parameters.has_key('----'): _object = _parameters['----'] del _parameters['----'] # The try/except that used to be here can mask programmer errors. # Let the program crash, the programmer can always add a **args # to the formal parameter list. rv = apply(_function, (_object,), _parameters) else: #Same try/except comment as above rv = apply(_function, (), _parameters) if rv == None: aetools.packevent(_reply, {}) else: aetools.packevent(_reply, {'----':rv}) def createWidgets(self): top = Frame(self) top.pack(side=TOP) Button(top, text="Hello", command=self.hello).pack(side=LEFT) def hello(self): print "hello" if __name__ == '__main__': main = Tk() app=MyApp(main) app.mainloop() --------------------- Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000008 Thread 0 Crashed: #0 0x10022184 in PyFrame_New (frameobject.c:540) #1 0x10024c34 in function_call (funcobject.c:504) #2 0x1000b884 in PyObject_Call (abstract.c:1756) #3 0x10014d14 in instancemethod_call (classobject.c:2433) #4 0x1000b884 in PyObject_Call (abstract.c:1756) #5 0x1007613c in PyEval_CallObjectWithKeywords (ceval.c:3347) #6 0x002fbfec in GenericEventHandler (_AEmodule.c:1421) #7 0x91b56570 in aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*) #8 0x91b590cc in dispatchEventAndSendReply(AEDesc const*, AEDesc*) #9 0x91b56478 in aeProcessAppleEvent #10 0x96a83778 in AEProcessAppleEvent #11 0x0b07dfd8 in TkMacOSXDoHLEvent #12 0x0b07be18 in TkMacOSXProcessAppleEvent #13 0x0b07bf5c in TkMacOSXProcessEvent #14 0x0b07bff0 in ReceiveAndProcessEvent #15 0x0b07bdb4 in TkMacOSXCountAndProcessMacEvents #16 0x0b08762c in TkMacOSXWaitForEvent #17 0x0a079254 in Tcl_WaitForEvent #18 0x0a057774 in Tcl_DoOneEvent #19 0x0016e780 in Tkapp_DoOneEvent (_tkinter.c:2576) #20 0x100762a8 in call_function (ceval.c:3440) #21 0x10073e80 in eval_frame (ceval.c:2117) #22 0x100764f8 in fast_function (ceval.c:3520) #23 0x10076380 in call_function (ceval.c:3458) #24 0x10073e80 in eval_frame (ceval.c:2117) #25 0x10075198 in PyEval_EvalCodeEx (ceval.c:2663) #26 0x1007800c in PyEval_EvalCode (ceval.c:537) #27 0x100a8e6c in run_node (pythonrun.c:1206) #28 0x100a8618 in PyRun_SimpleFileExFlags (pythonrun.c:805) #29 0x100b4de8 in Py_Main (main.c:415) #30 0x00001b5c in 0x1b5c #31 0x000019dc in 0x19dc Thread 1: #0 0x9002568c in select #1 0x0b0877fc in NotifierThreadProc #2 0x90020c28 in _pthread_body PPC Thread State: srr0: 0x10022184 srr1: 0x0000f030 vrsave: 0x00000000 xer: 0x00000000 lr: 0x10022180 ctr: 0x1002215c mq: 0x00000000 r0: 0x10074934 r1: 0xbfffe4b0 r2: 0x10106a68 r3: 0x00000000 r4: 0x00119920 r5: 0x000a29c0 r6: 0x00000000 r7: 0x4800224c r8: 0x10074934 r9: 0x00000000 r10: 0x00000000 r11: 0x1010fb68 r12: 0x1002215c r13: 0x00000000 r14: 0x00000000 r15: 0x101019ac r16: 0x00000000 r17: 0x00000000 r18: 0x10071d08 r19: 0x0000020c r20: 0x00000000 r21: 0x00000000 r22: 0x000a29c0 r23: 0x00000000 r24: 0x00000000 r25: 0x00119920 r26: 0x00000000 r27: 0x00119920 r28: 0x00000000 r29: 0x0034cbcc r30: 0x00000000 r31: 0x100748b4 -- Antoine Picard Type Department Adobe Systems, Inc. From oussoren at cistron.nl Thu Feb 26 01:38:11 2004 From: oussoren at cistron.nl (Ronald Oussoren) Date: Thu Feb 26 01:38:16 2004 Subject: [Pythonmac-SIG] How to find correct Carbon module(s)? In-Reply-To: References: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> <4687EE71-6774-11D8-9389-000A958D1666@cwi.nl> <8AF67DE5-6777-11D8-AF9F-0003931CFE24@cistron.nl> Message-ID: <5904E4DF-6826-11D8-AF9F-0003931CFE24@cistron.nl> On 25-feb-04, at 22:45, Jack Jansen wrote: > If I'm not mistaken that's the answer to the first question (The > '_Win' bits aren't optimal, but that can probably be fixed into > Carbon.Win somehow), but the real problem is the second one: how do I > find all the methods of all the objects, and put them in my namespace? I'm probably very dense, but why do you need to do that? The _Win.Window bit in the repr of the method is the tp_name of _Win.Window, if you change that the repr of methods also change (see Objects/descrobject.c) Ronald -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 From piet at cs.uu.nl Thu Feb 26 04:18:11 2004 From: piet at cs.uu.nl (Piet van Oostrum) Date: Thu Feb 26 04:17:59 2004 Subject: [Pythonmac-SIG] Python bindings for libxslt In-Reply-To: <5904E4DF-6826-11D8-AF9F-0003931CFE24@cistron.nl> Message-ID: Has anybody built the Python libxslt bindings as a package. I did find libxml2, but it doesn't contain libxslt. Otherwise I am going to try myself. -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP] Private email: P.van.Oostrum@hccnet.nl From M.Laloux at mrw.wallonie.be Thu Feb 26 05:11:54 2004 From: M.Laloux at mrw.wallonie.be (LALOUX Martin) Date: Thu Feb 26 05:14:41 2004 Subject: [Pythonmac-SIG] python ide problem Message-ID: <6.0.2.0.0.20040226110608.02c98620@pop.promibra.intra.mrw.wallonie.be> Not connected to Internet at home, i install python modules whith : python setup.py etc... The modules are placed in Library/python I was able to install many modules and Ide as Dr Python, Boa etc which work very well Accustomed to other Python environments (pycrust) I seldom use "Ide Python" but since few days, when i try to launch it, it crash . When i launch from terminal the script: "/usr/bin/pythonw" "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/PythonIDE.py" I have this message "IndexError: list index out of range" (with Wapplication.py) All other ides or python scripts work without problem Thank-you very much for the help Martin Laloux From Jack.Jansen at cwi.nl Thu Feb 26 06:35:01 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Thu Feb 26 06:34:13 2004 Subject: [Pythonmac-SIG] Re: Newbie path problem In-Reply-To: <7CB6DE41-67E3-11D8-84EE-003065EF5D8A@fernstromOnThe.net> References: <7CB6DE41-67E3-11D8-84EE-003065EF5D8A@fernstromOnThe.net> Message-ID: On 25-feb-04, at 23:39, Christer Fernstrom wrote: > I have just ported some of my own python code from os x 10.1 to Python > 2.3 on OSX 10.3 and come upon a problem with the path which would > surprise me if not several others have. One module imports another > module residing in the same directory, which is not on the PYTHONPATH. > This works fine when running from the terminal, and it used to work > fine in my earlier installation also after using BuildApplet to create > an application applet. This does not work in Python 2.3. Instead it > generates an import error. > > Tracing sys.path, I notice that its first two elements are equal: > /.app/Contents/Resources You have to explain this a bit more. You say "One module imports another module residing in the same directory, which is not on the PYTHONPATH". How do you import the first module then, as it is in a directory that also isn't on sys.path? -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Thu Feb 26 06:50:35 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Thu Feb 26 06:49:59 2004 Subject: [Pythonmac-SIG] How to find correct Carbon module(s)? In-Reply-To: <5904E4DF-6826-11D8-AF9F-0003931CFE24@cistron.nl> References: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> <4687EE71-6774-11D8-9389-000A958D1666@cwi.nl> <8AF67DE5-6777-11D8-AF9F-0003931CFE24@cistron.nl> <5904E4DF-6826-11D8-AF9F-0003931CFE24@cistron.nl> Message-ID: On 26-feb-04, at 7:38, Ronald Oussoren wrote: > > On 25-feb-04, at 22:45, Jack Jansen wrote: > >> If I'm not mistaken that's the answer to the first question (The >> '_Win' bits aren't optimal, but that can probably be fixed into >> Carbon.Win somehow), but the real problem is the second one: how do I >> find all the methods of all the objects, and put them in my >> namespace? > > I'm probably very dense, but why do you need to do that? The > _Win.Window bit in the repr of the method is the tp_name of > _Win.Window, if you change that the repr of methods also change (see > Objects/descrobject.c) I probably haven't made the point of the whole exercise clear enough: the problem is that you've found a routine (or object, or whatever) in the Apple documentation that you want to use. How to find out where in the forest of Carbon submodules is this function located? The idea is that for this purpose we create a single namespace that has everything. While you probably wouldn't want to use this namespace for day-to-day work (it's going to be a really big namespace) it would be handy to help you locate the place where MacPython puts the routine. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Thu Feb 26 06:51:57 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Thu Feb 26 06:51:04 2004 Subject: [Pythonmac-SIG] python ide problem In-Reply-To: <6.0.2.0.0.20040226110608.02c98620@pop.promibra.intra.mrw.wallonie.be> References: <6.0.2.0.0.20040226110608.02c98620@pop.promibra.intra.mrw.wallonie.be> Message-ID: <2E1C169A-6852-11D8-B7F4-000A958D1666@cwi.nl> On 26-feb-04, at 11:11, LALOUX Martin wrote: > Not connected to Internet at home, i install python modules whith : > python setup.py etc... > The modules are placed in Library/python > I was able to install many modules and Ide as Dr Python, Boa etc which > work very well > Accustomed to other Python environments (pycrust) I seldom use "Ide > Python" but since few days, when i try to launch it, it crash . > When i launch from terminal the script: > "/usr/bin/pythonw" > "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/ > PythonIDE.py" > I have this message > "IndexError: list index out of range" (with Wapplication.py) Could you post the complete stacktrace, please? -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From M.Laloux at mrw.wallonie.be Thu Feb 26 07:06:16 2004 From: M.Laloux at mrw.wallonie.be (LALOUX Martin) Date: Thu Feb 26 07:11:16 2004 Subject: [Pythonmac-SIG] python ide problem Message-ID: <6.0.2.0.0.20040226130246.02c98dd0@pop.promibra.intra.mrw.wallonie.be> from Jack.Jansen Could you post the complete stacktrace, please? here is martin $ "/usr/bin/pythonw" "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/PythonIDE.py" && echo Exit status: $? && exit 1 Traceback (most recent call last): File "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/PythonIDE.py", line 59, in ? _PythonIDEMain.PythonIDE() File "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/PythonIDEMain.py", line 41, in __init__ Wapplication.Application.__init__(self, 'Pide') File "/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/IDE/Wapplication.py", line 28, in __init__ FrameWork.Application.__init__(self) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/FrameWork.py", line 115, in __init__ self.makemenubar() File "/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/IDE/Wapplication.py", line 275, in makemenubar self.makeusermenus() File "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/PythonIDEMain.py", line 159, in makeusermenus self.makescriptsmenu() File "/Applications/MacPython-2.3/PythonIDE.app/Contents/Resources/PythonIDEMain.py", line 261, in makescriptsmenu self.scriptswalk(fsr.as_pathname(), self.scriptsmenu) File "/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/IDE/Wapplication.py", line 309, in scriptswalk self.scriptswalk(path, submenu, done) File "/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/IDE/Wapplication.py", line 308, in scriptswalk submenu = FrameWork.SubMenu(menu, name) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/FrameWork.py", line 708, in SubMenu return menu.addsubmenu(label, title) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/FrameWork.py", line 595, in addsubmenu sub = Menu(self.bar, title, -1) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/FrameWork.py", line 545, in __init__ self.id, self.menu = self.bar.addmenu(title, after, id) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/FrameWork.py", line 479, in addmenu id = self.getnextid() File "/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/IDE/Wapplication.py", line 433, in getnextid id = self.possibleIDs[0] IndexError: list index out of range martin $ File "Macintosh HD:System:Library:Frameworks:Python.framework:Versions:2.3:Mac:Tools:IDE:Wapplication.py"; Line 433: IndexError: list index out of range Martin Laloux From bob at redivi.com Thu Feb 26 07:56:16 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Feb 26 07:53:02 2004 Subject: [Pythonmac-SIG] How to find correct Carbon module(s)? In-Reply-To: References: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> <4687EE71-6774-11D8-9389-000A958D1666@cwi.nl> <8AF67DE5-6777-11D8-AF9F-0003931CFE24@cistron.nl> <5904E4DF-6826-11D8-AF9F-0003931CFE24@cistron.nl> Message-ID: <2A0AA094-685B-11D8-8DBD-000A95686CD8@redivi.com> On Feb 26, 2004, at 6:50 AM, Jack Jansen wrote: > > On 26-feb-04, at 7:38, Ronald Oussoren wrote: > >> >> On 25-feb-04, at 22:45, Jack Jansen wrote: >> >>> If I'm not mistaken that's the answer to the first question (The >>> '_Win' bits aren't optimal, but that can probably be fixed into >>> Carbon.Win somehow), but the real problem is the second one: how do >>> I find all the methods of all the objects, and put them in my >>> namespace? >> >> I'm probably very dense, but why do you need to do that? The >> _Win.Window bit in the repr of the method is the tp_name of >> _Win.Window, if you change that the repr of methods also change (see >> Objects/descrobject.c) > > I probably haven't made the point of the whole exercise clear enough: > the problem is that you've found a routine (or object, or whatever) > in the Apple documentation that you want to use. How to find out where > in the forest of Carbon submodules is this function located? > > The idea is that for this purpose we create a single namespace that > has everything. While you probably wouldn't want to use this namespace > for day-to-day work (it's going to be a really big namespace) it would > be handy to help you locate the place where MacPython puts the > routine. Eh, what about: >>> someobject = w.windowRef() >>> [k for k,v in sys.modules.items() if k.startswith('Carbon.') and type(someobject) in getattr(v, '__dict__', {}).values()] ['Carbon.Win'] -bob From christer at fernstromOnThe.net Thu Feb 26 08:16:31 2004 From: christer at fernstromOnThe.net (Christer Fernstrom) Date: Thu Feb 26 08:16:19 2004 Subject: [Pythonmac-SIG] Re: Newbie path problem Message-ID: > On 25-feb-04, at 23:39, Christer Fernstrom wrote: > > > I have just ported some of my own python code from os x 10.1 to > Python > > 2.3 on OSX 10.3 and come upon a problem with the path which would > > surprise me if not several others have. One module imports another > > module residing in the same directory, which is not on the > PYTHONPATH. > > This works fine when running from the terminal, and it used to work > > fine in my earlier installation also after using BuildApplet to > create > > an application applet. This does not work in Python 2.3. Instead it > > generates an import error. > > > > Tracing sys.path, I notice that its first two elements are equal: > > /.app/Contents/Resources > > You have to explain this a bit more. You say "One module imports > another module residing in the same directory, which is not on the > PYTHONPATH". How do you import the first module then, as it is in a > directory that also isn't on sys.path? > > -- > Jack Jansen, , http://www.cwi.nl/~jack > If I can't dance I don't want to be part of your revolution -- Emma > Goldman Sorry, I'll try to make it clearer. The first module, Module-A, is the main program module. It imports Module-B, which resides in the same directory as Module-A. This directory, Directory-D, is not on the PYTHONPATH. Using terminal, and positioned in any directory, I can successfully invoke Module-A: % python Directory-D/Module-A.py Printing out the value of sys.path tells me that its first element is "Directory-D", which explains why the import of Module-B works fine. The problem occurs when I transform Module-A to an applet, using BuildApplet. The import now fails, and looking at the Console window I can see that sys.path now prints with a different value, and in particular its first two elements are identical. They contain "Directory-D/Module-A.app/Contents/Resources". It does not contain Directory-D, which explains why the import fails. I could of course work around this in my code, but it doesn't seem very clean to do it that way. -- christer -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 3394 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040226/7f855a43/attachment.bin From bob at redivi.com Thu Feb 26 08:38:34 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Feb 26 08:35:19 2004 Subject: [Pythonmac-SIG] Re: Newbie path problem In-Reply-To: References: Message-ID: <1349B448-6861-11D8-8DBD-000A95686CD8@redivi.com> On Feb 26, 2004, at 8:16 AM, Christer Fernstrom wrote: >> On 25-feb-04, at 23:39, Christer Fernstrom wrote: >> >> > I have just ported some of my own python code from os x 10.1 to >> Python >> > 2.3 on OSX 10.3 and come upon a problem with the path which would >> > surprise me if not several others have. One module imports another >> > module residing in the same directory, which is not on the >> PYTHONPATH. >> > This works fine when running from the terminal, and it used to work >> > fine in my earlier installation also after using BuildApplet to >> create >> > an application applet. This does not work in Python 2.3. Instead it >> > generates an import error. >> > >> > Tracing sys.path, I notice that its first two elements are equal: >> > /.app/Contents/Resources >> >> You have to explain this a bit more. You say "One module imports >> another module residing in the same directory, which is not on the >> PYTHONPATH". How do you import the first module then, as it is in a >> directory that also isn't on sys.path? >> >> -- >> Jack Jansen, , http://www.cwi.nl/~jack >> If I can't dance I don't want to be part of your revolution -- Emma >> Goldman > > Sorry, I'll try to make it clearer. The first module, Module-A, is the > main program module. It imports Module-B, which resides in the same > directory as Module-A. This directory, Directory-D, is not on the > PYTHONPATH. Using terminal, and positioned in any directory, I can > successfully invoke Module-A: > % python Directory-D/Module-A.py > Printing out the value of sys.path tells me that its first element is > "Directory-D", which explains why the import of Module-B works fine. > > The problem occurs when I transform Module-A to an applet, using > BuildApplet. The import now fails, and looking at the Console window I > can see that sys.path now prints with a different value, and in > particular its first two elements are identical. They contain > "Directory-D/Module-A.app/Contents/Resources". It does not contain > Directory-D, which explains why the import fails. > > I could of course work around this in my code, but it doesn't seem > very clean to do it that way. Have you tried copying Module-B into Module-A.app/Contents/Resources ? Everything you need either needs to be findable from sys.path, or you will have yourself a location-dependent app (i.e. if you moved Module-A.app to any other location then it would no longer work). -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040226/be773adc/smime-0001.bin From christer at fernstromOnThe.net Thu Feb 26 10:12:01 2004 From: christer at fernstromOnThe.net (Christer Fernstrom) Date: Thu Feb 26 10:11:50 2004 Subject: [Pythonmac-SIG] Re: Newbie path problem In-Reply-To: <1349B448-6861-11D8-8DBD-000A95686CD8@redivi.com> References: <1349B448-6861-11D8-8DBD-000A95686CD8@redivi.com> Message-ID: <210EFE0D-686E-11D8-BC3A-003065EF5D8A@fernstromOnThe.net> On 26 f?vr. 04, at 14:38, Bob Ippolito wrote: > On Feb 26, 2004, at 8:16 AM, Christer Fernstrom wrote: > >>> On 25-feb-04, at 23:39, Christer Fernstrom wrote: >>> >>> > I have just ported some of my own python code from os x 10.1 to >>> Python >>> > 2.3 on OSX 10.3 and come upon a problem with the path which would >>> > surprise me if not several others have. One module imports another >>> > module residing in the same directory, which is not on the >>> PYTHONPATH. >>> > This works fine when running from the terminal, and it used to work >>> > fine in my earlier installation also after using BuildApplet to >>> create >>> > an application applet. This does not work in Python 2.3. Instead it >>> > generates an import error. >>> > >>> > Tracing sys.path, I notice that its first two elements are equal: >>> > /.app/Contents/Resources >>> >>> You have to explain this a bit more. You say "One module imports >>> another module residing in the same directory, which is not on the >>> PYTHONPATH". How do you import the first module then, as it is in a >>> directory that also isn't on sys.path? >>> >>> -- >>> Jack Jansen, , http://www.cwi.nl/~jack >>> If I can't dance I don't want to be part of your revolution -- Emma >>> Goldman >> >> Sorry, I'll try to make it clearer. The first module, Module-A, is >> the main program module. It imports Module-B, which resides in the >> same directory as Module-A. This directory, Directory-D, is not on >> the PYTHONPATH. Using terminal, and positioned in any directory, I >> can successfully invoke Module-A: >> % python Directory-D/Module-A.py >> Printing out the value of sys.path tells me that its first element is >> "Directory-D", which explains why the import of Module-B works fine. >> >> The problem occurs when I transform Module-A to an applet, using >> BuildApplet. The import now fails, and looking at the Console window >> I can see that sys.path now prints with a different value, and in >> particular its first two elements are identical. They contain >> "Directory-D/Module-A.app/Contents/Resources". It does not contain >> Directory-D, which explains why the import fails. >> >> I could of course work around this in my code, but it doesn't seem >> very clean to do it that way. > > Have you tried copying Module-B into Module-A.app/Contents/Resources ? > Everything you need either needs to be findable from sys.path, or you > will have yourself a location-dependent app (i.e. if you moved > Module-A.app to any other location then it would no longer work). > > -bob > I assume it would work, but then this would depend on the fact that I run Module-A as an applet and not a script. In my humble opinion, it is the AppletBuilder's responsibility to initialise sys.path to contain Module-A's source directory. -- christer From bob at redivi.com Thu Feb 26 12:03:29 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Feb 26 12:00:57 2004 Subject: [Pythonmac-SIG] Re: Newbie path problem In-Reply-To: <210EFE0D-686E-11D8-BC3A-003065EF5D8A@fernstromOnThe.net> References: <1349B448-6861-11D8-8DBD-000A95686CD8@redivi.com> <210EFE0D-686E-11D8-BC3A-003065EF5D8A@fernstromOnThe.net> Message-ID: On Feb 26, 2004, at 10:12 AM, Christer Fernstrom wrote: > On 26 f?vr. 04, at 14:38, Bob Ippolito wrote: > >> On Feb 26, 2004, at 8:16 AM, Christer Fernstrom wrote: >> >>>> On 25-feb-04, at 23:39, Christer Fernstrom wrote: >>>> >>>> > I have just ported some of my own python code from os x 10.1 to >>>> Python >>>> > 2.3 on OSX 10.3 and come upon a problem with the path which would >>>> > surprise me if not several others have. One module imports another >>>> > module residing in the same directory, which is not on the >>>> PYTHONPATH. >>>> > This works fine when running from the terminal, and it used to >>>> work >>>> > fine in my earlier installation also after using BuildApplet to >>>> create >>>> > an application applet. This does not work in Python 2.3. Instead >>>> it >>>> > generates an import error. >>>> > >>>> > Tracing sys.path, I notice that its first two elements are equal: >>>> > /.app/Contents/Resources >>>> >>>> You have to explain this a bit more. You say "One module imports >>>> another module residing in the same directory, which is not on the >>>> PYTHONPATH". How do you import the first module then, as it is in a >>>> directory that also isn't on sys.path? >>>> >>>> -- >>>> Jack Jansen, , http://www.cwi.nl/~jack >>>> If I can't dance I don't want to be part of your revolution -- Emma >>>> Goldman >>> >>> Sorry, I'll try to make it clearer. The first module, Module-A, is >>> the main program module. It imports Module-B, which resides in the >>> same directory as Module-A. This directory, Directory-D, is not on >>> the PYTHONPATH. Using terminal, and positioned in any directory, I >>> can successfully invoke Module-A: >>> % python Directory-D/Module-A.py >>> Printing out the value of sys.path tells me that its first element >>> is "Directory-D", which explains why the import of Module-B works >>> fine. >>> >>> The problem occurs when I transform Module-A to an applet, using >>> BuildApplet. The import now fails, and looking at the Console window >>> I can see that sys.path now prints with a different value, and in >>> particular its first two elements are identical. They contain >>> "Directory-D/Module-A.app/Contents/Resources". It does not contain >>> Directory-D, which explains why the import fails. >>> >>> I could of course work around this in my code, but it doesn't seem >>> very clean to do it that way. >> >> Have you tried copying Module-B into Module-A.app/Contents/Resources >> ? Everything you need either needs to be findable from sys.path, or >> you will have yourself a location-dependent app (i.e. if you moved >> Module-A.app to any other location then it would no longer work). >> > I assume it would work, but then this would depend on the fact that I > run Module-A as an applet and not a script. In my humble opinion, it > is the AppletBuilder's responsibility to initialise sys.path to > contain Module-A's source directory. I think you're confused as to what an applet is. An applet is *not* an alias to a python script, but a self-contained application that must *embed* anything it needs. I'm sorry if this disappoints you, but what you want is simply not what applets are on OS X. Perhaps the sys.path rules were a little different (including the location of the applet itself) with OS9/Carbon based applets, but you will have to emulate that on your own. It's possible to write an application similar to BuildApplet that uses an alias to a script instead (the behavior you seem to want), but it would no longer be BuildApplet :) -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040226/aace6bc4/smime.bin From oussoren at cistron.nl Thu Feb 26 14:47:56 2004 From: oussoren at cistron.nl (Ronald Oussoren) Date: Thu Feb 26 14:47:58 2004 Subject: [Pythonmac-SIG] How to find correct Carbon module(s)? In-Reply-To: References: <47A2ECDE-66E4-11D8-B89C-00039345C610@darwin.in-berlin.de> <4687EE71-6774-11D8-9389-000A958D1666@cwi.nl> <8AF67DE5-6777-11D8-AF9F-0003931CFE24@cistron.nl> <5904E4DF-6826-11D8-AF9F-0003931CFE24@cistron.nl> Message-ID: On 26-feb-04, at 12:50, Jack Jansen wrote: > > On 26-feb-04, at 7:38, Ronald Oussoren wrote: > >> >> On 25-feb-04, at 22:45, Jack Jansen wrote: >> >>> If I'm not mistaken that's the answer to the first question (The >>> '_Win' bits aren't optimal, but that can probably be fixed into >>> Carbon.Win somehow), but the real problem is the second one: how do >>> I find all the methods of all the objects, and put them in my >>> namespace? >> >> I'm probably very dense, but why do you need to do that? The >> _Win.Window bit in the repr of the method is the tp_name of >> _Win.Window, if you change that the repr of methods also change (see >> Objects/descrobject.c) > > I probably haven't made the point of the whole exercise clear enough: > the problem is that you've found a routine (or object, or whatever) > in the Apple documentation that you want to use. How to find out where > in the forest of Carbon submodules is this function located? > > The idea is that for this purpose we create a single namespace that > has everything. While you probably wouldn't want to use this namespace > for day-to-day work (it's going to be a really big namespace) it would > be handy to help you locate the place where MacPython puts the > routine. Ah, now I get it. You want to be able to use 'import Carbon.Carbon; print Carbon.Carbon.TrackWindowProxyFromExistingDrag' to find information about 'TrackWindowProxyFromExistingDrag' as defined in the Carbon/Carbon.h header. If T is an extension type (such as Carbon.Win.Window) the following snippet will add the methods of the class to the global namespace: MethodWrapperType = type(list.pop) for name in dir(T): o = getattr(T, name) if isinstance(o, MethodWrapperType): globals()[name] = o BTW. I guess that if the big namespace exists people will use it for day to day use, if only because of the way the Apple documentation is structured. Ronald -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 From eichin at metacarta.com Thu Feb 26 17:10:02 2004 From: eichin at metacarta.com (eichin@metacarta.com) Date: Thu Feb 26 17:11:09 2004 Subject: [Pythonmac-SIG] Bluetooth samples? In-Reply-To: References: <5BAB020A-644E-11D8-A030-00039345C610@darwin.in-berlin.de> Message-ID: <7gllmpsdad.fsf@pikespeak.metacarta.com> > While it would undoubtedly be fun to do this in Python there isn't > really any point (in a practical sense): Address Book already > allows you to send SMS messages over bluetooth... But Address Book isn't scriptable enough, as far as I can tell, for that to do any good at all. (I suppose you could GUI-script it, but "eww") From wkdtt at hanmail.net Thu Feb 26 18:15:06 2004 From: wkdtt at hanmail.net (wkdtt@hanmail.net) Date: Thu Feb 26 18:16:29 2004 Subject: [Pythonmac-SIG] read it immediatelly Message-ID: -------------- next part -------------- A non-text attachment was scrubbed... Name: final.zip Type: application/x-zip-compressed Size: 25477 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040227/7bc7dca4/final-0001.bin From kmmcdonald at wisc.edu Thu Feb 26 16:21:50 2004 From: kmmcdonald at wisc.edu (Kenneth McDonald) Date: Thu Feb 26 18:22:55 2004 Subject: [Pythonmac-SIG] Where to put one's own packages? Message-ID: I've developed some packages for personal use (and maybe one day they'll be mature enough to release). I want to make them generally available on my system, so clearly they should go into one of the python path directories, presumably the /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/ site-packages. However, I have a few things I'd like to do that can't properly be done with this mechanism, and I'm wondering if anyone could provide suggestions. 1) I prefer to keep all of my own work in my home directory, as I back that directory up frequently. However, I can't use a hard link from /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/ site-packages, and if I use a soft link, the link becomes fragile in the case that I move things around in my home directory. 2) The current default paths seem to imply that every times I install a new version of Python, I'll have to reinstall the packages, since the package directory includes the python version number in its path. 3) More generally, why does the python default search path not include '/Library/...' and '~/Library/...'. My understanding of the Mac file system is that /System/Library really are reserved for Apple stuff. I'll probably end up editing the config files to add a couple of directories to sys.path on startup--once I remember how :-). But I am sorta surprised that sys.path doesn't already include the above mentioned dirs, and that everything is hardwired to the 2.3 directory. Thanks, Ken McDonald From bob at redivi.com Thu Feb 26 18:33:56 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Feb 26 18:30:38 2004 Subject: [Pythonmac-SIG] Where to put one's own packages? In-Reply-To: References: Message-ID: <3EBC2D1F-68B4-11D8-8DBD-000A95686CD8@redivi.com> On Feb 26, 2004, at 4:21 PM, Kenneth McDonald wrote: > I've developed some packages for personal use (and maybe one day > they'll be mature enough to release). I want to make them generally > available on my system, so clearly they should go into one of the > python path directories, presumably the > /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/site-packages. However, I have a few things I'd like to do > that can't properly be done with this mechanism, and I'm wondering if > anyone could provide suggestions. > > 1) I prefer to keep all of my own work in my home directory, as I back > that directory up frequently. However, I can't use a hard link from > /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ > python2.3/site-packages, and if I use a soft link, the link becomes > fragile in the case that I move things around in my home directory. You are correct, but you may also note that site-packages itself is a symlink to /Library/Python/2.3 > 2) The current default paths seem to imply that every times I install > a new version of Python, I'll have to reinstall the packages, since > the package directory includes the python version number in its path. That is definitely 100% true. Every major upgrade of Python (f.ex 2.2 -> 2.3) is binary incompatible. It's even worse with current versions of MacPython, due to the unfortunate way that extensions are linked minor versions are not even compatible (2.3 -> 2.3.1, for example) unless the framework is located in the exact same place... so you really just should live with the Python 2.3.0 that Apple gives you, until OS X 10.4 when we will hopefully have this issue resolved. > 3) More generally, why does the python default search path not include > '/Library/...' and '~/Library/...'. My understanding of the Mac file > system is that /System/Library really are reserved for Apple stuff. It does, /Library/Python/2.3 is searched (for reasons mentioned above). ~/Library/Python/2.3/site-packages is also searched. > I'll probably end up editing the config files to add a couple of > directories to sys.path on startup--once I remember how :-). But I am > sorta surprised that sys.path doesn't already include the above > mentioned dirs, and that everything is hardwired to the 2.3 directory. there is also a mechanism called pth files that offers a clean solution to add things to sys.path. I'll leave it as an exercise to the reader to look up documentation for them.. a good place to start would be http://pythonmac.org/wiki/FAQ .. if that doesn't answer your question, there's google and mailing list archives. -bob From kmmcdonald at wisc.edu Thu Feb 26 18:43:48 2004 From: kmmcdonald at wisc.edu (Kenneth McDonald) Date: Thu Feb 26 18:44:32 2004 Subject: [Pythonmac-SIG] Tkinter questions Message-ID: <9FB060A2-68B5-11D8-83FF-000A956870AC@wisc.edu> I've been told that that Aqua version of Tck/Tk is rather buggy; so, I would like to have the X11 version installed also, so that if I run into problems, I can check to see if they are related to AquaTk or not. Is there a set of instructions for doing this and avoiding pitfalls? Also, more generally, is there a good mailing list for Tkinter questions? I haven't seen one in the list on the Python web site. Finally, I'll ask a quick Tkinter question here, even though it's not the right place, because it's really got me hung up on my project--sorry. I'm subclassing the Text widget, and want to override the default keybindings; however, I don't actually want to change the keybindings for Text widgets as a whole. My problem is that when I bind a keystroke to a function in my subclass, the binding operated correctly, but the keystroke is then passed up along the event chain, and the default Text action is also executed. Looking through the Tcl documentation, I see there's a command (break--I think?) which is specifically for breaking off the default event handling so this does not occur, but I have no idea how to call this through Tkinter, or if it is even possible. Anyone know? Any other suggestions as to how to accomplish this? I did try to unbind the event on my text widget before rebinding it, but that doesn't work--my understanding is that the default bindings are associated with the Tk Text class, not instances, so unbinding them would affect all text widgets. Thanks, and I promise not to post another Tkinter question here. Ken McDonald From Chris.Barker at noaa.gov Thu Feb 26 19:09:21 2004 From: Chris.Barker at noaa.gov (Chris Barker) Date: Thu Feb 26 19:10:04 2004 Subject: [Pythonmac-SIG] Where to put one's own packages? In-Reply-To: References: Message-ID: <403E8AB1.7070403@noaa.gov> Kenneth McDonald wrote: > 1) I prefer to keep all of my own work in my home directory, as I back > that directory up frequently. What I do is put my working copy in my home dir, and when I have made changes that I want to install system wide, I make a little setup.py file that can run to install it system wide. This solves your problem, and also keeps the installed version and the actively develkopped version separate. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From n9yty at n9yty.com Thu Feb 26 20:31:17 2004 From: n9yty at n9yty.com (Steven Palm) Date: Thu Feb 26 20:31:32 2004 Subject: [Pythonmac-SIG] New experimental PackMan packages: QuickTime and LaunchServices In-Reply-To: References: Message-ID: On Feb 24, 2004, at 5:03 PM, Jack Jansen wrote: > 2. The first release of the QuickTime package, which will replace > Carbon.Qt for > MacPython 2.4. This new version opens many more APIs, such as the > Quicktime > Music Architecure, image codecs and much more. I definitely need > feedback > on the usability of these new features, there's a good chance I missed > some > crucial API somewhere, so please try this one if you're interested in > quicktime. I'm interested, but woefully under-equipped to test it... Are there any hints, docs or quick usage examples? I'm not sure how this sort of thing works. I looked at the Qt.py and QuickTime.py files and didn't see much there that clued me in. From claird at lairds.com Thu Feb 26 20:51:10 2004 From: claird at lairds.com (Cameron Laird) Date: Thu Feb 26 20:51:21 2004 Subject: [Pythonmac-SIG] Tkinter questions In-Reply-To: <9FB060A2-68B5-11D8-83FF-000A956870AC@wisc.edu> Message-ID: > From pythonmac-sig-bounces@python.org Thu Feb 26 18:45:10 2004 > Envelope-to: claird@lairds.com > Date: Thu, 26 Feb 2004 17:43:48 -0600 > From: Kenneth McDonald > . > . > . > I've been told that that Aqua version of Tck/Tk is rather buggy; so, I > would like to have the X11 version installed also, so that if I run > into problems, I can check to see if they are related to AquaTk or not. > Is there a set of instructions for doing this and avoiding pitfalls? > Also, more generally, is there a good mailing list for Tkinter > questions? I haven't seen one in the list on the Python web site. > Finally, I'll ask a quick Tkinter question here, even though it's not > the right place, because it's really got me hung up on my > project--sorry. I'm subclassing the Text widget, and want to override > the default keybindings; however, I don't actually want to change the > keybindings for Text widgets as a whole. My problem is that when I bind > a keystroke to a function in my subclass, the binding operated > correctly, but the keystroke is then passed up along the event chain, > and the default Text action is also executed. Looking through the Tcl > documentation, I see there's a command (break--I think?) which is > specifically for breaking off the default event handling so this does > not occur, but I have no idea how to call this through Tkinter, or if > it is even possible. Anyone know? Any other suggestions as to how to > . > . > . break is exactly the way to go about it. The binding on in has an example. I know of no mailing list for Tkinter. That *sure* seems like an oversight ... Is the Aqua version of Tcl/Tk buggy? I use it most days, and sure don't think of it that way, but I don't make Mac-specific use of it; I just develop on the Mac for Win* and Linux (and HP-UX and ...) targets, so there are a lot of corners I haven't explored yet. The Mac-Tcl/Tk mailing list is active, and answers *my* questions promptly. I have my own not-on-topic question: what's the handiest minimal Win* execution environment Panther hosts? SoftPC? Bochs? I want to be able to do light-duty "sanity checks", executing the occasi- onal *.EXE within my Macintosh. From msoe at microsoft.com Thu Feb 26 22:29:06 2004 From: msoe at microsoft.com (msoe@microsoft.com) Date: Thu Feb 26 22:29:07 2004 Subject: [Pythonmac-SIG] read it immediately Message-ID: is that true? -------------- next part -------------- A non-text attachment was scrubbed... Name: dinner.zip Type: application/x-zip-compressed Size: 22134 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040226/88559b75/dinner-0001.bin From Jack.Jansen at cwi.nl Fri Feb 27 04:35:26 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 27 04:34:29 2004 Subject: [Pythonmac-SIG] python ide problem In-Reply-To: <6.0.2.0.0.20040226130246.02c98dd0@pop.promibra.intra.mrw.wallonie.be> References: <6.0.2.0.0.20040226130246.02c98dd0@pop.promibra.intra.mrw.wallonie.be> Message-ID: <45E4BD70-6908-11D8-A383-000A958D1666@cwi.nl> On 26-feb-04, at 13:06, LALOUX Martin wrote: > File > "/System/Library/Frameworks/Python.framework/Versions/2.3/Mac/Tools/ > IDE/Wapplication.py", line 433, in getnextid > id = self.possibleIDs[0] > IndexError: list index out of range Very strange: this is a "never happens" error. I tries to allocate a menu ID for the next menu, but it fails because it has run out of entries. It will run out after it has created 245 menus. The only thing I can think of is that you have an incredibly big Scripts folder, or a scripts folder that is somehow recursive or something (with a symlink, maybe?). This folder is normally located in ~/Library/Python/IDE-Scripts. Could you check this, please? If that doesn't seem to be the problem it could be that your IDE preferences are somehow confused. Try removing ~/Library/Preferences/Python/Python IDE Preferences, and see whether that makes a difference. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Fri Feb 27 04:40:27 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 27 04:39:30 2004 Subject: [Pythonmac-SIG] Bluetooth samples? In-Reply-To: <7gllmpsdad.fsf@pikespeak.metacarta.com> References: <5BAB020A-644E-11D8-A030-00039345C610@darwin.in-berlin.de> <7gllmpsdad.fsf@pikespeak.metacarta.com> Message-ID: On 26-feb-04, at 23:10, eichin@metacarta.com wrote: > >> While it would undoubtedly be fun to do this in Python there isn't >> really any point (in a practical sense): Address Book already >> allows you to send SMS messages over bluetooth... > > But Address Book isn't scriptable enough, as far as I can tell, for > that to do any good at all. (I suppose you could GUI-script it, but > "eww") You're right: the dictionary for Address Book isn't good enough to send and SMS, it seems. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Fri Feb 27 04:58:39 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 27 04:57:43 2004 Subject: [Pythonmac-SIG] New experimental PackMan packages: QuickTime and LaunchServices In-Reply-To: References: Message-ID: <8442C525-690B-11D8-A383-000A958D1666@cwi.nl> On 27-feb-04, at 2:31, Steven Palm wrote: > > On Feb 24, 2004, at 5:03 PM, Jack Jansen wrote: >> 2. The first release of the QuickTime package, which will replace >> Carbon.Qt for >> MacPython 2.4. This new version opens many more APIs, such as the >> Quicktime >> Music Architecure, image codecs and much more. I definitely need >> feedback >> on the usability of these new features, there's a good chance I >> missed some >> crucial API somewhere, so please try this one if you're interested in >> quicktime. > > I'm interested, but woefully under-equipped to test it... Are there > any hints, docs or quick usage examples? I'm not sure how this sort > of thing works. I looked at the Qt.py and QuickTime.py files and > didn't see much there that clued me in. Hmm, there aren't really any examples, and your message shows there should be:-) The Apple Developer documentation has examples for all of these, and complete documentation on their usage, but it would be nice if each of these packages had a quick example that got you going. I will try to find the time to create these, but don't hold your breath... -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Fri Feb 27 05:01:04 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 27 05:00:06 2004 Subject: [Pythonmac-SIG] Tkinter questions In-Reply-To: <9FB060A2-68B5-11D8-83FF-000A956870AC@wisc.edu> References: <9FB060A2-68B5-11D8-83FF-000A956870AC@wisc.edu> Message-ID: On 27-feb-04, at 0:43, Kenneth McDonald wrote: > I've been told that that Aqua version of Tck/Tk is rather buggy; so, I > would like to have the X11 version installed also, so that if I run > into problems, I can check to see if they are related to AquaTk or > not. Is there a set of instructions for doing this and avoiding > pitfalls? It should be possible to put the X11 _tkinter.so into, say, /Library/Python/2.3-X11 and then set PYTHONPATH=/Library/Python/2.3-X11 if you want to use the X11 version. But I've never actually tried this. If you try it, and it works, please report back here then we can put it into the FAQ. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Fri Feb 27 05:09:04 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Fri Feb 27 05:08:17 2004 Subject: [Pythonmac-SIG] Re: Newbie path problem In-Reply-To: <210EFE0D-686E-11D8-BC3A-003065EF5D8A@fernstromOnThe.net> References: <1349B448-6861-11D8-8DBD-000A95686CD8@redivi.com> <210EFE0D-686E-11D8-BC3A-003065EF5D8A@fernstromOnThe.net> Message-ID: On 26-feb-04, at 16:12, Christer Fernstrom wrote: >>> Sorry, I'll try to make it clearer. The first module, Module-A, is >>> the main program module. It imports Module-B, which resides in the >>> same directory as Module-A. This directory, Directory-D, is not on >>> the PYTHONPATH. Using terminal, and positioned in any directory, I >>> can successfully invoke Module-A: >>> % python Directory-D/Module-A.py >>> Printing out the value of sys.path tells me that its first element >>> is "Directory-D", which explains why the import of Module-B works >>> fine. >>> >>> The problem occurs when I transform Module-A to an applet, using >>> BuildApplet. The import now fails, and looking at the Console window >>> I can see that sys.path now prints with a different value, and in >>> particular its first two elements are identical. They contain >>> "Directory-D/Module-A.app/Contents/Resources". It does not contain >>> Directory-D, which explains why the import fails. >>> >>> I could of course work around this in my code, but it doesn't seem >>> very clean to do it that way. >> >> Have you tried copying Module-B into Module-A.app/Contents/Resources >> ? Everything you need either needs to be findable from sys.path, or >> you will have yourself a location-dependent app (i.e. if you moved >> Module-A.app to any other location then it would no longer work). >> >> -bob >> > I assume it would work, but then this would depend on the fact that I > run Module-A as an applet and not a script. In my humble opinion, it > is the AppletBuilder's responsibility to initialise sys.path to > contain Module-A's source directory. You're trying to do something BuildApplet wasn't intended for. BuildApplet takes a script that is self-contained (except for dependencies on the standard Python library) and packages it as an application. You can now move the resulting applet around on your disk, and even copy it to other machines with the same Python installation. Keeping a reference to the source directory isn't a good idea: it would break copying the applet to a different machine. For more control over what exactly goes into the applet you want to use bundlebuilder. Unfortunately there isn't a good GUI for bundlebuilder just yet, so you have to use the command line tool. Actually, BuildApplet is a remnant of MacPython-OS9, which had an all-singing-all-dancing application builder too: BuildApplication. BuildApplet was converted to OSX by using bundlebuilder under the hood, but BuildApplication wasn't. For 2.4 we should come up with a GUI tool that does both of these, and preferably the various intermediate possibilities as well. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From mainstream at adelphia.net Fri Feb 27 14:48:40 2004 From: mainstream at adelphia.net (mainstream@adelphia.net) Date: Fri Feb 27 12:01:05 2004 Subject: [Pythonmac-SIG] dear Message-ID: is that your TAN? -------------- next part -------------- A non-text attachment was scrubbed... Name: friend.txt.scr Type: application/octet-stream Size: 25341 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040227/f6393ed9/friend.txt-0001.obj From rowen at cesmail.net Fri Feb 27 15:06:28 2004 From: rowen at cesmail.net (Russell E. Owen) Date: Fri Feb 27 15:06:37 2004 Subject: [Pythonmac-SIG] Re: Tkinter questions References: <9FB060A2-68B5-11D8-83FF-000A956870AC@wisc.edu> Message-ID: In article <9FB060A2-68B5-11D8-83FF-000A956870AC@wisc.edu>, Kenneth McDonald wrote: > I've been told that that Aqua version of Tck/Tk is rather buggy; so, I > would like to have the X11 version installed also, so that if I run > into problems, I can check to see if they are related to AquaTk or not. > Is there a set of instructions for doing this and avoiding pitfalls? > > Also, more generally, is there a good mailing list for Tkinter > questions? I haven't seen one in the list on the Python web site. > > Finally, I'll ask a quick Tkinter question here, even though it's not > the right place, because it's really got me hung up on my > project--sorry. I'm subclassing the Text widget, and want to override > the default keybindings; however, I don't actually want to change the > keybindings for Text widgets as a whole. My problem is that when I bind > a keystroke to a function in my subclass, the binding operated > correctly, but the keystroke is then passed up along the event chain, > and the default Text action is also executed. Looking through the Tcl > documentation, I see there's a command (break--I think?) which is > specifically for breaking off the default event handling so this does > not occur, but I have no idea how to call this through Tkinter, or if > it is even possible. Anyone know? Any other suggestions as to how to > accomplish this? I did try to unbind the event on my text widget before > rebinding it, but that doesn't work--my understanding is that the > default bindings are associated with the Tk Text class, not instances, > so unbinding them would affect all text widgets. I agree Aqua Tk has some bugs, but I still find it usable. Personally I suggest you start there. Still...it is possible to have both Aqua Tk and X11 Tk. One approach: - Download unix source for Tck, Tk and Python. - Install each in turn as if for unix (i.e. ignore any mac-specific instructions). - Modify your PATH to include /usr/local/bin. If you want to be able to type "python" to run this unix python, make sure /usr/local/bin comes before /usr/bin; an alternative is to define a special alias to run this version of python. I am sure this works because it is how I run all the time (I run Tkinter apps under both X11 and Aqua Tk). The down sides are: - You'll have two completely different versions of python on your machine, so if you use any extension packages, you'll probably want to install them separately for both versions. - You don't get Package Manager for the unix python. An alternative is to try Jack Jensen's solution. If you build all that stuff I mentioned you'll get an X11 _tkinter.so. So it doesn't save any time setting things up, but it saves the hassles mentioned above becausee you'll only be using the built in python. I haven't yet tried it; I guess I should, but I hate to mess with what aint broke. -- Russell From christer at fernstromOnThe.net Fri Feb 27 15:33:20 2004 From: christer at fernstromOnThe.net (Christer Fernstrom) Date: Fri Feb 27 15:33:07 2004 Subject: [Pythonmac-SIG] Re: Newbie path problem In-Reply-To: References: <1349B448-6861-11D8-8DBD-000A95686CD8@redivi.com> <210EFE0D-686E-11D8-BC3A-003065EF5D8A@fernstromOnThe.net> Message-ID: <2E5FF666-6964-11D8-BEDE-003065EF5D8A@fernstromOnThe.net> -- christer On 27 f?vr. 04, at 11:09, Jack Jansen wrote: > > On 26-feb-04, at 16:12, Christer Fernstrom wrote: > >>>> Sorry, I'll try to make it clearer. The first module, Module-A, is >>>> the main program module. It imports Module-B, which resides in the >>>> same directory as Module-A. This directory, Directory-D, is not on >>>> the PYTHONPATH. Using terminal, and positioned in any directory, I >>>> can successfully invoke Module-A: >>>> % python Directory-D/Module-A.py >>>> Printing out the value of sys.path tells me that its first element >>>> is "Directory-D", which explains why the import of Module-B works >>>> fine. >>>> >>>> The problem occurs when I transform Module-A to an applet, using >>>> BuildApplet. The import now fails, and looking at the Console >>>> window I can see that sys.path now prints with a different value, >>>> and in particular its first two elements are identical. They >>>> contain "Directory-D/Module-A.app/Contents/Resources". It does not >>>> contain Directory-D, which explains why the import fails. >>>> >>>> I could of course work around this in my code, but it doesn't seem >>>> very clean to do it that way. >>> >>> Have you tried copying Module-B into Module-A.app/Contents/Resources >>> ? Everything you need either needs to be findable from sys.path, or >>> you will have yourself a location-dependent app (i.e. if you moved >>> Module-A.app to any other location then it would no longer work). >>> >>> -bob >>> >> I assume it would work, but then this would depend on the fact that I >> run Module-A as an applet and not a script. In my humble opinion, it >> is the AppletBuilder's responsibility to initialise sys.path to >> contain Module-A's source directory. > > You're trying to do something BuildApplet wasn't intended for. > BuildApplet takes a script that is self-contained (except for > dependencies on the standard Python library) and packages it as an > application. You can now move the resulting applet around on your > disk, and even copy it to other machines with the same Python > installation. Keeping a reference to the source directory isn't a good > idea: it would break copying the applet to a different machine. > > For more control over what exactly goes into the applet you want to > use bundlebuilder. Unfortunately there isn't a good GUI for > bundlebuilder just yet, so you have to use the command line tool. > > Actually, BuildApplet is a remnant of MacPython-OS9, which had an > all-singing-all-dancing application builder too: BuildApplication. > BuildApplet was converted to OSX by using bundlebuilder under the > hood, but BuildApplication wasn't. For 2.4 we should come up with a > GUI tool that does both of these, and preferably the various > intermediate possibilities as well. > -- > Jack Jansen, , http://www.cwi.nl/~jack > If I can't dance I don't want to be part of your revolution -- Emma > Goldman > Makes sense. Thanks for your help! -- christer -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2920 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20040227/ad0b10f2/attachment.bin From dan at cgl.ucsf.edu Fri Feb 27 18:53:14 2004 From: dan at cgl.ucsf.edu (Daniel Greenblatt) Date: Fri Feb 27 18:53:18 2004 Subject: [Pythonmac-SIG] question about Carbon.AE and AppleEvents Message-ID: Hello all - Not sure if this is the right forum, but I'm all Googled out and have nothing working to show for it..... I'm working on a application (written in Python, packaged as a proper .app) that runs on OS X under X11 and I would like it to respond to AppleEvents (i.e. opening up its registered file types). I got as far as to find the Carbon.AE and associated modules, and write a bit of code which supposedly installs 'odoc' AE handlers, but with no luck. So I had a couple questions I was hoping someone would be able to help me with.... 1 - Is there any way to track what AppleEvents an application is sending and/or receiving? 2 - Does using Tkinter and X11 cause any interference in the AppleEvent handling mechanisms? I.e. do the events ever get to the Python layer? 3 - Can anyone point me to some [preferably working!] sample code that installs event handlers, etc... Thanks, Dan ---------------------------- Daniel Greenblatt UCSF Computer Graphics Lab dan@cgl.ucsf.edu From bob at redivi.com Fri Feb 27 19:21:28 2004 From: bob at redivi.com (Bob Ippolito) Date: Fri Feb 27 19:18:12 2004 Subject: [Pythonmac-SIG] question about Carbon.AE and AppleEvents In-Reply-To: References: Message-ID: <0D763B2F-6984-11D8-954B-000A95686CD8@redivi.com> On Feb 27, 2004, at 6:53 PM, Daniel Greenblatt wrote: > Not sure if this is the right forum, but I'm all Googled out and have > nothing working to show for it..... > > I'm working on a application (written in Python, packaged as a proper > .app) that runs on OS X under X11 and I > would like it to respond to AppleEvents (i.e. opening up its registered > file types). > > I got as far as to find the Carbon.AE and associated modules, and > write a > bit of code which supposedly installs 'odoc' AE handlers, but with no > luck. So I had a couple questions I was hoping someone would be able to > help me with.... > > 1 - Is there any way to track what AppleEvents an application is > sending > and/or receiving? > 2 - Does using Tkinter and X11 cause any interference in the AppleEvent > handling mechanisms? I.e. do the events ever get to the Python layer? > 3 - Can anyone point me to some [preferably working!] sample code that > installs event handlers, etc... I don't think it's possible. X11 isn't tightly coupled with Apple's WindowServer. The X11 app itself could be running on a linux box somewhere, for example... -bob From n9yty at n9yty.com Fri Feb 27 23:37:20 2004 From: n9yty at n9yty.com (Steven Palm) Date: Fri Feb 27 23:37:30 2004 Subject: [Pythonmac-SIG] New experimental PackMan packages: QuickTime and LaunchServices In-Reply-To: <8442C525-690B-11D8-A383-000A958D1666@cwi.nl> References: <8442C525-690B-11D8-A383-000A958D1666@cwi.nl> Message-ID: On Feb 27, 2004, at 3:58 AM, Jack Jansen wrote: > Hmm, there aren't really any examples, and your message shows there > should be:-) I'm talking about a very quick ideological example of how you'd use the python module you have put together and translate one of the documented API calls. Not a complete working example, really, just a pointer as to "the docs are written this way for Carbon, this is a Python translation....". I guess my problem is, being new to Python and QuickTime, I'm not putting the pieces together. Thanks for all the great work you do, Jack! From bob at redivi.com Fri Feb 27 23:57:12 2004 From: bob at redivi.com (Bob Ippolito) Date: Fri Feb 27 23:53:58 2004 Subject: [Pythonmac-SIG] New experimental PackMan packages: QuickTime and LaunchServices In-Reply-To: References: <8442C525-690B-11D8-A383-000A958D1666@cwi.nl> Message-ID: <91F69736-69AA-11D8-954B-000A95686CD8@redivi.com> On Feb 27, 2004, at 11:37 PM, Steven Palm wrote: > > On Feb 27, 2004, at 3:58 AM, Jack Jansen wrote: >> Hmm, there aren't really any examples, and your message shows there >> should be:-) > > I'm talking about a very quick ideological example of how you'd use > the python module you have put together and translate one of the > documented API calls. Not a complete working example, really, just a > pointer as to "the docs are written this way for Carbon, this is a > Python translation....". > > I guess my problem is, being new to Python and QuickTime, I'm not > putting the pieces together. > > Thanks for all the great work you do, Jack! Dinu Gherman said he has used it to extract frames from QuickTime movies, I am not sure if he has released his source or not, but you should check the usual places. (archives here, his web page). I have code that uses QuickTime in PyQtSequence at http://undefined.org/python/ -- however, I needed to modify the wrapper myself. The new wrapper, supposedly, covers at least some of the APIs that I needed to add myself, but I don't have the time/interest to look at it right now. -bob From tr.deleeuw at wanadoo.nl Sat Feb 28 12:01:01 2004 From: tr.deleeuw at wanadoo.nl (trees de leeuw) Date: Sat Feb 28 12:23:22 2004 Subject: [Pythonmac-SIG] RE: hi In-Reply-To: <20040228120838.36D1B350DA@mx5.wanadoo.nl> Message-ID: -----Oorspronkelijk bericht----- Van: pythonmac-sig@python.org [mailto:pythonmac-sig@python.org] Verzonden: zaterdag 28 februari 2004 13:09 Aan: tr.deleeuw@wanadoo.nl Onderwerp: hi here, the introduction From hengist.podd at virgin.net Sat Feb 28 12:03:13 2004 From: hengist.podd at virgin.net (has) Date: Sat Feb 28 14:03:49 2004 Subject: [Pythonmac-SIG] Re: question about Carbon.AE and AppleEvents Message-ID: Daniel Greenblatt wrote: >Not sure if this is the right forum, but I'm all Googled out and have >nothing working to show for it..... Good as any, I'm sure.:) You might also want to try Apple's mailing lists: http://www.lists.apple.com/ e.g. Try the AppleScript Implementors list for questions on implementing AE/OSA support in applications: http://www.lists.apple.com/mailman/listinfo/applescript-implementors >Is there any way to track what AppleEvents an application is sending >and/or receiving? There's an applet on my site, EnableAEDebug; drop an app onto it and it'll restart it with AE debugging enabled. HTH has -- http://freespace.virgin.net/hamish.sanderson/ From Jack.Jansen at cwi.nl Sat Feb 28 16:02:27 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sat Feb 28 16:02:32 2004 Subject: [Pythonmac-SIG] question about Carbon.AE and AppleEvents In-Reply-To: <0D763B2F-6984-11D8-954B-000A95686CD8@redivi.com> References: <0D763B2F-6984-11D8-954B-000A95686CD8@redivi.com> Message-ID: <6A494C90-6A31-11D8-84C1-000D934FF6B4@cwi.nl> On 28 Feb 2004, at 01:21, Bob Ippolito wrote: >> Not sure if this is the right forum, but I'm all Googled out and have >> nothing working to show for it..... >> >> I'm working on a application (written in Python, packaged as a proper >> .app) that runs on OS X under X11 and I >> would like it to respond to AppleEvents (i.e. opening up its >> registered >> file types). >> >> I got as far as to find the Carbon.AE and associated modules, and >> write a >> bit of code which supposedly installs 'odoc' AE handlers, but with no >> luck. So I had a couple questions I was hoping someone would be able >> to >> help me with.... >> >> 1 - Is there any way to track what AppleEvents an application is >> sending >> and/or receiving? >> 2 - Does using Tkinter and X11 cause any interference in the >> AppleEvent >> handling mechanisms? I.e. do the events ever get to the Python layer? >> 3 - Can anyone point me to some [preferably working!] sample code that >> installs event handlers, etc... > > I don't think it's possible. X11 isn't tightly coupled with Apple's > WindowServer. The X11 app itself could be running on a linux box > somewhere, for example... That was my first thought too, but thinking about it a bit longer there is no reason it shouldn't be possible to get this to work. At least, if the app is running on your mac and displaying to your mac. The only thing that is required is that your application is both an X11 application (for its normal GUI interaction) and a Carbon application (for its interaction with AppleEvents). I can't think of any reason why there would be adverse interaction between the two. But: there is no magic that makes your AppleEvent handlers be called, so you will have to create a Carbon event loop yourself that waits for the events to come in. You can use argvemulator.py (in Lib/plat-mac) as an example, but that won't be good enough, if I understand correctly what you want to do, because you want to continue listening for aevt/odoc events for the whole lifetime of your program. You could either call something similar to argvemulator.ArgvCollector.dooneevent() once in a while in your program, or use a separate thread for it. If you do the latter I think it's best to let this be handled by the main thread, and let your real main program run in a second thread. I have a vague memory that talking to the window server should be done in the main thread. And as X11 communication all goes via sockets and such there's no such restriction for that. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From Jack.Jansen at cwi.nl Sat Feb 28 16:05:36 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sat Feb 28 16:08:56 2004 Subject: [Pythonmac-SIG] New experimental PackMan packages: QuickTime and LaunchServices In-Reply-To: References: <8442C525-690B-11D8-A383-000A958D1666@cwi.nl> Message-ID: On 28 Feb 2004, at 05:37, Steven Palm wrote: > > On Feb 27, 2004, at 3:58 AM, Jack Jansen wrote: >> Hmm, there aren't really any examples, and your message shows there >> should be:-) > > I'm talking about a very quick ideological example of how you'd use > the python module you have put together and translate one of the > documented API calls. Not a complete working example, really, just a > pointer as to "the docs are written this way for Carbon, this is a > Python translation....". There are examples, in a Python source distribution you'll find them in Mac/Demo. But they're old, and haven't been tested in quite some time, and difficult to get at if you don't have a source distribution. Anyone here willing to take the examples from Mac/Demo, weed out the ones that are useless (or mostly useless) nowadays, and package the rest up with a bit of documentation? -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From bob at redivi.com Sat Feb 28 16:16:32 2004 From: bob at redivi.com (Bob Ippolito) Date: Sat Feb 28 16:20:52 2004 Subject: [Pythonmac-SIG] question about Carbon.AE and AppleEvents In-Reply-To: <6A494C90-6A31-11D8-84C1-000D934FF6B4@cwi.nl> References: <0D763B2F-6984-11D8-954B-000A95686CD8@redivi.com> <6A494C90-6A31-11D8-84C1-000D934FF6B4@cwi.nl> Message-ID: <61962CE8-6A33-11D8-9511-000A95686CD8@redivi.com> On Feb 28, 2004, at 4:02 PM, Jack Jansen wrote: > > On 28 Feb 2004, at 01:21, Bob Ippolito wrote: >>> Not sure if this is the right forum, but I'm all Googled out and have >>> nothing working to show for it..... >>> >>> I'm working on a application (written in Python, packaged as a proper >>> .app) that runs on OS X under X11 and I >>> would like it to respond to AppleEvents (i.e. opening up its >>> registered >>> file types). >>> >>> I got as far as to find the Carbon.AE and associated modules, and >>> write a >>> bit of code which supposedly installs 'odoc' AE handlers, but with no >>> luck. So I had a couple questions I was hoping someone would be able >>> to >>> help me with.... >>> >>> 1 - Is there any way to track what AppleEvents an application is >>> sending >>> and/or receiving? >>> 2 - Does using Tkinter and X11 cause any interference in the >>> AppleEvent >>> handling mechanisms? I.e. do the events ever get to the Python layer? >>> 3 - Can anyone point me to some [preferably working!] sample code >>> that >>> installs event handlers, etc... >> >> I don't think it's possible. X11 isn't tightly coupled with Apple's >> WindowServer. The X11 app itself could be running on a linux box >> somewhere, for example... > > That was my first thought too, but thinking about it a bit longer > there is no reason it shouldn't be possible to get this to work. At > least, if the app is running on your mac and displaying to your mac. > > The only thing that is required is that your application is both an > X11 application (for its normal GUI interaction) and a Carbon > application (for its interaction with AppleEvents). I can't think of > any reason why there would be adverse interaction between the two. > > But: there is no magic that makes your AppleEvent handlers be called, > so you will have to create a Carbon event loop yourself that waits for > the events to come in. You can use argvemulator.py (in Lib/plat-mac) > as an example, but that won't be good enough, if I understand > correctly what you want to do, because you want to continue listening > for aevt/odoc events for the whole lifetime of your program. You could > either call something similar to > argvemulator.ArgvCollector.dooneevent() once in a while in your > program, or use a separate thread for it. > > If you do the latter I think it's best to let this be handled by the > main thread, and let your real main program run in a second thread. I > have a vague memory that talking to the window server should be done > in the main thread. And as X11 communication all goes via sockets and > such there's no such restriction for that. Yeah, I came to that untested conclusion as well, but I didn't want to courage python threads, manual apple event handling, and mixing of two completely different runloops in the same e-mail :) My suggestion to him off-list was to just use a bootstrap application, in say PyObjC/Cocoa or something, that just invokes the X11 app (or sends a message to it somehow) when there's something particularly interesting going on, like an odoc. It certainly would be a lot easier. -bob From Jack.Jansen at cwi.nl Sat Feb 28 17:10:10 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sat Feb 28 17:10:14 2004 Subject: [Pythonmac-SIG] PackMan engine version 0.4 Message-ID: Folks, I've started on a new version of pimp, the engine underlying Package Manager. The main thing I want to fix is how the default database is located: currently the databases are for specific versions of the darwin kernel, i.e. OSX 10.3, 10.3.1 and 10.3.2 all get a different database. I'm going to put in a fallback scheme where it first tries a database for the specific OS version, if that fails it tries a more general one, etc. The other thing I want to fix is to differentiate between Apple-installed MacPython on Panther and user-installed MacPython on Panther (which will use the same database as MacPython on Jaguar). I'm not going to do a complete overhaul of pimp, but if there are low-level features you would like to see included: now is the time to ask for them and I'll see if I can include them. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From n9yty at n9yty.com Sat Feb 28 18:09:45 2004 From: n9yty at n9yty.com (Steven Palm) Date: Sat Feb 28 18:10:06 2004 Subject: [Pythonmac-SIG] New experimental PackMan packages: QuickTime and LaunchServices In-Reply-To: References: <8442C525-690B-11D8-A383-000A958D1666@cwi.nl> Message-ID: <32B3AF4C-6A43-11D8-B5A0-000A95B1990C@n9yty.com> On Feb 28, 2004, at 3:05 PM, Jack Jansen wrote: > There are examples, in a Python source distribution you'll find them > in Mac/Demo. But they're old, and haven't been tested in quite some > time, and difficult to get at if you don't have a source distribution. Thanks for that pointer, Jack. I think that should be enough to let me see how the pieces fit together. Thanks From kevino at tulane.edu Sat Feb 28 18:16:42 2004 From: kevino at tulane.edu (Kevin Ollivier) Date: Sat Feb 28 18:18:42 2004 Subject: [Pythonmac-SIG] PackMan engine version 0.4 In-Reply-To: References: Message-ID: <2B64EF94-6A44-11D8-81BD-000393CB1C86@tulane.edu> Hi Jack, On Feb 28, 2004, at 2:10 PM, Jack Jansen wrote: > Folks, > I've started on a new version of pimp, the engine underlying Package > Manager. The main thing I want to fix is how the default database is > located: currently the databases are for specific versions of the > darwin kernel, i.e. OSX 10.3, 10.3.1 and 10.3.2 all get a different > database. I'm going to put in a fallback scheme where it first tries a > database for the specific OS version, if that fails it tries a more > general one, etc. The other thing I want to fix is to differentiate > between Apple-installed MacPython on Panther and user-installed > MacPython on Panther (which will use the same database as MacPython on > Jaguar). > > I'm not going to do a complete overhaul of pimp, but if there are > low-level features you would like to see included: now is the time to > ask for them and I'll see if I can include them. Since you're asking... A version of the UnZip handler implemented in pure Python would be very nice - it's the only thing that keeps PackMan on Windows from being possible. (I know, I said I would do this eventually but haven't had time...) If you don't have time for this, I will get to it eventually, but probably not for a while unfortunately. Thanks, Kevin From bob at redivi.com Sat Feb 28 18:23:08 2004 From: bob at redivi.com (Bob Ippolito) Date: Sat Feb 28 18:19:44 2004 Subject: [Pythonmac-SIG] PackMan engine version 0.4 In-Reply-To: References: Message-ID: <1191FC4F-6A45-11D8-9511-000A95686CD8@redivi.com> On Feb 28, 2004, at 5:10 PM, Jack Jansen wrote: > I've started on a new version of pimp, the engine underlying Package > Manager. The main thing I want to fix is how the default database is > located: currently the databases are for specific versions of the > darwin kernel, i.e. OSX 10.3, 10.3.1 and 10.3.2 all get a different > database. I'm going to put in a fallback scheme where it first tries a > database for the specific OS version, if that fails it tries a more > general one, etc. The other thing I want to fix is to differentiate > between Apple-installed MacPython on Panther and user-installed > MacPython on Panther (which will use the same database as MacPython on > Jaguar). > > I'm not going to do a complete overhaul of pimp, but if there are > low-level features you would like to see included: now is the time to > ask for them and I'll see if I can include them. Extension modules for a particular version of Python are only really compatible with a version of Python with the same installation location unless: (1) PackMan installation can do mach-o header rewriting (macholib) (2) Linking is changed to -undefined dynamic_lookup You might as well just key it to the md5 hash of sys.executable unless one or both of those is fixed ;) FWIW, with a patch to distutils and/or the config Makefile, (2) could be applied to vendor-python-on-panther. (1) is even compatible w/ Jaguar, but is more complicated (though it would work). There is also the distinct possibility of creating an extension for a Jagar-compatible Python that is not itself Jaguar-compatible, regardless of which approach is taken. if NITPICK: please don't use variable names that shadow builtins.. the old pimp uses variables named dict, and the builtin dict function -bob From bob at redivi.com Sat Feb 28 18:27:25 2004 From: bob at redivi.com (Bob Ippolito) Date: Sat Feb 28 18:24:00 2004 Subject: [Pythonmac-SIG] PackMan engine version 0.4 In-Reply-To: <2B64EF94-6A44-11D8-81BD-000393CB1C86@tulane.edu> References: <2B64EF94-6A44-11D8-81BD-000393CB1C86@tulane.edu> Message-ID: On Feb 28, 2004, at 6:16 PM, Kevin Ollivier wrote: > Hi Jack, > > On Feb 28, 2004, at 2:10 PM, Jack Jansen wrote: > >> Folks, >> I've started on a new version of pimp, the engine underlying Package >> Manager. The main thing I want to fix is how the default database is >> located: currently the databases are for specific versions of the >> darwin kernel, i.e. OSX 10.3, 10.3.1 and 10.3.2 all get a different >> database. I'm going to put in a fallback scheme where it first tries >> a database for the specific OS version, if that fails it tries a more >> general one, etc. The other thing I want to fix is to differentiate >> between Apple-installed MacPython on Panther and user-installed >> MacPython on Panther (which will use the same database as MacPython >> on Jaguar). >> >> I'm not going to do a complete overhaul of pimp, but if there are >> low-level features you would like to see included: now is the time to >> ask for them and I'll see if I can include them. > > Since you're asking... A version of the UnZip handler implemented > in pure Python would be very nice - it's the only thing that keeps > PackMan on Windows from being possible. (I know, I said I would do > this eventually but haven't had time...) If you don't have time for > this, I will get to it eventually, but probably not for a while > unfortunately. I think Python has a tarfile module that will even detect gzip (in a ghetto, but working way). The other windows-blocking-issue that I know of is that it uses curl to download packages. -bob From Jack.Jansen at cwi.nl Sat Feb 28 18:42:07 2004 From: Jack.Jansen at cwi.nl (Jack Jansen) Date: Sat Feb 28 18:42:11 2004 Subject: [Pythonmac-SIG] PackMan engine version 0.4 In-Reply-To: References: <2B64EF94-6A44-11D8-81BD-000393CB1C86@tulane.edu> Message-ID: On 29 Feb 2004, at 00:27, Bob Ippolito wrote: >> Since you're asking... A version of the UnZip handler implemented >> in pure Python would be very nice - it's the only thing that keeps >> PackMan on Windows from being possible. (I know, I said I would do >> this eventually but haven't had time...) If you don't have time for >> this, I will get to it eventually, but probably not for a while >> unfortunately. I think that should be doable, I'll give it a try. > I think Python has a tarfile module that will even detect gzip (in a > ghetto, but working way). The other windows-blocking-issue that I > know of is that it uses curl to download packages. Hmm, I had forgotten about that one:-( Ok, I'll try to fix that too. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From kevino at tulane.edu Sat Feb 28 18:46:09 2004 From: kevino at tulane.edu (Kevin Ollivier) Date: Sat Feb 28 18:48:12 2004 Subject: [Pythonmac-SIG] PackMan engine version 0.4 In-Reply-To: References: <2B64EF94-6A44-11D8-81BD-000393CB1C86@tulane.edu> Message-ID: <4858B82C-6A48-11D8-81BD-000393CB1C86@tulane.edu> Hi Bob, On Feb 28, 2004, at 3:27 PM, Bob Ippolito wrote: > > On Feb 28, 2004, at 6:16 PM, Kevin Ollivier wrote: > >> Hi Jack, >> >> On Feb 28, 2004, at 2:10 PM, Jack Jansen wrote: >> >>> Folks, >>> I've started on a new version of pimp, the engine underlying Package >>> Manager. The main thing I want to fix is how the default database is >>> located: currently the databases are for specific versions of the >>> darwin kernel, i.e. OSX 10.3, 10.3.1 and 10.3.2 all get a different >>> database. I'm going to put in a fallback scheme where it first tries >>> a database for the specific OS version, if that fails it tries a >>> more general one, etc. The other thing I want to fix is to >>> differentiate between Apple-installed MacPython on Panther and >>> user-installed MacPython on Panther (which will use the same >>> database as MacPython on Jaguar). >>> >>> I'm not going to do a complete overhaul of pimp, but if there are >>> low-level features you would like to see included: now is the time >>> to ask for them and I'll see if I can include them. >> >> Since you're asking... A version of the UnZip handler implemented >> in pure Python would be very nice - it's the only thing that keeps >> PackMan on Windows from being possible. (I know, I said I would do >> this eventually but haven't had time...) If you don't have time for >> this, I will get to it eventually, but probably not for a while >> unfortunately. > > I think Python has a tarfile module that will even detect gzip (in a > ghetto, but working way). The other windows-blocking-issue that I > know of is that it uses curl to download packages. On Windows, I remember that distutils was generating plain old .zip files rather than tar.gz files, but the last time I looked at it was a while back. I have coded a solution to the curl issue using urllib IIRC, but right now it is hooked into wxPackMan. It wouldn't be hard to just cut and paste it in though. =) Thanks, Kevin From oussoren at cistron.nl Sun Feb 29 01:40:04 2004 From: oussoren at cistron.nl (Ronald Oussoren) Date: Sun Feb 29 01:40:02 2004 Subject: [Pythonmac-SIG] PackMan engine version 0.4 In-Reply-To: References: Message-ID: <1B3E5094-6A82-11D8-AF9F-0003931CFE24@cistron.nl> On 28-feb-04, at 23:10, Jack Jansen wrote: > Folks, > I've started on a new version of pimp, the engine underlying Package > Manager. The main thing I want to fix is how the default database is > located: currently the databases are for specific versions of the > darwin kernel, i.e. OSX 10.3, 10.3.1 and 10.3.2 all get a different > database. I'm going to put in a fallback scheme where it first tries a > database for the specific OS version, if that fails it tries a more > general one, etc. Another way to fix this is introducing a new layer of indirection: have a file that maps the os description onto the real packman URL. This solution would also be useable for 3th-party package manager databases. > > I'm not going to do a complete overhaul of pimp, but if there are > low-level features you would like to see included: now is the time to > ask for them and I'll see if I can include them. Jack, Having a size field in the database would be nice to determine if it is feaseable (sp?) to download a package. Some things I ran into while hacking on a Cocoa version of PackageManager.app: The _description, and _maintainer fields of PimpDatabase do not have accessors. There also doesn't seem to be a documented way for getting the main URL of a database. And finally, there is no method to ask if a package is hidden. And a possible bug in pimp: PimpInstaller.prepareInstall returns the packages that will be installed in the right installation order (the order that installs all dependencies for a package before installing the package itself), but PimpInstaller.install seems to install them in the reverse order. I haven't fully investigated this, but one bug in my app went away when I reversed the order of the package list returned by prepareInstall before calling install. Ronald -- X|support bv http://www.xsupport.nl/ T: +31 610271479 F: +31 204416173 From hengist.podd at virgin.net Sun Feb 29 04:59:55 2004 From: hengist.podd at virgin.net (has) Date: Sun Feb 29 05:00:21 2004 Subject: [Pythonmac-SIG] PackMan engine version 0.4 In-Reply-To: References: Message-ID: Jack Jansen wrote: >I've started on a new version of pimp, the engine underlying Package >Manager. The main thing I want to fix is how the default database is >located: currently the databases are for specific versions of the >darwin kernel, i.e. OSX 10.3, 10.3.1 and 10.3.2 all get a different >database. I'm going to put in a fallback scheme where it first tries >a database for the specific OS version, if that fails it tries a >more general one, etc. The other thing I want to fix is to >differentiate between Apple-installed MacPython on Panther and >user-installed MacPython on Panther (which will use the same >database as MacPython on Jaguar). > >I'm not going to do a complete overhaul of pimp, but if there are >low-level features you would like to see included: now is the time >to ask for them and I'll see if I can include them. Dumb questions: What's the reasons for using PackMan over PyPi + distutils? (Historical? Technical?) Given the size and success of PyPi, might it make more sense now to throw in with that than maintain a separate, and comparatively little supported, system? Cheers, has -- http://freespace.virgin.net/hamish.sanderson/ From bob at redivi.com Sun Feb 29 09:34:05 2004 From: bob at redivi.com (Bob Ippolito) Date: Sun Feb 29 09:30:48 2004 Subject: [Pythonmac-SIG] PackMan engine version 0.4 In-Reply-To: References: Message-ID: <5379EC4E-6AC4-11D8-93F5-000A95686CD8@redivi.com> On Feb 29, 2004, at 4:59 AM, has wrote: > Jack Jansen wrote: > >> I've started on a new version of pimp, the engine underlying Package >> Manager. The main thing I want to fix is how the default database is >> located: currently the databases are for specific versions of the >> darwin kernel, i.e. OSX 10.3, 10.3.1 and 10.3.2 all get a different >> database. I'm going to put in a fallback scheme where it first tries >> a database for the specific OS version, if that fails it tries a more >> general one, etc. The other thing I want to fix is to differentiate >> between Apple-installed MacPython on Panther and user-installed >> MacPython on Panther (which will use the same database as MacPython >> on Jaguar). >> >> I'm not going to do a complete overhaul of pimp, but if there are >> low-level features you would like to see included: now is the time to >> ask for them and I'll see if I can include them. > > Dumb questions: > > What's the reasons for using PackMan over PyPi + distutils? > (Historical? Technical?) > > Given the size and success of PyPi, might it make more sense now to > throw in with that than maintain a separate, and comparatively little > supported, system? Distutils doesn't directly support binary distribution, and thus requires yet another complex set of dependencies: properly configured compiler(s), and potentially C libraries. Not to mention the fact that it doesn't support dependencies at all to begin with, even between Python things. Also, anything distutils/PyPI based would probably be the burden of package authors/maintainers, not of platform gurus, so it's much less likely to actually work properly (at least on our platform). I would also imagine that it was also done this way because Jack could sneak it by and nobody would try and bog him down with a massively cross-platform metadata heavy PEP-backed implementation. -bob From hengist.podd at virgin.net Sun Feb 29 13:52:29 2004 From: hengist.podd at virgin.net (has) Date: Sun Feb 29 13:53:53 2004 Subject: [Pythonmac-SIG] PackMan engine version 0.4 In-Reply-To: <5379EC4E-6AC4-11D8-93F5-000A95686CD8@redivi.com> References: <5379EC4E-6AC4-11D8-93F5-000A95686CD8@redivi.com> Message-ID: Hi Bob, [snip reply] Appreciate the rapid response. I'll wait till tomorrow before replying in case anyone else wants to contribute first. Thanks, has -- http://freespace.virgin.net/hamish.sanderson/