From RJLacey@aol.com Fri Sep 4 05:24:18 1998 From: RJLacey@aol.com (RJLacey@aol.com) Date: Fri, 4 Sep 1998 00:24:18 EDT Subject: [Pythonmac-SIG] MacPython Shell & img doc Message-ID: <85d8127e.35ef6b72@aol.com> At work the Python shell on a Sun uses the emacs line editing controls, and the NT binary I downloaded uses the arrow keys, but the Mac binary (FAT to get NumPy) doesn't supply any line editing. Is there any way to make the arrow keys work? This isn't Mac specific, it also occurs on NT (I haven't tried it on the Sun), but when I import a module, and I have to fix it - import and compilation work, but the logic is bad - importing it again does not work. The shell appears to be looking at the old compiled module and the new code. It certainly generates a peculiar stack trace. Do I have to delete the old x.pyc file, or is there some command that will "unimport" a module? How can I get documentation for the img extension? The instructions that were included in the MacPython download didn't make any sense to me at all - I'm a user not a guru. Specifically, the files referred to were not included in the distribution. Thank you. From tschinke@swissonline.ch Sat Sep 5 21:41:21 1998 From: tschinke@swissonline.ch (Vincenzo Tschinke) Date: Sat, 5 Sep 1998 22:41:21 +0200 Subject: [Pythonmac-SIG] Tkinter : non-resizable, but movable windows Message-ID: I would like to display modal dialogs that 1) can be freely moved around the screen 2) can't be resized, neither by a) the "Zoom box", nor b) by the "Size box" In other words, I would like to have a "movableDBoxProc" type of window, as "Inside Macintosh" would put it. This works only in part: from Tkinter import * class Base_Window(Toplevel): """ modal dialog window """ def __init__(self, parent, title=''): # Toplevel stuff Toplevel.__init__(self, parent) # "transient" makes the window non-movable! #self.transient(parent) # OK : removes the "Size box"! self.resizable(0, 0) # bind to the close box (disactivate, only as an example) self.protocol("WM_DELETE_WINDOW", self.get_out) def get_out(self, event=None): " Window never closes! " pass The problem with this class is that the "Zoom box" is still visible and does resize the window to full screen if clicked. Is there a way in Mac-Tkinter to make the "Zoom box" disappear, while keeping the window movable? Alternatively, it should be possible to disactivate the "Zoom box" by a suitable "self.protocol" method, like above for the close box. Does anybody know the "protocol" for the "Zoom box"? I can't find a complete list for those protocols; the usual sources (web pages, Osterhout book) only mention WM_DELETE_WINDOW, WM_SAVE_YOURSELF, and WM_TAKE_FOCUS. Where to find a complete list? Thanks, Vincenzo ======================= Vincenzo Tschinke Kernmattstr. 24 CH-4102 Binningen Switzerland +4161 422 1991 (T+F) tschinke@swissonline.ch ======================= From tschinke@swissonline.ch Sat Sep 5 21:41:21 1998 From: tschinke@swissonline.ch (Vincenzo Tschinke) Date: Sat, 5 Sep 1998 22:41:21 +0200 Subject: [Pythonmac-SIG] Launch App in background Message-ID: I would like to use an helper application that processes some files for my python script. On the Mac I tried this hack: import findertools import sys def launch_app(app): # invoke finder findertools.launch(app) # hack to refocuse on Python! findertools.launch(sys.executable) This has the disadvantage that Python goes in the background and the desktop appears for a certain time (a few seconds in my case) with whatever messy bunch of windows and icons is at hand. Changing the "finder flags" of the application itself (background only, etc.) does not have an effect. Does anybody have a better method? Would at least be possible to show a box telling "Work in progress" or something while the application is running? Thanks Vincenzo ======================= Vincenzo Tschinke Kernmattstr. 24 CH-4102 Binningen Switzerland +4161 422 1991 (T+F) tschinke@swissonline.ch ======================= From billpy@mousa.demon.co.uk Sun Sep 6 01:30:41 1998 From: billpy@mousa.demon.co.uk (Bill Bedford) Date: Sun, 6 Sep 1998 01:30:41 +0100 Subject: [Pythonmac-SIG] Launch App in background In-Reply-To: Message-ID: <251993630529172339272@mousa.demon.co.uk> At 10:41 pm +0200 05/09/98, Vincenzo Tschinke wrote: ~I would like to use an helper application that processes some files for my ~python script. On the Mac I tried this hack: ~ ~import findertools ~import sys ~ ~def launch_app(app): ~ # invoke finder ~ findertools.launch(app) ~ # hack to refocuse on Python! ~ findertools.launch(sys.executable) ~ ~This has the disadvantage that Python goes in the background and the ~desktop appears for a certain time (a few seconds in my case) with ~whatever messy bunch of windows and icons is at hand. Changing the "finder ~flags" of the application itself (background only, etc.) does not have an ~effect. ~ ~Does anybody have a better method? Would at least be possible to show a ~box telling "Work in progress" or something while the application is ~running? Your helper application should come to front, not the finder. The way to to do what you want is use a second method which is called after the helper. def launch_pyth(): # hack to refocuse on Python! findertools.launch(PYTHON) PYTHON is the path to the python application not sys.path Bill Bedford Owner Brit_Rail-L list for the history of railways in Britain Subscribe at autoshare@mousa.demon.co.uk From Jack.Jansen@cwi.nl Sun Sep 6 22:20:17 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Sun, 06 Sep 1998 23:20:17 +0200 Subject: [Pythonmac-SIG] Launch App in background In-Reply-To: Message by Vincenzo Tschinke , Sat, 5 Sep 1998 22:41:21 +0200 , Message-ID: Recently, Vincenzo Tschinke said: > I would like to use an helper application that processes some files for my py > thon script. There is currently no way around getting the application and/or the finder in front (i.e. if someone knows of one: tell me:-). Even when you use the aetools.talkto class with the "start" parameter to the initializer it will still ask the finder to start the application. This isn't as it should be: it could do the correct process manager call itself, if it were available in Python. If someone wants to implement this: be my guest. the current method of starting a program has the undesirable side effect of sending an "Open Application" message (the finder does that), and some applications react to that by, for instance, opening an "Untitled" document. This is not really what you want if the first messages you're going to send the newly created process is an "Open File". -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Jack.Jansen@cwi.nl Mon Sep 7 12:03:39 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 07 Sep 1998 13:03:39 +0200 Subject: [Pythonmac-SIG] MacPython Shell In-Reply-To: Message by RJLacey@aol.com , Fri, 4 Sep 1998 00:24:18 EDT , <85d8127e.35ef6b72@aol.com> Message-ID: > At work the Python shell on a Sun uses the emacs line editing controls, and > the NT binary I downloaded uses the arrow keys, but the Mac binary (FAT to get > NumPy) doesn't supply any line editing. Is there any way to make the arrow > keys work? Long long ago I thought of incorporating GNU readline in MacPython, but Guido said he had looked at it and the code was so unix-specific that it was hardly likely to be doable, so I didn't pursue it. If anyone else wants to tackle this: the CodeWarrior newsgroup, comp.sys.mac.programmer.codewarrior, is probably the best place to start inquiries, as the most logical place to put line editing would be in SIOUX, the codewarrior console package used by Python. However, with the event of Just's IDE this is all not so interesting anymore, since the IDE has command line editing, and is the interface of choice for interactive work. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Jack.Jansen@cwi.nl Mon Sep 7 12:06:41 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 07 Sep 1998 13:06:41 +0200 Subject: [Pythonmac-SIG] img doc In-Reply-To: Message by RJLacey@aol.com , Fri, 4 Sep 1998 00:24:18 EDT , <85d8127e.35ef6b72@aol.com> Message-ID: > How can I get documentation for the img extension? The instructions that were > included in the MacPython download didn't make any sense to me at all - I'm a > user not a guru. Specifically, the files referred to were not included in the > distribution. Sigh, my fault. Img is still being maintained, since I use it personally for my main python project, but I've been very lax at updating the documentation and/or creating new distributions. This is mainly because PIL is much more popular, and seems to be the image package of choice for Python. I'll put this on my to-do list. Until then: if anyone wants what documentation is available contact me. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From savage@2xtreme.net Thu Sep 10 08:21:33 1998 From: savage@2xtreme.net (Bob Savage) Date: Wed, 9 Sep 1998 23:21:33 -0800 Subject: [Pythonmac-SIG] newbie question (bullet symbol?) In-Reply-To: Message-ID: Hi, all, just learning to work with this stuff. I was toying with some code out of the Mark Lutz book and trying to customize it a bit. I entered it into a new script in the IDE and tried to run it but I got a syntax error warning and the error indicated it was a problem in the middle of a word! In the error message dialog box it makes it look like there is a bullet symbol in the middle of the word so I thought I must have mistyped something. I selected several letters before and after the phantom bullet and tried typing over it, but it was still there when I tried to run it again. I tried to see if there was an extra character there by moving the cursor with the arrow keys and it doesn't seem to be there. Then I tried just dragging the script onto the regular Python application and it gave me a syntax error with a something like a little carot (exponent) symbol under the exact same place. If I remember correctly (the script is at work) the error seems to be inside the variable name: counter right after the e (before the r). Oddly enough an earlier line: counter = 0 worked fine. Later I was doing counter = counter + 1 and the syntax error occurred in the first use of counter on that line. (?) bob (perplexed, but happy to be learning Python) Bob Savage _________________________________________________________________________ e^mail -> savage@2xtreme.net _________________________________________________________________________ From just@letterror.com Thu Sep 10 14:14:10 1998 From: just@letterror.com (Just van Rossum) Date: Thu, 10 Sep 1998 15:14:10 +0200 Subject: [Pythonmac-SIG] newbie question (bullet symbol?) In-Reply-To: References: Message-ID: At 11:21 PM -0800 9/9/98, Bob Savage wrote: >Hi, all, > >just learning to work with this stuff. I was toying with some code out of >the Mark Lutz book and trying to customize it a bit. I entered it into a >new script in the IDE and tried to run it but I got a syntax error warning >and the error indicated it was a problem in the middle of a word! In the >error message dialog box it makes it look like there is a bullet symbol in >the middle of the word so I thought I must have mistyped something. I >selected several letters before and after the phantom bullet and tried >typing over it, but it was still there when I tried to run it again. I >tried to see if there was an extra character there by moving the cursor >with the arrow keys and it doesn't seem to be there. Then I tried just >dragging the script onto the regular Python application and it gave me a >syntax error with a something like a little carot (exponent) symbol under >the exact same place. The IDE uses the same info for the syntax error dialog, but the interactive interpreter will normally point at a character, whereas the bullet will be before that character. Not quite the same, but it was the best (ie. easiest ;-) solution I could come up with at the time. >If I remember correctly (the script is at work) the >error seems to be inside the variable name: >counter >right after the e (before the r). Oddly enough an earlier line: >counter = 0 >worked fine. Later I was doing >counter = counter + 1 >and the syntax error occurred in the first use of counter on that line. > >(?) Sometimes the syntax error position is misleading. Eg. this: x = (a, b, c counter = 12 will give an syntax error on counte*r. I'm afraid it's really impossible to guess what exactly your problem was without seeing the script. Good luck, Just From JWight@bigfoot.com Thu Sep 10 14:22:43 1998 From: JWight@bigfoot.com (Jonathan Wight) Date: 10 Sep 1998 13:22:43 -0000 Subject: [Pythonmac-SIG] Hung like a snake... Message-ID: <19980910132243.8140.qmail@findmail.com> If I were to create a mac app that could be extended with Python scripts how would I gracefully deal with the possibility of a script getting into an infinite loop and hanging? Is threading the answer? Is threading implemented properly on the Mac? Is there some other way of detecting an infinite loop (timeouts) and then gracefully killing it and _hopefully_ rolling back the changes the script has made (if needed). Thanks. Jon From Jack.Jansen@cwi.nl Thu Sep 10 16:41:30 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Thu, 10 Sep 1998 17:41:30 +0200 Subject: [Pythonmac-SIG] Hung like a snake... In-Reply-To: Message by "Jonathan Wight" , 10 Sep 1998 13:22:43 -0000 , <19980910132243.8140.qmail@findmail.com> Message-ID: > If I were to create a mac app that could be extended with Python scripts how would I gracefully deal with the possibility of a script getting into an infinite loop and hanging? > > Is threading the answer? Is threading implemented properly on the Mac? Threading isn't implemented on the mac yet, so I'm afraid that that's not the answer. The inner loop of the interpreter does however call out to PyErr_CheckSignals(), which not only checks for command-dot but also yields the processor to background jobs and such (unless the program has disabled this with MacOS.SchedParams). You could easily hook into this code, you find it all in Mac:Python:macglue.c. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From sdm7g@virginia.edu Thu Sep 10 21:11:52 1998 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Thu, 10 Sep 1998 16:11:52 -0400 (EDT) Subject: [Pythonmac-SIG] Hung like a snake... In-Reply-To: <19980910132243.8140.qmail@findmail.com> Message-ID: On 10 Sep 1998, Jonathan "Hung like a snake" Wight wrote: > If I were to create a mac app that could be extended with Python scripts > how would I gracefully deal with the possibility of a script getting > into an infinite loop and hanging? > > Is threading the answer? Is threading implemented properly on the Mac? I haven't tried threading & Python on the Mac, however, you may note that when you run the Mac Python application, [1] you can background the app by switching to another foreground app, and [2] you can cancel a long command with Command-\period. If you look at the main interpreter loop in ceval.c, just before the #ifdef WITH_THREAD block of code, you'll see: #if !defined(HAVE_SIGNAL_H) || defined(macintosh) /* If we have true signals, the signal handler will call Py_AddPendingCall() so we don't have to call sigcheck(). On the Mac and DOS, alas, we have to call it. */ if (PyErr_CheckSignals()) { why = WHY_EXCEPTION; goto on_error; } #endif PyErr_CheckSignals() [ in sigcheck.c ] calls PyOS_InterruptOccurred() The "OS" indicates that this is an OS specific function, and it's defined in macglue.c -- and that's where the check for Command-period is done. The exact flow of control when you add Tkinter and SOUIX and apple events into the mix is something I haven't quite unravelled, but SOMEWHERE MacPython makes occasional calls to PyMac_DoYield ( in macglue.c in the Mac/Python sources. ) to check for SOUIX and apple events. If you are embedding the python interpreter in another non-python app, then I believe you'll probably be calling some other, lower level entry point to the interpreter (in pythonrun.c), but you might do some similar setup in your app before calling the interpreter. > Is there some other way of detecting an infinite loop (timeouts) and > then gracefully killing it and _hopefully_ rolling back the changes the > script has made (if needed). However, *detecting* an infinite loop is another matter, and is not, in general, solvable. But you may be able to make some assumptions within your application to decide when that is likely ( For example, the python interpreter itself, has a recursion limit to stop runaway stack growth. ) or allow the user a way to kill the interpreter. ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- "I'm not as big a fool as I used to be, I'm a smaller fool." - Jack Kerouac Some of the Dharma From vanandel@atd.ucar.edu Fri Sep 11 04:59:11 1998 From: vanandel@atd.ucar.edu (Joe VanAndel) Date: Thu, 10 Sep 1998 21:59:11 -0600 Subject: [Pythonmac-SIG] drawing graphics with Mac version of Python Message-ID: <199809110359.VAA08810@linus.atd.ucar.edu> I'd like to teach some middle school students Python, and I'd like them to do some simple line drawing on the screen (like what can be done with LOGO, or BASIC). (Naturally, I don't want to warp their minds by teaching BASIC.) What graphics facilities can I use from the Mac version of Python? I suppose I can use the Tkinter canvas, but is there something faster and easier? Thanks much. From rcohen@humbug.llnl.gov Fri Sep 11 05:18:19 1998 From: rcohen@humbug.llnl.gov (Ron Cohen) Date: Thu, 10 Sep 1998 21:18:19 -0700 Subject: [Pythonmac-SIG] drawing graphics with Mac version of Python In-Reply-To: <199809110359.VAA08810@linus.atd.ucar.edu> (message from Joe VanAndel on Thu, 10 Sep 1998 21:59:11 -0600) Message-ID: <199809110418.VAA23789@humbug.llnl.gov> I am aware of (and have tried out) mac python interfaces for GNUPLOT and PLPLOT. It would be nice if some of these were available in a public place. I obtained gnuplot by sending email to Anthony Ingraldi" (A.M.INGRALDI@larc.nasa.gov), and plplot from Rob Managan (managan@llnl.gov). Since I'm not quite sure of the understandings about redistributing these, I suggest you contact either of the above. Either package should be adequate for your purpose. -Ron Cohen- From sdm7g@virginia.edu Fri Sep 11 18:00:01 1998 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Fri, 11 Sep 1998 13:00:01 -0400 (EDT) Subject: [Pythonmac-SIG] drawing graphics with Mac version of Python In-Reply-To: <199809110359.VAA08810@linus.atd.ucar.edu> Message-ID: On Thu, 10 Sep 1998, Joe VanAndel wrote: > I'd like to teach some middle school students Python, > and I'd like them to do some simple line drawing > on the screen (like what can be done with LOGO, or BASIC). > (Naturally, I don't want to warp their minds by teaching BASIC.) Well -- if you goal was not to teach them Python as much as to teach them turtle graphics and programming, etc. then there is a VERY nice, free LOGO for the Mac available from MIT MediaLab: http://starlogo.www.media.mit.edu/people/starlogo/ and other free logo's are available for PCs. > What graphics facilities can I use from the Mac version of > Python? I suppose I can use the Tkinter canvas, but is there > something faster and easier? But for MacPython there's: Tkinter canvas. Quickdraw Framework.py can handle events, menus, window management, etc., but it doesn't (I believe) has a canvas like retained drawing surface -- but if performance isn't the goal, that wouldn't be hard to do in Python, and would, in fact, be a nice advanced student project. ( Tk's canvas and XlispStat's (which I also use a lot) graphics framework both do a lot of stuff for low level lines and points "under the cover" in C for effeciecy -- something that I find severly limits the extensibility of both! ) WxWindows -- (Haven't tried any graphics programming with this myself-- just tested some demo's on an early Mac version.) AWT canvas with JPython. In Ch'ville's, most of the schools have Mac's but many of the students have PC's at home -- if that is an issue, then you probably don't want to use Mac QuickDraw. ( On the other hand, if I were doing something like this, I don't think I'ld want to get stuck supporting the installation of Python on a diverse collection of Win3.1 Win95, Win98 ... Il'd be sorely tempted just to give them all Linux CD's and tell them to go home and reformat Mom and Dad's hard disk! :-) :-) :-) [Just Kidding ... mostly!] ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- "I'm not as big a fool as I used to be, I'm a smaller fool." - Jack Kerouac Some of the Dharma From A.M.INGRALDI@larc.nasa.gov Fri Sep 11 19:02:53 1998 From: A.M.INGRALDI@larc.nasa.gov (Anthony M. Ingraldi) Date: Fri, 11 Sep 1998 14:02:53 -0400 Subject: [Pythonmac-SIG] drawing graphics with Mac version of Python In-Reply-To: <199809110418.VAA23789@humbug.llnl.gov> References: <199809110359.VAA08810@linus.atd.ucar.edu> (message from Joe VanAndel on Thu, 10 Sep 1998 21:59:11 -0600) Message-ID: At 9:18 PM -0700 9/10/98, Ron Cohen wrote: >I am aware of (and have tried out) mac python interfaces for GNUPLOT >and PLPLOT. It would be nice if some of these were available >in a public place. The gnuplot console code is included in the gnuplot distribution. This is available at http://users.ece.gatech.edu:80/~schooley/gnuplot.html A slightly modified version (for v1.5.1) can be obtained from http://www.erols.com/ingraldi/python/gnuplot_console.img.hqx The console code is a rather simple script that interacts with the gnuplot app via AppleEvents. -- Tony Ingraldi | e-mail: A.M.INGRALDI@LaRC.NASA.GOV NASA Langley Research Center | Mail Stop 267 | Phone : (757) 864-3039 Hampton, VA 23681-2199 | Fax : (757) 864-7892 From patrick@swdev.com Mon Sep 14 04:42:00 1998 From: patrick@swdev.com (Patrick Curtain) Date: Sun, 13 Sep 1998 19:42:00 -0800 Subject: [Pythonmac-SIG] the NetEvents app Message-ID: <35FC9011.58BAE583@swdev.com> Hey all! Has anyone tried creating a module for the NetEvents tool? I know it's being used with Frontier and it seemed like a nice suite to work with. Now, someone smack me if we already have tools (in the mac python lib) for doing things like ftp transfers and send email. Thanks everyone! --p ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Patrick Curtain, Husband & Father (I also write Software) patrick@swdev.com, http://www.swdev.com/ From A.M.INGRALDI@larc.nasa.gov Mon Sep 14 13:38:39 1998 From: A.M.INGRALDI@larc.nasa.gov (Anthony M. Ingraldi) Date: Mon, 14 Sep 1998 08:38:39 -0400 Subject: [Pythonmac-SIG] the NetEvents app In-Reply-To: <35FC9011.58BAE583@swdev.com> Message-ID: At 7:42 PM -0800 9/13/98, Patrick Curtain wrote: >Has anyone tried creating a module for the NetEvents > tool? I know it's being >used with Frontier and it seemed like a nice suite to work with. > I wouldn't bother with NetEvents. You'll find that network operations via NetEvents are quite unacceptable in terms of performance. >Now, someone smack me if we already have tools (in the mac python lib) >for doing things like ftp transfers and send email. Yep. Just use ftplib, smtplib, etc. -- Tony Ingraldi | e-mail: A.M.INGRALDI@LaRC.NASA.GOV NASA Langley Research Center | Mail Stop 267 | Phone : (757) 864-3039 Hampton, VA 23681-2199 | Fax : (757) 864-7892 From guzdial@cc.gatech.edu Mon Sep 14 18:51:34 1998 From: guzdial@cc.gatech.edu (Mark Guzdial) Date: Mon, 14 Sep 1998 13:51:34 -0400 (EDT) Subject: [Pythonmac-SIG] drawing graphics with Mac version of Python In-Reply-To: References: <199809110359.VAA08810@linus.atd.ucar.edu> Message-ID: Well, since Steven started it by mentioning StarLogo...:-) This is actually the right kind of application for Squeak (http://squeak.cs.uiuc.edu). Runs on all platforms, and can already do Logo-style graphics Mark -------------------------- Mark Guzdial : Georgia Tech : College of Computing : Atlanta, GA 30332-0280 (404) 894-5618 : Fax (404) 894-0673 : guzdial@cc.gatech.edu http://www.cc.gatech.edu/gvu/people/Faculty/Mark.Guzdial.html From Yvon.Thoraval@pobox.com Mon Sep 14 17:25:48 1998 From: Yvon.Thoraval@pobox.com (Yvon Thoraval) Date: Mon, 14 Sep 1998 18:25:48 +0200 Subject: [Pythonmac-SIG] Re: Pythonmac-SIG digest, Vol 1 #65 - 2 msgs In-Reply-To: <199809141600.MAA25031@python.org> Message-ID: unsubscribe From dozier@bellatlantic.net Mon Sep 14 21:42:55 1998 From: dozier@bellatlantic.net (Bill Dozier) Date: Mon, 14 Sep 1998 16:42:55 -0400 Subject: [Pythonmac-SIG] binary file strangeness Message-ID: Hi, I'm trying to write a MIDI sysex editor (starting with working with the Roland GP-100) in Python and have come across a little strangeness. Certain bytes having a value of 0x10 are being read as having a value of 0x13. I see the 0x10 values from Norton Disk Editor, or from reading the file with a Tcl script. Anyone else see something like this? Thanks. Bill Dozier Mortgage Physicist From rmore@onramp.net Mon Sep 14 22:10:19 1998 From: rmore@onramp.net (Rod Morehead) Date: Mon, 14 Sep 1998 16:10:19 -0500 (CDT) Subject: [Pythonmac-SIG] binary file strangeness In-Reply-To: References: Message-ID: <13821.34363.80519.10576@ghostwheel> Bill Dozier writes: > Hi, > > I'm trying to write a MIDI sysex editor (starting with working with the > Roland GP-100) in Python and have come across a little strangeness. > > Certain bytes having a value of 0x10 are being read as having a value of > 0x13. I see the 0x10 values from Norton Disk Editor, or from reading the > file with a Tcl script. > > Anyone else see something like this? You might want to try opening the file with the binary "b" flag added. file=open("foopath", "rb") Thanks, -- Rod Morehead rmore@onramp.net From guido@cnri.reston.va.us Mon Sep 14 22:12:31 1998 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 14 Sep 1998 17:12:31 -0400 Subject: [Pythonmac-SIG] binary file strangeness In-Reply-To: Your message of "Mon, 14 Sep 1998 16:42:55 EDT." References: Message-ID: <199809142112.RAA13323@eric.CNRI.Reston.Va.US> > I'm trying to write a MIDI sysex editor (starting with working with the > Roland GP-100) in Python and have come across a little strangeness. > > Certain bytes having a value of 0x10 are being read as having a value of > 0x13. I see the 0x10 values from Norton Disk Editor, or from reading the > file with a Tcl script. Sounds like you're opening binary files in text mode. Use open(file, "rb") to open files in binary mode. Good luck! --Guido van Rossum (home page: http://www.python.org/~guido/) From dozier@bellatlantic.net Tue Sep 15 00:53:26 1998 From: dozier@bellatlantic.net (Bill Dozier) Date: Mon, 14 Sep 1998 19:53:26 -0400 Subject: [Pythonmac-SIG] binary file strangeness In-Reply-To: References: Message-ID: Thanks to all for the quick suggestions! Yes, I was mistakenly reading the file in text, rather than binary, mode (something that I can't seem to find in Lutz's book, but is in the html dox). Now, if only I could get as quick a response from Roland (who has lots of my money for equipment) as I can from Guido (who has only my good will)! Bill Dozier Mortgage Physicist From joanca@seker.es Tue Sep 15 18:47:07 1998 From: joanca@seker.es (JoanCarles p Casas=?ISO-8859-1?Q?=edn?=) Date: Tue, 15 Sep 98 19:47:07 +0200 Subject: [Pythonmac-SIG] size (newbie) Message-ID: <0570.199809151942.007D708A@seker.es> hi, is possible to get the size (Kb) of a file? and if it is, how? thanks! JoanCarles...Typerware® From Yvon.Thoraval@pobox.com Tue Sep 15 20:24:11 1998 From: Yvon.Thoraval@pobox.com (Yvon Thoraval) Date: Tue, 15 Sep 1998 21:24:11 +0200 Subject: [Pythonmac-SIG] unsubscribe In-Reply-To: <199809151601.MAA06420@python.org> Message-ID: unsubscribe Yvon Thoraval http://perso.wanadoo.fr/yvon.thoraval/ http://julienas.ipt.univ-paris8.fr/~thoraval/ yvon.thoraval@pobox.com.antispam ICQ#18222777 From wolfgang@amadeus.m.eunet.de Tue Sep 15 12:21:31 1998 From: wolfgang@amadeus.m.eunet.de (Wolfgang Keller) Date: Tue, 15 Sep 1998 13:21:31 +0200 Subject: [Pythonmac-SIG] drawing graphics with Mac version of Python In-Reply-To: References: <199809110359.VAA08810@linus.atd.ucar.edu> Message-ID: >But for MacPython there's: *snip* > WxWindows -- (Haven't tried any graphics programming with this myself-- The WxWindows interface module for Python is available on the MacOS? Where can one get it? Is it already for WxWindows 2? Regards, Wolfgang Keller Zu Risiken und Nebenwirkungen von Junkmail lesen Sie de.admin.net-abuse.mail und fragen sie Ihren Postmaster oder Provider From wolfgang@amadeus.m.eunet.de Tue Sep 15 12:23:17 1998 From: wolfgang@amadeus.m.eunet.de (Wolfgang Keller) Date: Tue, 15 Sep 1998 13:23:17 +0200 Subject: [Pythonmac-SIG] 'Dynamic' UI with Python? Message-ID: Another typical dumb newbie question :-): I need to create a dialog box with contents that can only be determined at run-time (from reading in a PPD file, like the print dialog box). Is Tkinter the only way to do this with Python on the Mac (i hope not)? Having 398 different DITL resources and chosing among them at run-time isn't an option in this special case. TIA, Wolfgang Keller Zu Risiken und Nebenwirkungen von Junkmail lesen Sie de.admin.net-abuse.mail und fragen sie Ihren Postmaster oder Provider From Jack.Jansen@cwi.nl Tue Sep 15 22:36:14 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Tue, 15 Sep 1998 23:36:14 +0200 Subject: [Pythonmac-SIG] size (newbie) In-Reply-To: Message by JoanCarles p Casas=?ISO-8859-1?Q?=edn?= , Tue, 15 Sep 98 19:47:07 +0200 , <0570.199809151942.007D708A@seker.es> Message-ID: Recently, JoanCarles p Casas=?ISO-8859-1?Q?=edn?= said: > hi, > > is possible to get the size (Kb) of a file? and if it is, how? There are a few ways to do this, depending on what you're interested in. If you want to get the size of the data fork only the best method is os.stat(). The sixth value is the size of the data fork. This method is portable to other platforms. If you want the full size use os.xstat(). rv[6] is again data fork size, rv[10] is the resource fork size. xstat is mac-specific. You can also use the GetFInfo() method of a macfs.FSSpec object, if that is handier. Again, mac-specific. Note that all these methods give you the number of bytes in the file, *not* the amount of space it occupies on disk (the finder info command gives both). Does anyone know how to obtain the diskspace numbers? -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Jack.Jansen@cwi.nl Tue Sep 15 22:52:49 1998 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Tue, 15 Sep 1998 23:52:49 +0200 Subject: [Pythonmac-SIG] 'Dynamic' UI with Python? In-Reply-To: Message by Wolfgang Keller , Tue, 15 Sep 1998 13:23:17 +0200 , Message-ID: Recently, Wolfgang Keller said: > Another typical dumb newbie question :-): If this is a newbie question I guess I also count as a newbie:-) > I need to create a dialog box with contents that can only be determined at > run-time (from reading in a PPD file, like the print dialog box). Is > Tkinter the only way to do this with Python on the Mac (i hope not)? Having > 398 different DITL resources and chosing among them at run-time isn't an > option in this special case. The easiest way is to create a very full dialog (in the DITL resource) and hide the items that aren't appropriate. If this is somehow inappropriate it should be possible to create the dialog by hand, by adding the appropriate controls to a window (or an empty dialog?). I've never tried this as such (i.e. treating the result just as you would an ordinary dialog), if there is functionality missing from Python I would definitely like to hear this. There may also be refernce count problems: the current toolbox modules "knows" that if you created the controls by hand Python has to remove them when the refcount drops to zero, while controls in dialogs are magically cleaned up when the dialog disappears. Again, I would like to hear of problems. Adding controls to a window and handling them yourself is definitely no problem. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From wolfgang@amadeus.m.eunet.de Sun Sep 27 10:43:05 1998 From: wolfgang@amadeus.m.eunet.de (Wolfgang Keller) Date: Sun, 27 Sep 1998 11:43:05 +0200 Subject: [Pythonmac-SIG] mxTextTools for MacPython? Message-ID: Hello, is there a compiled binary of mxTextTools for the Mac available somewhere? TIA, regards, Wolfgang Keller Zu Risiken und Nebenwirkungen von Junkmail lesen Sie de.admin.net-abuse.mail und fragen sie Ihren Postmaster oder Provider From ita.mis@euro.apple.com Mon Sep 28 11:38:50 1998 From: ita.mis@euro.apple.com (Tasselli Marco) Date: Mon, 28 Sep 1998 11:38:50 +0100 Subject: [Pythonmac-SIG] SMTP from a Mac Message-ID: Hi, I've seen that in the 1.5.1 distribution of Python for the Mac, both the rfc822 and the smtp libs are present. I tried a test script for simple mail sending from a Mac but invariably get the message "socket: host not found" as a result of the command: server = smtplib.SMTP('myhost'). is there any problem using smtp functionality from a mac? regards Tasselli Marco From just@letterror.com Mon Sep 28 11:21:54 1998 From: just@letterror.com (Just van Rossum) Date: Mon, 28 Sep 1998 12:21:54 +0200 Subject: [Pythonmac-SIG] SMTP from a Mac In-Reply-To: Message-ID: At 11:38 AM +0100 9/28/98, Tasselli Marco wrote: >Hi, > >I've seen that in the 1.5.1 distribution of Python for the Mac, both the >rfc822 and the smtp libs are present. > >I tried a test script for simple mail sending from a Mac but invariably get >the message "socket: host not found" as a result of the command: >server = smtplib.SMTP('myhost'). > >is there any problem using smtp functionality from a mac? You should fill in a valid smtp server for 'myhost', like 'smtp.myprovider.com'. I've used smtplib often, without any problems. Just