From sdm7g@elvis.med.virginia.edu Thu Oct 2 20:51:17 1997 From: sdm7g@elvis.med.virginia.edu (Steven D. Majewski) Date: Thu, 2 Oct 1997 15:51:17 -0400 Subject: [PYTHONMAC-SIG] Re: copying from serial port References: <3431EFD3.21B5CD7B@panetheon.yale.edu> Message-ID: <199710021951.AA17517@elvis.med.Virginia.EDU> In article <3431EFD3.21B5CD7B@panetheon.yale.edu>, Tim Lovelock wrote: >Hi, > >I was looking for an application (hopefully) or a hint on how to go >about scripting or programing something that would monitor the serial >port for and automatically copy any text strings that came in through >the serial port so that they could be easily pasted into another >application. > >Any thoughts would be great. There is a communications toolbox module for Python. I've never used the communications toolbox, so I don't know exactly how to do this, but it should be able to be done. There is also AppleEvents support in MacPython, so you may be able to do the pasting into a scriptable application. --- I've also got a very crude first hack at a device mgr. module for Python. It supports the high-level routines: OpenDriver,CloseDriver,Status,Control,KillIO*,FSRead,FSWrite (* I have been able to crash my Mac into the macsbug by doing a KillIO under certain circumstances, but I'm thinking that may be because KillIO is an Immediate driver call and the driver may not be reentrant. ) And experimentally, a StatusImmed & ControlImmed call. PBRead and PBWrite are in there, but I haven't wrapped up a parameter block struct interface yet. ( Should have async reads and write when that's done. ) I'm doing this for an interface to a custom device, but I'm starting with generic device support so I can test the code without that board in my Mac. Without the async support, the best you can do is to poll for chars available with csCode=2. The following seems to work. import struct def toint( str ): return struct.unpack( 'i', str[:4] )[0] def charsAvail( refno ): return toint( Status( refno, 2 )) ain = OpenDriver( '.Ain' ) while 1: n = charsAvail( ain ) if n: data = FSRead( ain, n ) # do something with data I'll post the sources and a plugin when it's finished, but if you're desperate for it immediately ( or like living dangerously ), let me know. BTW: SWIG is a nice tool to help automate the glue-code generation needed to make arbitrary C code into Python/Perl/Tcl/et.al. callable extensions. ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- All power corrupts and obsolete power corrupts obsoletely." - Ted Nelson _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From sdm7g@Virginia.EDU Fri Oct 3 17:04:14 1997 From: sdm7g@Virginia.EDU (Steven D. Majewski) Date: 3 Oct 97 12:04:14 -0400 Subject: [PYTHONMAC-SIG] import/source dialog Message-ID: Here's a couple quick but useful utilities for interactive Python development. I've been wanting something like this on the mac for a while and I finally got impatient enough to go and write it. Windows folks may also find it useful -- the GetFileDialog is the only Mac specific part -- maybe you can replace it with a windows or Tkinter dialog. When working in a GUI desktop environment, I find myself spreading my files out a lot more than I did in Unix, and even worse, moving them around -- especially putting current or new work on the desktop, putting it away in the proper folder only when done. Also, since I don't have to type pathnames very often, my working pathnames tend to get longer than they typically did on unix, with embedded spaces and other chars that make it awkward to get right. ( If you've masteded emaces or alpha mode for interactive execution, then you also probably don't have much use for these. ) Maybe this can be done more cleanly using the 'imp' module, but this was a quick hack and I didn't want to dig out the library docs. ( I was at home where they weren't a web-click away. ) # Here's the mac specific function -- which really just removes the # macisms from StandardGetFile, so the rest of the code can be more # portable. from macfs import StandardGetFile def GetFileDialog( ): result = StandardGetFile() if result[1]: return result[0].as_pathname() # This does import via the file dialog, doing a reload if necessary - # which is frequent when testing and debugging modules. from os import path import sys def Import( filename=None ): if not filename: filename = GetFileDialog() if filename: dir,name = path.split( filename ) modname,ext = path.splitext( name ) sys.path.insert(0,dir) # temporarily insert this path at head of list if modname in sys.modules.keys(): PREVIOUSLY_LOADED = 1 else: PREVIOUSLY_LOADED = None try: module = __import__(modname) setattr( __main__, modname, module ) # assuming interactive use if PREVIOUSLY_LOADED: # if it's already loaded reload( module ) # we need to do a reload finally: del sys.path[0] # undo temporary path insertion # And sometimes there are "if name == '__main__' :" bits of code to # be tested. On unix, without the GUI startup time in a process, it's # trivial to quit and run it from the shell, but it's a pain on the # Mac to quit and restart Python for some trivial tests. # Also, sometimes I want to write code in the editor and run it from # main. import __main__ def Source( filename=None, into=__main__ ): if not filename: filename = GetFileDialog() if filename: exec open(filename).read() in into.__dict__ # This is just here for testing. Souce/Import myself. print __name__ Further ideas: Maybe this ought to be part of the MacPython shell's implementation -- i.e. "Import" and "Source" ought to be added to the standard menu. ( Counter argument: Then there's one more thing to take out of applications where it doesn't belong. ) Using the 'imp' module, it could be added to the default import. Unfortunately "import" with no module name is a syntax error, so we can't use a null import to trigger the dialog. But we could reserve a module name, so that "import xxx" triggers the dialog. - Steve Majewski _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Sun Oct 5 17:50:47 1997 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Sun, 05 Oct 1997 18:50:47 +0200 Subject: [PYTHONMAC-SIG] import/source dialog In-Reply-To: Message by "Steven D. Majewski" , 3 Oct 97 12:04:14 -0400 , Message-ID: To followup on Steve's mail: If you're running MacOS 8 on a PowerPC there's a contextual menu extension that adds a "copy full pathname to clipboard" to the contextual menu in the finder. I've only been using it for a few days, but I already find it indispensible when doing Python work. I don't remember exactly what the name of the extension is, but I found it at info-mac. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From billpy@mousa.demon.co.uk Sun Oct 5 20:20:50 1997 From: billpy@mousa.demon.co.uk (Bill Bedford) Date: Sun, 5 Oct 1997 20:20:50 +0100 Subject: [PYTHONMAC-SIG] import/source dialog In-Reply-To: References: Message by "Steven D. Majewski" , 3 Oct 97 12:04:14 -0400 , Message-ID: At 5:50 pm +0100 05/10/97, Jack Jansen wrote: ~To followup on Steve's mail: If you're running MacOS 8 on a PowerPC ~there's a contextual menu extension that adds a "copy full pathname to ~clipboard" to the contextual menu in the finder. I've only been using ~it for a few days, but I already find it indispensible when doing ~Python work. ~ ~I don't remember exactly what the name of the extension is, but I ~found it at info-mac. Its called 'Path' If you havn't got OS8 yet, save this as an applet on your desktop. It puts the path of any file dropped onto it onto the clipboard. import sys import Scrap def main(): try: x = sys.argv[1] except: x = "Bill Bedford" Scrap.ZeroScrap() Scrap.PutScrap('TEXT', x) Scrap.UnloadScrap() print \7 main() _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From managan@llnl.gov Mon Oct 6 21:39:24 1997 From: managan@llnl.gov (Rob Managan) Date: Mon, 6 Oct 1997 13:39:24 -0700 Subject: [PYTHONMAC-SIG] Modules Message-ID: In case there is any interest here is the list of modules I have working on the Mac. All of them live in the Extensions folder. img Imaging NumPy These three thanks to Jack for including them PLplot - the plplot graphics module; I have played with the driver for the Mac. scientific_modules - Konrad Hinson's modules. Not throughly tested but appear to work. (no C module; just python code) URNGmodule - LLNL portable random number generator pdbmodule - module to read LLNL's PDB file format. If any of these would help someone let me know nad I will make them available *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan mailto://managan@llnl.gov LLNL ph: 510-423-0903 P.O. Box 808, L-183 FAX: 510-423-5804 Livermore, CA 94551-0808 _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From jstrout@ucsd.edu Mon Oct 6 22:01:48 1997 From: jstrout@ucsd.edu (Joseph J. Strout) Date: Mon, 6 Oct 1997 14:01:48 -0700 Subject: [PYTHONMAC-SIG] Modules In-Reply-To: Message-ID: >In case there is any interest here is the list of modules I have working on >the Mac. All of them live in the Extensions folder. > >img What's the story on the img module? I remember this came up once before, and I seem to recall that although it's not listed on the img SIG web page as a supported platform, it *does* work on the Mac -- as Rob reports here. But is this something included with Python these days, or do I have to install an extension, or even (shudder) get the source code and compile it in myself? I'd love to play with the image-processing library. What must I do to make this possible? Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Tue Oct 7 10:09:50 1997 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Tue, 07 Oct 1997 11:09:50 +0200 Subject: [PYTHONMAC-SIG] Modules In-Reply-To: Message by "Joseph J. Strout" , Mon, 6 Oct 1997 14:01:48 -0700 , Message-ID: > What's the story on the img module? I remember this came up once before, > and I seem to recall that although it's not listed on the img SIG web page > as a supported platform, it *does* work on the Mac -- as Rob reports here. > But is this something included with Python these days, or do I have to > install an extension, or even (shudder) get the source code and compile it > in myself? It is included in the standard distribution, which is why you don't see its name come up often. The reason it's in the standard distribution is of course that I wrote it, with some help from Sjoerd:-). I still use it a lot, and its part of our multimedia document editor/player, so it'll be supported for quite some time, and I'll even be adding new image formats and such, but since PIL has become available it's become less likely that the image manipulation routines will see significant development, the functionality will probably stay at the current level: fast and simple reading/writing of images and conversion between colorspaces. Sjoerd has converted the various audio file readers and device drivers to a similar architecture as img, so the two may eventually be bundled in a "media toolkit" or some such. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From managan@llnl.gov Thu Oct 9 21:31:15 1997 From: managan@llnl.gov (Rob Managan) Date: Thu, 9 Oct 1997 13:31:15 -0700 Subject: [PYTHONMAC-SIG] Python and Igor Message-ID: This is a notice that I have started to look at building a Python module that will plot using Igor. This effort will necessarily be limited to Macintosh and Windows. Right now I am using the PPC (program to program comm) interface on the Macintosh. I have the C part mostly done (with Swig) but need to add array support. More work is required in python code to prepare the data and set up the connection to Igor. I would love to collaborate with anyone who has time and interest in this. *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan mailto://managan@llnl.gov LLNL ph: 510-423-0903 P.O. Box 808, L-183 FAX: 510-423-5804 Livermore, CA 94551-0808 _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From managan@llnl.gov Thu Oct 9 21:31:15 1997 From: managan@llnl.gov (Rob Managan) Date: Thu, 9 Oct 1997 13:31:15 -0700 Subject: [PYTHONMAC-SIG] Python and Igor Message-ID: This is a notice that I have started to look at building a Python module that will plot using Igor. This effort will necessarily be limited to Macintosh and Windows. Right now I am using the PPC (program to program comm) interface on the Macintosh. I have the C part mostly done (with Swig) but need to add array support. More work is required in python code to prepare the data and set up the connection to Igor. I would love to collaborate with anyone who has time and interest in this. *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan mailto://managan@llnl.gov LLNL ph: 510-423-0903 P.O. Box 808, L-183 FAX: 510-423-5804 Livermore, CA 94551-0808 _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From Jack.Jansen@cwi.nl Fri Oct 10 16:46:46 1997 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Fri, 10 Oct 1997 17:46:46 +0200 Subject: [PYTHONMAC-SIG] Bits of MacPython 1.5a4 available Message-ID: I've just announced a source distribution of MacPython 1.5a4 to the PSA-members mailing list. I've sent the various bits and pieces to Just, who should hopefully be able to turn that into a working binary distribution, because I'm off to Egypt and Jordan for 5 weeks. If you're not a PSA member but you think you could contribute to testing this release: convince Guido or Just or so to tell you the URL of it. See you later, -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++ http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From dave@zeus.hud.ac.uk Mon Oct 13 13:49:39 1997 From: dave@zeus.hud.ac.uk (Dave Dench) Date: Mon, 13 Oct 1997 13:49:39 +0100 Subject: [PYTHONMAC-SIG] Windows emulators on PC's Message-ID: <199710131249.NAA02023@ye.csm> Sorry not strictly mac python as such but I want to run the windows 95 python from my Mac : 240 Mhz 603e machine. Does anyone have any experience of doing this using the SoftWindows'95 or VirtualPC emulator? I want to do this for teaching purposes as students only have access to Unix version or PC version of Python and I want to check out any work that I do on a Mac first, before downloading to the students. I want to know if a) using PIL is feasible using this convoluted route ie gives adequate performance b) which is the best emulator. Best wishes, David ________________________________________________________________________________ ************************************************ * David Dench * * The University of Huddersfield , UK * * Tel: 01484 472083 * * email: d.j.dench@hud.ac.uk * ************************************************ ________________________________________________________________________________ _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From dave@zeus.hud.ac.uk Mon Oct 13 13:49:39 1997 From: dave@zeus.hud.ac.uk (Dave Dench) Date: Mon, 13 Oct 1997 13:49:39 +0100 Subject: [PYTHONMAC-SIG] Windows emulators on PC's Message-ID: <199710131249.NAA02023@ye.csm> Sorry not strictly mac python as such but I want to run the windows 95 python from my Mac : 240 Mhz 603e machine. Does anyone have any experience of doing this using the SoftWindows'95 or VirtualPC emulator? I want to do this for teaching purposes as students only have access to Unix version or PC version of Python and I want to check out any work that I do on a Mac first, before downloading to the students. I want to know if a) using PIL is feasible using this convoluted route ie gives adequate performance b) which is the best emulator. Best wishes, David ________________________________________________________________________________ ************************************************ * David Dench * * The University of Huddersfield , UK * * Tel: 01484 472083 * * email: d.j.dench@hud.ac.uk * ************************************************ ________________________________________________________________________________ _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From sdm7g@Virginia.EDU Tue Oct 14 02:01:09 1997 From: sdm7g@Virginia.EDU (Steven D. Majewski) Date: Mon, 13 Oct 1997 21:01:09 -0400 (EDT) Subject: [PYTHONMAC-SIG] Applications as shared libraries Message-ID: FYI: There is a note on this in the "Targeting Mac OS" Code Warrior docs, under the heading "Applications as Shared Libraries" -- which sounds clear enough, but the two paragraphs under that heading I found rather confusing. But -- if anyone is interested: it is probably possible to build Python as an application without the PythonCore shared library and still link other DLLs to use the Python API routines. The trick is to load the application file into the DLL project, and to set the compiler for files of type 'APPL" to "PEF Import PPC" in the File Mappings preference panel. This seems to cause the library to resolve it's symbols from the application code. ( You also need to have set the application to export the needed symbols. ) [ I haven't done this with Python, but I've have with another program, so I'm quite sure it will work as described. ] I think the separate shared library is useful for applets and other uses, but perhaps this may be useful for someone who needs to produce an embedded app or some other case where you need to simplify the "shippables" . ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- All power corrupts and obsolete power corrupts obsoletely." - Ted Nelson _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From just@knoware.nl Wed Oct 15 11:50:02 1997 From: just@knoware.nl (Just van Rossum) Date: Wed, 15 Oct 1997 11:50:02 +0100 Subject: [PYTHONMAC-SIG] MacPython 1.5a4 available Message-ID: I've just announced a binary distribution of MacPython 1.5a4 to the PSA-members mailing list. If you are a PSA member, you'll know where to find it. If you're not, but feel like you could contribute to testing this release: convince me to send you the Secret URL. Just _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From jstrout@ucsd.edu Thu Oct 23 22:37:11 1997 From: jstrout@ucsd.edu (Joseph J. Strout) Date: Thu, 23 Oct 1997 14:37:11 -0700 Subject: [PYTHONMAC-SIG] Thread support in Mac Python? Message-ID: Can anyone brief me on the current status of thread support in Mac Python? IIRC, the last time I asked, they just plain didn't work -- but that was some time ago. If they're still not working, are there any plans or prospects for adding them in? (Doesn't the current MacOS have a Thread Manager or some such?) Thanks, -- Joe ,------------------------------------------------------------------. | Joseph J. Strout Department of Neuroscience, UCSD | | jstrout@ucsd.edu http://www-acs.ucsd.edu/~jstrout/ | `------------------------------------------------------------------' [ Help stop spam: http://www.imc.org/ube-sol.html ] _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________ From python@pobox.com Thu Oct 23 23:12:49 1997 From: python@pobox.com (Guido van Rossum) Date: Thu, 23 Oct 1997 18:12:49 -0400 Subject: [PYTHONMAC-SIG] Thread support in Mac Python? In-Reply-To: Your message of "Thu, 23 Oct 1997 14:37:11 PDT." References: Message-ID: <199710232212.SAA04337@eric.CNRI.Reston.Va.US> > Can anyone brief me on the current status of thread support in Mac Python? > IIRC, the last time I asked, they just plain didn't work -- but that was > some time ago. If they're still not working, are there any plans or > prospects for adding them in? (Doesn't the current MacOS have a Thread > Manager or some such?) I haven't seen any patches yet, so they still don't work. I think it would be a lot of work, because you don't just need the thread manager -- you would also need to make GUSI thread-manager-aware. This is because the Mac OS still doesn't do scheduling properly. I don't see this changing any time soon, unless the Mac suddenly becomes a lot more popular. Too bad -- I still like it a lot... --Guido van Rossum (home page: http://www.python.org/~guido/) _______________ PYTHONMAC-SIG - SIG on Python for the Apple Macintosh send messages to: pythonmac-sig@python.org administrivia to: pythonmac-sig-request@python.org _______________