From owen@astro.washington.edu Fri Jun 1 00:00:03 2001 From: owen@astro.washington.edu (Russell E Owen) Date: Thu, 31 May 2001 16:00:03 -0700 Subject: [Pythonmac-SIG] cross platform GUI? In-Reply-To: <4197FA5DD22AD5118ADE00805F6FA62F4515@eden.vmlabs.com> References: <4197FA5DD22AD5118ADE00805F6FA62F4515@eden.vmlabs.com> Message-ID: >So, in your collective experience, is tk actually useable to create decent >Mac applications that are also decent Windows applications? I'd like to be >able to use wxpython or tk and also pygame (http://pygame.seul.org/) but I'd >like to target both Mac (OS9 and OSX) and Windows at the same time. How do >you accomplish that? Tk on the Mac works fine in many ways, but does have some serious limitations: - I haven't been able to get menus to work reliably (under Tk or Tkinter), so I stick with the default ones. I'd love to know if anyone else has this problem or it's just me. - You can forget networked Tk applications on the Mac, as file events are broken there. - Development is somewhat painful on the Mac (by comparison, say, to unix) as you have to run scripts in PythonInterpreter, and editor integration doesn't seem to be there. - Tk applications seem to rather take over the Mac, leaving little time for background tasks. I'm not sure if this can be avoided somehow. - Also, cosmetically, standard frame decorations such as ridge and groove look fairly unconvincing on the Mac. But a lot of Tkinter does work. I've had no stability problems aside from menus. Windows and widgets (except menus) all work as they should. If you need something now for the Mac, perhaps you should consider a unix version of wxPython or Tkinter under Mac OS X (any opinions on that? Would it feel at all mac-like to a regular mac user?). I've not used wxPython or pygame. wxPython doesn't run on the Mac (though Mac support for wxWindows seems to be coming along, so maybe someday...). I've also not coded for Windows, but my Tk apps run just fine under unix and Mac (except the networked stuff on Mac). -- Russell From delza@alliances.org Fri Jun 1 00:14:36 2001 From: delza@alliances.org (Dethe Elza) Date: Thu, 31 May 2001 16:14:36 -0700 Subject: [Pythonmac-SIG] cross platform GUI? In-Reply-To: Message-ID: Tkinter applications that I wrote for Linux and which work fine on Windows have some problems on the Mac: they run but with lots of little problems. Also pretty ugly, but that's Tkinter on every platform, just more noticeable on the Mac. If you find a good solution, let me know. wxWindows is coming for the Mac, but it was still pretty rough last time I tried it. -- Dethe Elza Chief Mad Scientist Burning Tiger Technologies From burgisr@hotmail.com Fri Jun 1 03:04:04 2001 From: burgisr@hotmail.com (Rich Burgis) Date: Fri, 01 Jun 2001 02:04:04 Subject: [Pythonmac-SIG] Manipulating Resources Message-ID: My son and I are trying to build a resource editor for a game plug-in. I can find the handle for any given resource, but it is not obvious how to access the actual data. Is there some documentation I can find? Otherwise how would you dereference a handle? Thanks Much Rich _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com From richard@richardgordon.net Fri Jun 1 03:56:43 2001 From: richard@richardgordon.net (Richard Gordon) Date: Thu, 31 May 2001 22:56:43 -0400 Subject: [Pythonmac-SIG] cross platform GUI? In-Reply-To: References: <4197FA5DD22AD5118ADE00805F6FA62F4515@eden.vmlabs.com> Message-ID: At 4:00 PM -0700 5/31/01, Russell E Owen wrote: >Tk on the Mac works fine in many ways, but does have some serious limitations: >- I haven't been able to get menus to work reliably (under Tk or >Tkinter), so I stick with the default ones. I'd love to know if >anyone else has this problem or it's just me. >*** >- Tk applications seem to rather take over the Mac, leaving little >time for background tasks. I'm not sure if this can be avoided >somehow. I've heard this a couple of times before and what puzzles me is why this would be true in the context of running Tk via Tkinter, yet something like Alpha (which I gather is a pure tcl/tk application) runs fine (within reasonable limits) on the Mac? In fact, I think that I just recently used another Mac tcl/tk application that also behaved pretty normally altho I can't recall what it was. I've only dabbled with tkinter enough to know that trying to develop primarily with it on a Mac is a pretty severe handicap because of the lack of a conventional console. The best other option that I know of that is truly x-platform is to use Jython and SWING, but running Java on a Mac is kind of peculiar and I suspect that getting this to really work well would be a lot of work. Richard Gordon -------------------- Gordon Design Web Design/Database Development http://www.richardgordon.net From jbmoody@oakland.edu Fri Jun 1 12:22:03 2001 From: jbmoody@oakland.edu (Jon Moody) Date: Fri, 1 Jun 2001 07:22:03 -0400 Subject: [Pythonmac-SIG] cross platform GUI? In-Reply-To: ; from owen@astro.washington.edu on Thu, May 31, 2001 at 04:00:03PM -0700 References: <4197FA5DD22AD5118ADE00805F6FA62F4515@eden.vmlabs.com> Message-ID: <20010601072203.A19427@oakland.edu> On Thu, May 31, 2001 at 04:00:03PM -0700, Russell E Owen wrote: > - I haven't been able to get menus to work reliably (under Tk or > Tkinter), so I stick with the default ones. I'd love to know if > anyone else has this problem or it's just me. I spent (wasted) some time on this; adding menus (using Pmw) worked fine, but adding items to the standard `About' (apple) and `Help' menus didn't. The only way `About'/`Help' worked for me is if I called Tk directly with Tkinter's tk.call() method which looks hideous but works. (This was using a Pmw.MainMenuBar object, but the same thing should work using Tkinter.Menu directly): # create an `About ...' apple menu and an entry in `Help' menu self.menuBar = self.createcomponent('menubar', (), None, Pmw.MainMenuBar, (self._hull,), hull_relief=RAISED, hull_borderwidth=1, balloon=self.balloon()) menu = self.menuBar.component('hull') # Tkinter.Menu object main = str(menu) help = main + '.help' apple = main + '.apple' self.root.tk.call(main, 'add', 'cascade', '-menu', help) self.root.tk.call('menu', help, '-tearoff', '0') self.root.tk.call(main, 'add', 'cascade', '-menu', apple) self.root.tk.call('menu', apple, '-tearoff', '0') helpopts = {'label':'MyProgram help', 'command':self.showHelp} appleopts = {'label':'About MyProgram . . .', 'command':self.showAbout} apply(self.root.tk.call, (help, 'add', 'command') + menu._options(helpopts)) apply(self.root.tk.call, (apple, 'add', 'command')+ menu._options(appleopts)) -- Jon From ranch1@earthlink.net Fri Jun 1 15:22:00 2001 From: ranch1@earthlink.net (Tom Fetherston) Date: Fri, 1 Jun 2001 10:22:00 -0400 Subject: [Pythonmac-SIG] (no subject) Message-ID: >At 4:00 PM -0700 5/31/01, Russell E Owen wrote: >>Tk on the Mac works fine in many ways, but does have some serious >>limitations: >>- I haven't been able to get menus to work reliably (under Tk or >>Tkinter), so I stick with the default ones. I'd love to know if >>anyone else has this problem or it's just me. >>*** >>- Tk applications seem to rather take over the Mac, leaving little >>time for background tasks. I'm not sure if this can be avoided >>somehow. > >I've heard this a couple of times before and what puzzles me is why >this would be true in the context of running Tk via Tkinter, yet >something like Alpha (which I gather is a pure tcl/tk application) >runs fine (within reasonable limits) on the Mac? In fact, I think >that I just recently used another Mac tcl/tk application that also >behaved pretty normally altho I can't recall what it was. > The current release of Alpha has an embedded Tcl interpreter, (quite a few versions back). There is a port of the code into Tcl/Tk (pure) called AlphaTk for unix and windows. Behind the scenes there is an alpha of Alpha that uses the current Tcl shared libraries. Tom From chrishbarker@home.net Fri Jun 1 18:27:15 2001 From: chrishbarker@home.net (Chris Barker) Date: Fri, 01 Jun 2001 10:27:15 -0700 Subject: [Pythonmac-SIG] cross platform GUI? References: Message-ID: <3B17D073.20C95CF7@home.net> This discussion makes oit pretty clear that while tkinter is the only option for cross platform develpment, it is pretty inadequate. > If you find a good solution, let me know. wxWindows is coming for the Mac, > but it was still pretty rough last time I tried it. wxWindows on the Mac has seen a lot of progress lately, judging by the traffic on wx-dev. I think it is fully carbonized, and is working on OS-X as well as Classic. There have recently been a couple of posts about wxPython on the Mac that have been encouraging, but no one has actually posted an even minimally working version yet, so who knows... Unfortunately, even if wxPython on the Mac does arrive, it will probably suffer from some of the same deficiencies as Tkinter on the Mac, such as no real console, and I'm sure it won't play well with the IDE. None of these deficiencies will ever be solved unless some folks in the MacPython Community commit the effort required to fix them. Jack has done a lot to at least get TK working, but it seems no one else has the time/skill/inclination combination to put the extra work in to make it work really well. I know I fall into that catagory, I'd love to have a good cross platform option, but I don't have the time of skill to make it happen. If I did, I would probably put it into wxPython, rather than TK. I htink it has more promise, you're likely to see more support from the wx community, and I like oit better on Windows and Unix as well. By the way, another option may be arriving. TrollTech has announced that they are putting out a version of QT for Mac OS-X. I don't think they are planning on supporting classic at all, but if you are thinking of the future, it may be a good way to go. QT has proven to be an excellent toolkit for Unix applications (perhaps the best framework for Unix available, see the KDE project). Trolltech has also been very supportive of the free software community. There are Python binding to QT as well, and they will probably be easier to port to OS-X that it will be to port wxPython to Classic (although maybe no easier that porting it to OS-X) see: http://www.trolltech.com/company/announce/mac.html and: http://www.thekompany.com/projects/pykde/ Currently, you need to give TrollTech money to develop with QT on Windows, but you can use it for free if you are developing free software for Unix. I don't know what their licensing plan is for OS-X. They do, however allow PyQT to be used for free on Windows and Unix, so that will probably hold true for OS-X as well. By the way, does anyone know what the status of TK on OS-X is? Maybe we'll get our console that way. Let's hope something better arrives soon! -Chris -- Christopher Barker, Ph.D. ChrisHBarker@home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From pairodox@appleisp.net Sat Jun 2 07:26:57 2001 From: pairodox@appleisp.net (Bill Dozier & Chris Platt) Date: Sat, 02 Jun 2001 01:26:57 -0500 Subject: [Pythonmac-SIG] cross platform GUI? In-Reply-To: <3B17D073.20C95CF7@home.net> Message-ID: > > This discussion makes oit pretty clear that while tkinter is the only > option for cross platform develpment, it is pretty inadequate. > IMHO Jython is superior to using tkinter. tk on the Mac is quirky, hopelessly ugly and not much speedier than Java. wxWindows on the Mac, I suspect, will turn out apps that look a lot like ported Windoze app. If I am right, this will not be a great option. Pros: Cleaner code More control over L&F Better support for JDK than for tk Better stability More complete widget set (e.g., tables) More modern framework (better event model, etc.) Access to Java libraries as well as most of the Python library Strong support for Java in Mac OS X, Windoze, Unixen Cons: Poor Swing performance on Classic Mac OS Can't use the Mac IDE or IDLE (but you can use xemacs on OS X, which I like better, anyway). Bill Dozier From smithsm@samuelsmith.org Sat Jun 2 14:18:17 2001 From: smithsm@samuelsmith.org (Samuel Smith) Date: Sat, 2 Jun 2001 09:18:17 -0400 Subject: [Pythonmac-SIG] cross platform GUI? In-Reply-To: References: Message-ID: > > >> This discussion makes oit pretty clear that while tkinter is the only >> option for cross platform develpment, it is pretty inadequate. >> > >IMHO Jython is superior to using tkinter. tk on the Mac is quirky, >hopelessly ugly and not much speedier than Java. > >wxWindows on the Mac, I suspect, will turn out apps that look a lot like >ported Windoze app. If I am right, this will not be a great option. My Understanding is that WxWindows uses the native look and feel on what ever platforms see below for example http://www.advanced.ch/wxwin/wxmac/screen.htm We have been using WxPython (windows, linux) for a couple of years now and have had good success with it. The support for wxwindows seems to be solid its just that the Mac community doesn't provide much support. I give my vote to wxPython as the best alternative for a cross platform GUI. WxMac has been integrated to the current WxWindows source tree. It is really just finding somebody to pick up the gauntlet to do a mac python port. >Pros: >Cleaner code >More control over L&F >Better support for JDK than for tk >Better stability >More complete widget set (e.g., tables) >More modern framework (better event model, etc.) >Access to Java libraries as well as most of the Python library >Strong support for Java in Mac OS X, Windoze, Unixen > >Cons: >Poor Swing performance on Classic Mac OS >Can't use the Mac IDE or IDLE (but you can use xemacs on OS X, which I like >better, anyway). > >Bill Dozier > > >_______________________________________________ >Pythonmac-SIG maillist - Pythonmac-SIG@python.org >http://mail.python.org/mailman/listinfo/pythonmac-sig -- ********************************************** Samuel M. Smith Alison Moore Smith Jessica Belinda Alana Monica Samuel (baby) 21271 Waycross Drive, Boca Raton FL 33428 561-487-3823 (voice) 561-487-8930 (fax) www.samuelsmith.org (web) ********************************************* From Appelkore@aol.com Wed Jun 6 03:25:29 2001 From: Appelkore@aol.com (Appelkore@aol.com) Date: Tue, 5 Jun 2001 22:25:29 EDT Subject: [Pythonmac-SIG] test.autotest errors Message-ID: <40.c6a1970.284eee99@aol.com> I am new to Python, but not to the Mac OS or programming. I installed Python, opened the command-line interpreter, ran compileall, and tried the suggested diagnostics (import test.autotest). I got more errors than the README said I would: - "test test_XXXX skipped -- No module named XXXX" for the following: al, bsddb, cd, cl, crypt, dbm, dl, fcntl, gc, gl, grp, imgfile, mmap, nis, pwd, signal, sunaudiodev, timing, winreg, winsound - "test test_fork1 skipped -- os.fork not defined -- skipping test_fork1" - "test test_largefile skipped -- platform does not have largefile support" - "test test_linuxaudiodev skipped -- No module named fcntl" - "test test_locale skipped -- test locale en_US not supported" (I am indeed in the US.) - "test test_longexp crashed -- exceptions.MemoryError: " which I expected. - "test test_openpty skipped -- No openpty() available." - "test test_poll skipped -- select.poll not defined -- skipping test_poll" - "test test_popen2 skipped -- cannot import name fork" - "test test_pty skipped -- No module named FCNTL" - "test test_socket crashed -- socket.error: host not found" which is strange, because I have a normal DSL connection. - "test test_sundry skipped -- No module named bsddb" - "test test_zlib crashed -- exceptions.MemoryError: " which I also expected. Final results: 105 tests OK. 3 tests failed: test_longexp test_socket test_zlib 29 tests skipped: test_al test_bsddb test_cd test_cl test_crypt test_dbm test_dl test_fcntl test_fork1 test_gc test_gl test_grp test_imgfile test_largefile test_linuxaudiodev test_locale test_mmap test_nis test_openpty test_poll test_popen2 test_pty test_pwd test_signal test_sunaudiodev test_sundry test_timing test_winreg test_winsound Someone tell me this is normal. (iMac rev C, OS 9.1, 256MB virtual memory, Python 2.1.) From Appelkore@aol.com Wed Jun 6 03:32:07 2001 From: Appelkore@aol.com (Appelkore@aol.com) Date: Tue, 5 Jun 2001 22:32:07 EDT Subject: [Pythonmac-SIG] Carbon/Classic together (a quicker question) Message-ID: <105.46c6471.284ef027@aol.com> In the Python installer, I chose to install everything but the Developer Tools -- meaning I installed both the Carbon and Classic versions of everything (so I could use Tcl/Tk). Both versions live in the same folder(s). I ran ConfigurePythonClassic first, then ConfigurePythonCarbon, because if only one version will work, I want it to be the Carbon build. Will both versions work independently, or will one try to access the other's version-specific libraries unsuccessfully? Also, do I even need Tcl/Tk? From richard@richardgordon.net Wed Jun 6 03:58:29 2001 From: richard@richardgordon.net (Richard Gordon) Date: Tue, 5 Jun 2001 22:58:29 -0400 Subject: [Pythonmac-SIG] test.autotest errors In-Reply-To: <40.c6a1970.284eee99@aol.com> References: <40.c6a1970.284eee99@aol.com> Message-ID: At 10:25 PM -0400 6/5/01, Appelkore@aol.com wrote: >Final results: >105 tests OK. >3 tests failed: test_longexp test_socket test_zlib >29 tests skipped: test_al test_bsddb test_cd test_cl test_crypt test_dbm >test_dl test_fcntl test_fork1 test_gc test_gl test_grp test_imgfile >test_largefile test_linuxaudiodev test_locale test_mmap test_nis test_openpty >test_poll test_popen2 test_pty test_pwd test_signal test_sunaudiodev >test_sundry test_timing test_winreg test_winsound > > >Someone tell me this is normal. ok, it's normal. :-] I get exactly the same results and gather that most others do. The socket failure is just a network configuration issue and I think that the other 2 failures can be overcome if you want to allocate a ridiculous amount of ram to python (like 400 megs or so). The things that were skipped are pretty much either platform specific (i.e., text_linuxaudiodev) or involve things that MacOS just can't do (i.e., test_largefile). None of it really matters to most people. Richard Gordon -------------------- Gordon Design Web Design/Database Development http://www.richardgordon.net From Appelkore@aol.com Wed Jun 6 05:00:42 2001 From: Appelkore@aol.com (Appelkore@aol.com) Date: Wed, 6 Jun 2001 00:00:42 EDT Subject: [Pythonmac-SIG] test.autotest errors Message-ID: <3d.cb5b686.284f04ea@aol.com> Thanks for clearing that up. In a message dated 6/5/01 10:07:16 PM, richard@richardgordon.net writes: >involve things that MacOS just can't do (i.e., >test_largefile). What exactly does the "largefile" module do? -- Jonathan Marcus Appelkore@aol.com From jack@oratrix.nl Wed Jun 6 10:16:20 2001 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 06 Jun 2001 11:16:20 +0200 Subject: [Pythonmac-SIG] Carbon/Classic together (a quicker question) In-Reply-To: Message by Appelkore@aol.com , Tue, 5 Jun 2001 22:32:07 EDT , <105.46c6471.284ef027@aol.com> Message-ID: <20010606091620.C6AAC312BA0@snelboot.oratrix.nl> > In the Python installer, I chose to install everything but the Developer > Tools -- meaning I installed both the Carbon and Classic versions of > everything (so I could use Tcl/Tk). Both versions live in the same folder(s). > > I ran ConfigurePythonClassic first, then ConfigurePythonCarbon, because if > only one version will work, I want it to be the Carbon build. > > Will both versions work independently, or will one try to access the other's > version-specific libraries unsuccessfully? The two versions use different extensions for dynamically loaded libraries (.ppc.slb and .carbon.slb) so there's no conflicts there. > Also, do I even need Tcl/Tk? No, _tkinter.ppc.slb has all the relevant parts of tcl/tk incorporated, so there's no reason to get a tcl/tk distribution also. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From jack@oratrix.nl Wed Jun 6 10:19:40 2001 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 06 Jun 2001 11:19:40 +0200 Subject: [Pythonmac-SIG] test.autotest errors In-Reply-To: Message by Appelkore@aol.com , Wed, 6 Jun 2001 00:00:42 EDT , <3d.cb5b686.284f04ea@aol.com> Message-ID: <20010606091940.3420D312BA0@snelboot.oratrix.nl> > Thanks for clearing that up. > > In a message dated 6/5/01 10:07:16 PM, richard@richardgordon.net writes: > >involve things that MacOS just can't do (i.e., > >test_largefile). > > What exactly does the "largefile" module do? It tests support for files bigger than 2 GB (2**31 bytes), if the platform API supports such files. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From jlegg@acs.wooster.edu Thu Jun 7 14:32:24 2001 From: jlegg@acs.wooster.edu (jlegg@acs.wooster.edu) Date: Thu, 07 Jun 2001 09:32:24 -0400 (EDT) Subject: [Pythonmac-SIG] BuildApplet and Application problems Message-ID: I'm working on a project that uses the Res module to access resource data from a .rsrc (or the python file itself, when I compile it to and applet or application). As a script with a seperate .rsrc file everything works fine but when I run BuildApplet on it I run into problems. Everything "compiles" fine and I end up with a .applet program but this does not do anything when it runs -- flashes a blank console window then terminates. The Application will do the same thing (except sit at a blank console with *terminated* in the title bar). However, when I compile scripts that do not make use of Res module functions everything seems to work fine. Any ideas as to why this is and possible resolutions? In fact, it seems that I can even use Res functions and compile everything fine -- it's only when I merge my .rsrc file with the applet/application that things turn to failure. If I compiled with CodeWarrior or some other way would that work? -- Jesse From just@letterror.com Thu Jun 7 14:45:36 2001 From: just@letterror.com (Just van Rossum) Date: Thu, 7 Jun 2001 15:45:36 +0200 Subject: [Pythonmac-SIG] BuildApplet and Application problems In-Reply-To: Message-ID: <20010607154539-r01010600-da794ac8@213.84.27.177> jlegg@acs.wooster.edu wrote: > I'm working on a project that uses the Res module to access resource data > from a .rsrc (or the python file itself, when I compile it to and applet > or application). As a script with a seperate .rsrc file everything works > fine but when I run BuildApplet on it I run into problems. Everything > "compiles" fine and I end up with a .applet program but this does not do > anything when it runs -- flashes a blank console window then terminates. > The Application will do the same thing (except sit at a blank console with > *terminated* in the title bar). However, when I compile scripts that do > not make use of Res module functions everything seems to work fine. Any > ideas as to why this is and possible resolutions? > > In fact, it seems that I can even use Res functions and compile everything > fine -- it's only when I merge my .rsrc file with the applet/application > that things turn to failure. If I compiled with CodeWarrior or some > other way would that work? It's hard to tell what's going on without a traceback: is there any exception catching code in your app/script that might mask the exception? Or else: are there any Python prefs resources in your .rsrc file that might be corrupt or belong to a different version of Python? Just From p.agapow@ic.ac.uk Thu Jun 7 17:24:18 2001 From: p.agapow@ic.ac.uk (Paul-Michael Agapow) Date: Thu, 7 Jun 2001 17:24:18 +0100 Subject: [Pythonmac-SIG] cross platform GUI? In-Reply-To: References: Message-ID: >wxWindows on the Mac, I suspect, will turn out apps that look a lot like >ported Windoze app. If I am right, this will not be a great option. Your cynicism about cross-platform GUIs is not unwarranted, but I don't think it's correct in the case of wxWindows. From my (admittedly preliminary) explorations with it, the look-and-feel is pretty good. A lot of this is due to the wxWindows guys eschewing set dimensions and using "sizers" which adjust their size appropriately for the given platform. The bigger problem with wxMac (and I don't mean to belittle the efforts of developers) is that there are corners of wxWindows that just don't work properly for Mac yet, and the only way to find this out is to attempt to use them. There are a few significant wxMac applications floating around so people have obviously been able to work around these shortcomings. So roll on, wxPython! From owen@astro.washington.edu Thu Jun 7 17:46:20 2001 From: owen@astro.washington.edu (Russell E Owen) Date: Thu, 7 Jun 2001 09:46:20 -0700 Subject: [Pythonmac-SIG] Carbon/Classic together (a quicker question) In-Reply-To: <105.46c6471.284ef027@aol.com> References: <105.46c6471.284ef027@aol.com> Message-ID: >In the Python installer, I chose to install everything but the Developer >Tools -- meaning I installed both the Carbon and Classic versions of >everything (so I could use Tcl/Tk). Both versions live in the same folder(s). > >I ran ConfigurePythonClassic first, then ConfigurePythonCarbon, because if >only one version will work, I want it to be the Carbon build. After you run either of these you end up with an appropriate copy of PythonInterpreter and Python IDE. These are overwritten when you run the other. So you'll have to move them somewhere if you want to keep both sets. From what Just said, both sets can be kept and run without colliding. However, a minor caveat is that you'll not be sure which (classic or carbon version) will run when you double click a file. I think you'd be better off sticking with one or the other. Do you really need carbon? >Will both versions work independently, or will one try to access the other's >version-specific libraries unsuccessfully? > >Also, do I even need Tcl/Tk? If you want to run windowing scripts with Tk from Python then you need to install Tkinter (as you did), and run such scripts by dropping them on the Classic version of PythonInterpreter (not the IDE!). If you don't want to write Tk window scripts, then no need for them. At present, the only other Python windowing choice on the Mac is Jython, but perhaps wxPython will run someday, and presumably there are more unix x-based options on Mac OS X (If anybody can speak about this....is that true now? Does Mac OS X come with a suitable X server to run such scripts? Do such applications feel at all Mac-like, e.g. the clipboard works?). Tkinter is self-contained. If you install Python with Tkinter then you have all you need, you don't have to download Tck/Tk separately (as Just said), and indeed it wouldn't help if you did. If this doesn't answer your question, might you rephrase it? -- Russell From kelvin.chu@uvm.edu Thu Jun 7 18:24:58 2001 From: kelvin.chu@uvm.edu (Kelvin Chu) Date: Thu, 7 Jun 2001 13:24:58 -0400 Subject: [Pythonmac-SIG] Filetypes. Message-ID: <20010607132458.A78430@elk.uvm.edu> Hello, all; I'm running Python-2.1 from the MacOSX terminal app, I just compiled the sources from ftp.python.org. Before you yell at me, this is because I want to use the ScientificPython package (which requires a C compiler and I'm not enough of a mench to learn how to do this...I just want to type 'python setup_all.py install' and have it work...). I've written a bunch of code now and it spits out a Unix two-column ascii file. This kind of file, however, is not readable by the Gnuplot application for MacOSX, which apparently is expecting Macintosh-type files. What's the difference between the two...and how do I write a mac-styled file using Python? Are there any special flags for open()? Thanks...learning slowly. -k -- kelvin.chu@uvm.edu (802) 656-0064 http://www.uvm.edu/~kchu/ FAX: (802) 656-0817 From jjb5@cornell.edu Thu Jun 7 18:37:10 2001 From: jjb5@cornell.edu (Joel Bender) Date: Thu, 7 Jun 2001 13:37:10 -0400 Subject: [Pythonmac-SIG] cross platform GUI? In-Reply-To: References: Message-ID: Humm...any chance that PyOpenGL [1] and GLUT [2] could converge? Just a happy thought... Joel [1] http://pyopengl.sourceforge.net/ [2] http://reality.sgi.com/opengl/glut3/glut3.html From guzdial@cc.gatech.edu Thu Jun 7 18:52:38 2001 From: guzdial@cc.gatech.edu (Mark Guzdial) Date: Thu, 7 Jun 2001 13:52:38 -0400 Subject: [Pythonmac-SIG] cross platform GUI? In-Reply-To: References: Message-ID: >>wxWindows on the Mac, I suspect, will turn out apps that look a lot like >>ported Windoze app. If I am right, this will not be a great option. Of course, there's always the option of developing with Squeak (http://www.squeak.org), then no matter what platform you use, it looks like a Mac :-) (At least, in MVC.) Mark -------------------------- Mark Guzdial : Georgia Tech : College of Computing : Atlanta, GA 30332-0280 Associate Professor - Learning Sciences & Technologies. Collaborative Software Lab - http://coweb.cc.gatech.edu/csl/ (404) 894-5618 : Fax (404) 894-0673 : guzdial@cc.gatech.edu http://www.cc.gatech.edu/gvu/people/Faculty/Mark.Guzdial.html From owen@astro.washington.edu Thu Jun 7 18:58:55 2001 From: owen@astro.washington.edu (Russell E Owen) Date: Thu, 7 Jun 2001 10:58:55 -0700 Subject: [Pythonmac-SIG] Filetypes. In-Reply-To: <20010607132458.A78430@elk.uvm.edu> References: <20010607132458.A78430@elk.uvm.edu> Message-ID: >Hello, all; > >I'm running Python-2.1 from the MacOSX terminal app, I just compiled the >sources from ftp.python.org. Before you yell at me, this is because I want >to use the ScientificPython package (which requires a C compiler and I'm >not enough of a mench to learn how to do this...I just want to type 'python >setup_all.py install' and have it work...). > >I've written a bunch of code now and it spits out a Unix two-column ascii >file. This kind of file, however, is not readable by the Gnuplot >application for MacOSX, which apparently is expecting Macintosh-type files. >What's the difference between the two...and how do I write a mac-styled >file using Python? Are there any special flags for open()? > >Thanks...learning slowly. unix files use \n (newline) as a end of line terminator, but mac files use \r (return). Mac OS X, being both operating systems, uses either depending on whether it's a Mac-like application or a unix-like appliction. (This may be vaguer than reality; I don't run Mac OS X yet). So apparently your python and gnuplot have different ideas about line ending. If possible, I'd rebuild whichever package is in the less desirable mode (or is easier to rebuild) so they both match, as it'd save a lot of headaches to have consistency. But it's certainly trivial to write files using any line ending you like. Just write out the data using write (or print with a final comma, to suppress the automatic line ending) and include "\n" or "\r" as desired. I think you may also need to open the file in binary mode (e.g. outfile = open(outfilename, "rb")), as otherwise you may get automatic line ending translation. If you're not sure which line endings a file has, one easy way to tell is to open the file in BBEdit. The mode will be listed in one of the pop-up menus at the top of the window, and will be Mac, unix or Windows. You can even change it and save the file to convert. Though if you have a lot of files to convert obviously writing a script or using a mass conversion file utility makes more sense. -- Russell From chrishbarker@home.net Thu Jun 7 19:27:41 2001 From: chrishbarker@home.net (Chris Barker) Date: Thu, 07 Jun 2001 11:27:41 -0700 Subject: [Pythonmac-SIG] Filetypes. References: <20010607132458.A78430@elk.uvm.edu> Message-ID: <3B1FC79D.ED5DF5E5@home.net> Russell E Owen wrote: > So apparently your python and gnuplot have different ideas about line > ending. If possible, I'd rebuild whichever package is in the less > desirable mode (or is easier to rebuild) so they both match, as it'd > save a lot of headaches to have consistency. That'd be great, but re-building GNUPLOT may not be so easy. IT would be worth checking out he GNUPLOT lists and see what people are doing on OS-X, someone may have done this. > But it's certainly trivial to write files using any line ending you > like. Just write out the data using write (or print with a final > comma, to suppress the automatic line ending) and include "\n" or > "\r" as desired. I think you may also need to open the file in binary > mode (e.g. outfile = open(outfilename, "rb")), as otherwise you may > get automatic line ending translation. Yes, you certainly do need to open it as a binary file. Text files do get line endings translated automatically. AS it happens, on writing, this means that "\n"s are converted, so if you write a file with no "\n"s (only "\r"s), then it should work fine, but it's really a good habit to open files as binary if you don't want linefeed translation (this has bitten me a few times) > > Are there any special flags for open()? well, no, but wouldn't that be nice! There was ssome discussion on this list and Python-dev about making Python text file reading transparent to what type of line endings the file has. It was decided that it would be a nice idea, but ot get performance, you would need to write some very low level code, so who knows if anyone will get around to it. I amy write a PEP about it if I get the chance. In the meantime, if you don't care about performance, I have written a pure Python module that allows you to do just what you want, open a text file for writing, and specify the type of line endings you want. It will also read Mac, DOS, or UNIX style text files for you transparently. The resulting file acts just like a regular file, so you can pass it to third party modules, etc. Let me know if you want it, I'll send you a copy. -Chris -- Christopher Barker, Ph.D. ChrisHBarker@home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From chrishbarker@home.net Thu Jun 7 21:46:03 2001 From: chrishbarker@home.net (Chris Barker) Date: Thu, 07 Jun 2001 13:46:03 -0700 Subject: [Pythonmac-SIG] Filetypes. References: <20010607132458.A78430@elk.uvm.edu> <3B1FC79D.ED5DF5E5@home.net> Message-ID: <3B1FE80B.6960D969@home.net> This is a multi-part message in MIME format. --------------E0064177D35E9C88A1FD94DB Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit "James B. Wilkinson" wrote: > > >In the meantime, if you don't care about performance, I have written a > >pure Python module that allows you to do just what you want, open a text > >file for writing, and specify the type of line endings you want. It will > >also read Mac, DOS, or UNIX style text files for you transparently. The > >resulting file acts just like a regular file, so you can pass it to > >third party modules, etc. > > > >Let me know if you want it, I'll send you a copy. > You bet! I'd love a copy. OK, I've enclosed it with this email. I wrote it on Linux, and have tested it on Windows, and there is no reason it shouldn't work on the Mac, but I havn't actually tested it there yet. If you have any problems, let me know. for your purposes, you would use: from TextFile import open ... file = open("yourfilename",'wt',LineEndingType = "Mac") file.write("A line of text\n") The "\n" will get translated to a "\r". Or pass the file object to whatever module is writing your files. -chris -- Christopher Barker, Ph.D. ChrisHBarker@home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ --------------E0064177D35E9C88A1FD94DB Content-Type: text/plain; charset=us-ascii; name="TextFile.py" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="TextFile.py" #!/usr/bin/env python """ TextFile.py : a module that provides a UniversalTextFile class, and a replacement for the native python "open" command that provides an interface to that class. It would usually be used as: from TextFile import open then you can use the new open just like the old one (with some added flags and arguments) or import TextFile file = TextFile.open(filename,flags,[bufsize], [LineEndingType], [LineBufferSize]) please send bug reports, helpful hints, and/or feature requests to: Chris Barker ChrisHBarker@home.net Copywrite/licence is the same as whatever version of python you are running. """ import os ## Re-map the open function _OrigOpen = open def open(filename,flags = "",bufsize = -1, LineEndingType = "", LineBufferSize = ""): """ A new open function, that returns a regular python file object for the old calls, and returns a new nifty universal text file when required. This works just like the regular open command, except that a new flag and a new parameter has been added. Call: file = open(filename,flags = "",bufsize = -1, LineEndingType = ""): - filename is the name of the file to be opened - flags is a string of one letter flags, the same as the standard open command, plus a "t" for universal text file. - - "b" means binary file, this returns the standard binary file object - - "t" means universal text file - - "r" for read only - - "w" for write. If there is both "w" and "t" than the user can specify a line ending type to be used with the LineEndingType parameter. - - "a" means append to existing file - bufsize specifies the buffer size to be used by the system. Same as the regular open function - LineEndingType is used only for writing (and appending) files, to specify a non-native line ending to be written. - - The options are: "native", "DOS", "Posix", "Unix", "Mac", or the characters themselves( "\r\n", etc. ). "native" will result in using the standard file object, which uses whatever is native for the system that python is running on. - LineBufferSize is the size of the buffer used to read data in a readline() operation. The default is currently set to 200 characters. If you will be reading files with many lines over 200 characters long, you should set this number to the largest expected line length. """ if "t" in flags: # this is a universal text file if ("w" in flags or "a" in flags) and LineEndingType == "native": return _OrigOpen(filename,flags.replace("t",""), bufsize) return UniversalTextFile(filename,flags,LineEndingType,LineBufferSize) else: # this is a regular old file return _OrigOpen(filename,flags,bufsize) class UniversalTextFile: """ A class that acts just like a python file object, but has a mode that allows the reading of arbitrary formated text files, i.e. with either Unix, DOS or Mac line endings. [\n , \r\n, or \r] To keep it truly universal, it checks for each of these line ending possibilities at every line, so it should work on a file with mixed endings as well. """ def __init__(self,filename,flags = "",LineEndingType = "native",LineBufferSize = ""): self._file = _OrigOpen(filename,flags.replace("t","")+"b") LineEndingType = LineEndingType.lower() if LineEndingType == "native": self.LineSep = os.linesep() elif LineEndingType == "dos": self.LineSep = "\r\n" elif LineEndingType == "posix" or LineEndingType == "unix" : self.LineSep = "\n" elif LineEndingType == "mac": self.LineSep = "\r" else: self.LineSep = LineEndingType ## some attributes self.closed = 0 self.mode = flags self.softspace = 0 if LineBufferSize: self._BufferSize = LineBufferSize else: self._BufferSize = 100 def readline(self): start_pos = self._file.tell() ##print "Current file posistion is:", start_pos line = "" TotalBytes = 0 Buffer = self._file.read(self._BufferSize) while Buffer: ##print "Buffer = ",repr(Buffer) newline_pos = Buffer.find("\n") return_pos = Buffer.find("\r") if return_pos == newline_pos-1 and return_pos >= 0: # we have a DOS line line = Buffer[:return_pos]+ "\n" TotalBytes = newline_pos+1 break elif ((return_pos < newline_pos) or newline_pos < 0 ) and return_pos >=0: # we have a Mac line line = Buffer[:return_pos]+ "\n" TotalBytes = return_pos+1 break elif newline_pos >= 0: # we have a Posix line line = Buffer[:newline_pos]+ "\n" TotalBytes = newline_pos+1 break else: # we need a larger buffer NewBuffer = self._file.read(self._BufferSize) if NewBuffer: Buffer = Buffer + NewBuffer else: # we are at the end of the file, without a line ending. self._file.seek(start_pos + len(Buffer)) return Buffer self._file.seek(start_pos + TotalBytes) return line def readlines(self,sizehint = None): """ readlines acts like the regular readlines, except that it understands any of the standard text file line endings ("\r\n", "\n", "\r"). If sizehint is used, it will read a a maximum of that many bytes. It will never round up, as the regular readline sometimes does. This means that if your buffer size is less than the length of the next line, you'll get an empty string, which could incorrectly be interpreted as the end of the file. """ if sizehint: Data = self._file.read(sizehint) else: Data = self._file.read() if len(Data) == sizehint: #print "The buffer is full" FullBuffer = 1 else: FullBuffer = 0 Data = Data.replace("\r\n","\n").replace("\r","\n") Lines = [line + "\n" for line in Data.split('\n')] ## If the last line is only a linefeed it is an extra line if Lines[-1] == "\n": del Lines[-1] ## if it isn't then the last line didn't have a linefeed, so we need to remove the one we put on. else: ## or it's the end of the buffer if FullBuffer: self._file.seek(-(len(Lines[-1])-1),1) # reset the file position del(Lines[-1]) else: Lines[-1] = Lines[-1][:-1] return Lines def readnumlines(self,NumLines = 1): """ readnumlines is an extension to the standard file object. It returns a list containing the number of lines that are requested. I have found this to be very useful, and allows me to avoid the many loops like: lines = [] for i in range(N): lines.append(file.readline()) Also, If I ever get around to writing this in C, it will provide a speed improvement. """ Lines = [] while len(Lines) < NumLines: Lines.append(self.readline()) return Lines def read(self,size = None): """ read acts like the regular read, except that it tranlates any of the standard text file line endings ("\r\n", "\n", "\r") into a "\n" If size is used, it will read a maximum of that many bytes, before translation. This means that if the line endings have more than one character, the size returned will be smaller. This could be fixed, but it didn't seem worth it. If you want that much control, use a binary file. """ if size: Data = self._file.read(size) else: Data = self._file.read() return Data.replace("\r\n","\n").replace("\r","\n") def write(self,string): """ write is just like the regular one, except that it uses the line separator specified when the file was opened for writing or appending. """ self._file.write(string.replace("\n",self.LineSep)) def writelines(self,list): for line in list: self.write(line) # The rest of the standard file methods mapped def close(self): self._file.close() self.closed = 1 def flush(self): self._file.flush() def fileno(self): return self._file.fileno() def seek(self,offset,whence = 0): self._file.seek(offset,whence) def tell(self): return self._file.tell() --------------E0064177D35E9C88A1FD94DB-- From chrishbarker@home.net Thu Jun 7 22:05:37 2001 From: chrishbarker@home.net (Chris Barker) Date: Thu, 07 Jun 2001 14:05:37 -0700 Subject: [Pythonmac-SIG] Wierd Error/Bug in MacPython 2.0 References: <20010607132458.A78430@elk.uvm.edu> Message-ID: <3B1FECA1.A0AF388D@home.net> I'm running MacPython 2.0 (#71, Oct 22 2000 ...) on OS-9.1 I have a script that loops through a very large number of large files (6.1 MB each), opens each one, reads it, does some NumPy crunching to it, closes it, does some other stuff, and then goes to the next file. It does this on batches of 500 files, and all that is in a loop so that it processes many batches. I'd love it if it could do ten or so batches. It works fine for a while, and then it dies with a : IOError: [Errno 1] Operation not permitted on the file.close() line. It seems pretty wierd to me that you could not have permission to close a file, but that is what happens. It happens after reading from a few hundred files to up to 4000 files (the longest run yet). It does seem to run longer when I'm not doing all the other stuff besides reading this file, but it's inconsistant enough that I'm not sure. I will continue to take out pieces of the code and try to narrow it down, but this is a long process because it does generally run for 10-24 hours before crashing. I really do need it to run a lot longer than that, however. If anyone has any insight/ideas as to what might be going on, what I could do about it, or how I could figure out what's up, please let me know. -thanks, -Chris -- Christopher Barker, Ph.D. ChrisHBarker@home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From jack@oratrix.nl Thu Jun 7 23:04:11 2001 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 08 Jun 2001 00:04:11 +0200 Subject: [Pythonmac-SIG] Wierd Error/Bug in MacPython 2.0 In-Reply-To: Message by Chris Barker , Thu, 07 Jun 2001 14:05:37 -0700 , <3B1FECA1.A0AF388D@home.net> Message-ID: <20010607220416.4A4D7DDDF1@oratrix.oratrix.nl> Recently, Chris Barker said: > I'm running MacPython 2.0 (#71, Oct 22 2000 ...) on OS-9.1 > > I have a script that loops through a very large number of large files > (6.1 MB each), opens each one, reads it, does some NumPy crunching to > it, closes it, does some other stuff, and then goes to the next file. It > does this on batches of 500 files, and all that is in a loop so that it > processes many batches. I'd love it if it could do ten or so batches. > > It works fine for a while, and then it dies with a : > > IOError: [Errno 1] Operation not permitted > > on the file.close() line. This look somewhat similar (but only somewhat) to a bug I occasionally see, but that has so far been too elusive to track down. If I copy really large numbers of files (for instance when I run the MkDistr script to create a distribution tree for MacPython) once in a while a copy will fail for no apparent reason. I think that what I get is an IOError: [Error 0] on a write, but I'm not 100% sure. I spent a couple of days trying to track down this bug, but as it is non-reproducible this wasn't a success. I now specifically test for this case and simply try the copy another time. This seems to mask the bug. This strategy may or may not work for you, but I'm also interested to hear whether other people are seeing similar problems. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From lmeyn@mail.arc.nasa.gov Thu Jun 7 23:15:27 2001 From: lmeyn@mail.arc.nasa.gov (Larry Meyn) Date: Thu, 7 Jun 2001 15:15:27 -0700 Subject: [Pythonmac-SIG] Wierd Error/Bug in MacPython 2.0 In-Reply-To: <20010607220416.4A4D7DDDF1@oratrix.oratrix.nl> References: <20010607220416.4A4D7DDDF1@oratrix.oratrix.nl> Message-ID: I recall a very similar error a couple of years ago with an AppleScript. Anything up to about 400 files worked fine. This may not not be a MacPython bug. >Recently, Chris Barker said: >> I'm running MacPython 2.0 (#71, Oct 22 2000 ...) on OS-9.1 >> >> I have a script that loops through a very large number of large files >> (6.1 MB each), opens each one, reads it, does some NumPy crunching to >> it, closes it, does some other stuff, and then goes to the next file. It >> does this on batches of 500 files, and all that is in a loop so that it >> processes many batches. I'd love it if it could do ten or so batches. >> >> It works fine for a while, and then it dies with a : >> >> IOError: [Errno 1] Operation not permitted >> >> on the file.close() line. > >This look somewhat similar (but only somewhat) to a bug I occasionally >see, but that has so far been too elusive to track down. If I copy >really large numbers of files (for instance when I run the MkDistr >script to create a distribution tree for MacPython) once in a while a >copy will fail for no apparent reason. I think that what I get is an >IOError: [Error 0] on a write, but I'm not 100% sure. > >I spent a couple of days trying to track down this bug, but as it is >non-reproducible this wasn't a success. I now specifically test for >this case and simply try the copy another time. This seems to mask the >bug. > >This strategy may or may not work for you, but I'm also interested to >hear whether other people are seeing similar problems. >-- >Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ >Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ >www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm > >_______________________________________________ >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 Phone: (650) 604-5038 NASA Ames Research Center FAX: (650) 604-0222 Moffett Field, CA 94035-1000 email: lmeyn@mail.arc.nasa.gov ------------------------------------------------------------------ From chrishbarker@home.net Thu Jun 7 23:56:52 2001 From: chrishbarker@home.net (Chris Barker) Date: Thu, 07 Jun 2001 15:56:52 -0700 Subject: [Pythonmac-SIG] Wierd Error/Bug in MacPython 2.0 References: <20010607220416.4A4D7DDDF1@oratrix.oratrix.nl> Message-ID: <3B2006B4.BE585797@home.net> Jack Jansen wrote: > I spent a couple of days trying to track down this bug, but as it is > non-reproducible this wasn't a success. I now specifically test for > this case and simply try the copy another time. This seems to mask the > bug. > > This strategy may or may not work for you, but I'm also interested to > hear whether other people are seeing similar problems. Are you suggesting I do: while not succesfull: try: file.close() except: succesfull = 0 time.sleep(10) else: succesfull = 1 Is there any chance that this would work? -Chris -- Christopher Barker, Ph.D. ChrisHBarker@home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From delza@alliances.org Fri Jun 8 09:40:07 2001 From: delza@alliances.org (Dethe Elza) Date: Fri, 08 Jun 2001 01:40:07 -0700 Subject: [Pythonmac-SIG] Difference between library and shared libray? Message-ID: I'm having trouble installing Snack under Python 2.0 (OS 9.1, G4). It is distributed as snack.shlb, while the rest of the python libs are *.slb. What is the difference and how do I get Python to recognize it? TIA -- Dethe Elza Chief Mad Scientist Burning Tiger Technologies From jack@oratrix.nl Fri Jun 8 09:43:24 2001 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 08 Jun 2001 10:43:24 +0200 Subject: [Pythonmac-SIG] Wierd Error/Bug in MacPython 2.0 In-Reply-To: Message by Chris Barker , Thu, 07 Jun 2001 15:56:52 -0700 , <3B2006B4.BE585797@home.net> Message-ID: <20010608084325.B5E3C3BCC9D@snelboot.oratrix.nl> I'd say just rerun the whole computation that generates the output file. The problem may have occurred earlier than the close() but may only become visible at that point. Look at MkDistr.py, it does something like try: copy(oldfile, newfile) except: try: i = 1 / 0 except: pass copy(oldfile, newfile) The second try/except is a trick to clear the stacktrace: it will still contain open file objects for the input and output file, and you want to get rid of them before trying again. I wouldn't do a "while 1:" because there are many reasons the thing could fail. If it fails for the silly-close-bug reason once every 400 times this code will make it fail only once very 16000 times, so that should be good enough. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From jack@oratrix.nl Fri Jun 8 10:07:22 2001 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 08 Jun 2001 11:07:22 +0200 Subject: [Pythonmac-SIG] Difference between library and shared libray? In-Reply-To: Message by Dethe Elza , Fri, 08 Jun 2001 01:40:07 -0700 , Message-ID: <20010608090723.9CA4C3BCC9D@snelboot.oratrix.nl> > I'm having trouble installing Snack under Python 2.0 (OS 9.1, G4). It is > distributed as snack.shlb, while the rest of the python libs are *.slb. > What is the difference and how do I get Python to recognize it? MacPython dynamically loadable modules are always called xxxx.ppc.slb (or xxxx.carbon.slb), so if something is distributed as snack.shlb it isn't a MacPython dynamically loadable module. What could well be (not sure, I've never heard of snack) is that snack.shlb is the underlying implementation library and that you somehow (distutils?) need to create the dynamically loadable module yourself (which will then link against snack.shlb to provide the functionality). As a comparison: Qt.ppc.slb is the MacPython QuickTime module. The actual implementation of QuickTime lives in "QuickTime" and "QuickTime PowerPlug" in your extensions folder, and Qt.ppc.slb links against that to provide the functionality to Python. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From delza@alliances.org Fri Jun 8 10:22:04 2001 From: delza@alliances.org (Dethe Elza) Date: Fri, 08 Jun 2001 02:22:04 -0700 Subject: [Pythonmac-SIG] Difference between library and shared libray? In-Reply-To: <20010608090723.9CA4C3BCC9D@snelboot.oratrix.nl> Message-ID: on 01/6/8 02:07 AM, Jack Jansen at jack@oratrix.nl wrote: > MacPython dynamically loadable modules are always called xxxx.ppc.slb (or > xxxx.carbon.slb), so if something is distributed as snack.shlb it isn't a > MacPython dynamically loadable module. > > What could well be (not sure, I've never heard of snack) is that snack.shlb is > the underlying implementation library and that you somehow (distutils?) need > to create the dynamically loadable module yourself (which will then link > against snack.shlb to provide the functionality). > > As a comparison: Qt.ppc.slb is the MacPython QuickTime module. The actual > implementation of QuickTime lives in "QuickTime" and "QuickTime PowerPlug" in > your extensions folder, and Qt.ppc.slb links against that to provide the > functionality to Python. Snack is a sound library for scripting languages. It builds against TCL, primarily, but has Python bindings. The instructions say to put it in the "Tool Control Language" folder in the Extensions, but I have no such folder. When I do a "get info" on the library it just says it's a library, but the icon is different from the other dynamically loaded libraries. I thought maybe you'd recognize it as a Carbon/Classic thing or something. The other programs which install *.shlb on my drive are Mozilla and ICQ. The Type is shlb and the creator is TcIL if that's any help. Snack homepage: http://www.speech.kth.se/snack/ > -- > Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ > Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ > www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm > > > -- Dethe Elza Chief Mad Scientist Burning Tiger Technologies From jack@oratrix.nl Fri Jun 8 12:34:49 2001 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 08 Jun 2001 13:34:49 +0200 Subject: [Pythonmac-SIG] Difference between library and shared libray? In-Reply-To: Message by Dethe Elza , Fri, 08 Jun 2001 02:22:04 -0700 , Message-ID: <20010608113449.CB2163BCC9D@snelboot.oratrix.nl> > Snack is a sound library for scripting languages. It builds against TCL, > primarily, but has Python bindings. The instructions say to put it in the > "Tool Control Language" folder in the Extensions, but I have no such folder. Ah, then I guess that what it really is is a Tcl extension, and the Python interface is a Python module that will use Tkinter to talk to it. Is that correct? I'm not sure whether Tcl extensions are usable from Tkinter with MacPython, because (as you have noticed) MacPython Tkinter doesn't use an external Tcl/Tk (as is the case on Unix/Windows) but has Tcl/Tk builtin. I would say: try to create the folder, drop the .shlb in there and see whether it works. BTW: if I remember correctly the folder name is "Tool Command Language", not "Control". If that doesn't work you could try adding a folder to the TCL equivalent of sys.path. You do this by opening _tkinter.ppc.slb in ResEdit, open STR# 128 "Tcl Environment Variables" and adding a string "TCLLIBPATH=Macintosh HD:folder:" and putting the .shlb in that folder. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From delza@alliances.org Fri Jun 8 17:29:26 2001 From: delza@alliances.org (Dethe Elza) Date: Fri, 08 Jun 2001 09:29:26 -0700 Subject: [Pythonmac-SIG] Difference between library and shared libray? In-Reply-To: <20010608113449.CB2163BCC9D@snelboot.oratrix.nl> Message-ID: on 01/6/8 04:34 AM, Jack Jansen at jack@oratrix.nl wrote: > >> Snack is a sound library for scripting languages. It builds against TCL, >> primarily, but has Python bindings. The instructions say to put it in the >> "Tool Control Language" folder in the Extensions, but I have no such folder. > > Ah, then I guess that what it really is is a Tcl extension, and the Python > interface is a Python module that will use Tkinter to talk to it. Is that > correct? > > I'm not sure whether Tcl extensions are usable from Tkinter with MacPython, > because (as you have noticed) MacPython Tkinter doesn't use an external Tcl/Tk > (as is the case on Unix/Windows) but has Tcl/Tk builtin. > > I would say: try to create the folder, drop the .shlb in there and see whether > it works. BTW: if I remember correctly the folder name is "Tool Command > Language", not "Control". Yes, you're right of course. My typo. > If that doesn't work you could try adding a folder to the TCL equivalent of > sys.path. You do this by opening _tkinter.ppc.slb in ResEdit, open STR# 128 > "Tcl Environment Variables" and adding a string "TCLLIBPATH=Macintosh > HD:folder:" and putting the .shlb in that folder. Thanks, I'll try that. -- Dethe Elza Chief Mad Scientist Burning Tiger Technologies From jschmitt@vmlabs.com Fri Jun 8 20:18:21 2001 From: jschmitt@vmlabs.com (John Schmitt) Date: Fri, 8 Jun 2001 12:18:21 -0700 Subject: [Pythonmac-SIG] PyOpenGL for OS X / OS 9? Message-ID: <4197FA5DD22AD5118ADE00805F6FA62F4533@eden.vmlabs.com> Has anyone tried to build PyOpenGL for the Mac? If not, what is involved in making that work? What about GLUT for Mac OS X? I can't find the link for Mesa for the Mac anymore. Any guesses about the OS X status for any of that? Thanks. John From sdm7g@Virginia.EDU Fri Jun 8 20:46:15 2001 From: sdm7g@Virginia.EDU (Steven D. Majewski) Date: Fri, 8 Jun 2001 15:46:15 -0400 (EDT) Subject: [Pythonmac-SIG] PyOpenGL for OS X / OS 9? In-Reply-To: <4197FA5DD22AD5118ADE00805F6FA62F4533@eden.vmlabs.com> Message-ID: On Fri, 8 Jun 2001, John Schmitt wrote: > Has anyone tried to build PyOpenGL for the Mac? If not, what is involved in > making that work? > > What about GLUT for Mac OS X? I can't find the link for Mesa for the Mac > anymore. Any guesses about the OS X status for any of that? Haven't tried to use it yet, but OSX comes with both OpenGL & GLUT : look in /System/Library/Frameworks/ You don't need Mesa for OSX, but it's been ported to Darwin: and I suppose that it would also work on OSX under X11. (I haven't tried this myself, either -- maybe after I install XFree86 4.1 ... ) I have no idea whether the OSX OpenGL can be made to work under X11. With the rootless X11 server under OSX/Aqua comming along, it would be nice if all the various configs could mix and match. -- Steve Majewski From chrishbarker@home.net Fri Jun 8 21:40:51 2001 From: chrishbarker@home.net (Chris Barker) Date: Fri, 08 Jun 2001 13:40:51 -0700 Subject: [Pythonmac-SIG] Wierd Error/Bug in MacPython 2.0 References: <20010608084325.B5E3C3BCC9D@snelboot.oratrix.nl> Message-ID: <3B213853.9FB57048@home.net> Jack Jansen wrote: > I'd say just rerun the whole computation that generates the output file. The > problem may have occurred earlier than the close() but may only become visible > at that point. Actually, it's reading an input file, but that makes little difference. Actually, the code around the file closing is pretty darn simple, it's essentially: file = open(filename,'rb') # open as a binary file for i in range(HeaderData['NumLines']): file.readline() data = fromstring(file.read(NumBytes*NumTimesteps*NumLEs),UnsignedInt8) file.close() So I'll try wrapping that in a try: except (or maybe the whole function this is in) > The second try/except is a trick to clear the stacktrace: it will still > contain open file objects for the input and output file, and you want to get > rid of them before trying again. hmmm. I don't quite understand this, but I'll take your word for it. > I wouldn't do a "while 1:" because there are many reasons the thing could > fail. If it fails for the silly-close-bug reason once every 400 times this > code will make it fail only once very 16000 times, so that should be good > enough. Good point. I may wrap it in a "for i in range(10):" to really reduce my odds! Thanks for your ideas, I'll give them a try. -Chris -- Christopher Barker, Ph.D. ChrisHBarker@home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From delza@alliances.org Sat Jun 9 00:29:56 2001 From: delza@alliances.org (Dethe Elza) Date: Fri, 08 Jun 2001 16:29:56 -0700 Subject: [Pythonmac-SIG] PyOpenGL for OS X / OS 9? In-Reply-To: <4197FA5DD22AD5118ADE00805F6FA62F4533@eden.vmlabs.com> Message-ID: VPython runs on the Mac (OS 9 at least) and it uses OpenGL (although not, I think, PyOpenGL). They may know what you need, though: http://virtualphoton.pc.cc.cmu.edu/projects/visual/ HTH --Dethe on 01/6/8 12:18 PM, John Schmitt at jschmitt@vmlabs.com wrote: > > Has anyone tried to build PyOpenGL for the Mac? If not, what is involved in > making that work? > > What about GLUT for Mac OS X? I can't find the link for Mesa for the Mac > anymore. Any guesses about the OS X status for any of that? > > Thanks. > > John > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- Dethe Elza Chief Mad Scientist Burning Tiger Technologies From stefan.witzgall@online.de Sun Jun 10 12:58:50 2001 From: stefan.witzgall@online.de (Stefan Witzgall) Date: Sun, 10 Jun 2001 13:58:50 +0200 Subject: [Pythonmac-SIG] IDE of MacPython 2.1 crashs in classic mode Message-ID: I don't know, if this came up earlier when MacPython 2.1 shipped in the final version, therefore my experiences. One hour ago I downloaded the full installer to my old 120MHz PPC running MacOS 8.1 and let him do his work. All did well, great! Works as expected, nearly ... .. I am running into trouble when MacPython is configured as Classic: The IDE does a traceback, the menu line goes away and it hangs up. A cmd-q then kills it and the Finder says that an error (forgive me, I don't remember if it was 1, 10, 11, ...) occured. I could make a screenshot of the traceback before the cmd-q (hmm, didn't try to copy and paste). The message from the IDE reads like this: -------------------------------------------------------------------------------- <> Traceback (most recent call last): File "programming_red:Python 2.1:Mac:Tools:IDE:PythonIDE.py", line 41, in ? import PythonIDEMain File "programming_red:Python 2.1:Mac:Tools:IDE:PythonIDEMain.py", line 3, in ? import Splash File "programming_red:Python 2.1:Mac:Tools:IDE:Splash.py", line 7, in ? import Qd, TE, Fm, sys ImportError: InterfaceLib--IsAntiAliasedTextEnabled: A fragment had "hard" unresolved imports. -------------------------------------------------------------------------------- This behavior is reproducable switching from classic to carbon and back. Does anyone know more about this, did I miss discussions on this issue? Stefan From jack@oratrix.nl Sun Jun 10 22:06:19 2001 From: jack@oratrix.nl (Jack Jansen) Date: Sun, 10 Jun 2001 23:06:19 +0200 Subject: [Pythonmac-SIG] IDE of MacPython 2.1 crashs in classic mode In-Reply-To: Message by Stefan Witzgall , Sun, 10 Jun 2001 13:58:50 +0200 , Message-ID: <20010610210624.68F51DDDF1@oratrix.oratrix.nl> Recently, Stefan Witzgall said: > Traceback (most recent call last): > File "programming_red:Python 2.1:Mac:Tools:IDE:PythonIDE.py", line > 41, in ? > import PythonIDEMain > File "programming_red:Python 2.1:Mac:Tools:IDE:PythonIDEMain.py", > line 3, in ? > import Splash > File "programming_red:Python 2.1:Mac:Tools:IDE:Splash.py", line 7, in ? > import Qd, TE, Fm, sys > ImportError: InterfaceLib--IsAntiAliasedTextEnabled: A fragment had "hard" > unresolved imports. Bah, bah, bah! This is a symbol that's part of Appearance, but it seems it isn't included in the version of apearance that ships with 8.1. I'll fix this for the 2.1.1 maintainance release. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From tom@othermedia.com Mon Jun 11 10:16:15 2001 From: tom@othermedia.com (tom smith) Date: Mon, 11 Jun 2001 10:16:15 +0100 Subject: [Pythonmac-SIG] Can't install even In-Reply-To: <20010610210624.68F51DDDF1@oratrix.oratrix.nl> Message-ID: I still haven't been able to properly install python. I've tried a number of times, and after each time my system has started showing weird behaviour needing a complete re-install. Sigh... tom From tom@othermedia.com Mon Jun 11 16:59:34 2001 From: tom@othermedia.com (tom smith) Date: Mon, 11 Jun 2001 16:59:34 +0100 Subject: [Pythonmac-SIG] Can't install even In-Reply-To: Message-ID: > I still haven't been able to properly install python. I've tried a number of > times, and after each time my system has started showing weird behaviour > needing a complete re-install. So I run the ConfigurePythonCarbon thingy, BUT, I check the "run in classic" chackbox and it manages to make the IDE and the interpreter. Although it does crash at the end whilst trying to alter PythonCGISlave.py And what do you know, the IDE runs. It complains of corrupt preferences, so I removed them from wherever I could find them...but now I can't find any preferences that have been created anywhere (where should they be?) So it's up and running, so why can't I... >>> import Tkinter Traceback (most recent call last): File "", line 1, in ? ImportError: No module named Tkinter Any ideas? Thanks tom From owen@astro.washington.edu Mon Jun 11 17:08:37 2001 From: owen@astro.washington.edu (Russell E Owen) Date: Mon, 11 Jun 2001 09:08:37 -0700 Subject: [Pythonmac-SIG] Can't install even In-Reply-To: References: Message-ID: On MacOS 9.1 (i.e. not X) you run ConfigurePythonClassic (not ConfigurePythonCarbon) if you want to use Tkinter. However, I'm puzzled, because I've never seen any checkbox in ConfigurePythonCarbon or ConfigurePythonClassic, they both just run. So I'm wondering what sort of installation you have. -- Russell > > I still haven't been able to properly install python. I've tried >a number of >> times, and after each time my system has started showing weird behaviour >> needing a complete re-install. > >So I run the ConfigurePythonCarbon thingy, BUT, I check the "run in classic" >chackbox and it manages to make the IDE and the interpreter. Although it >does crash at the end whilst trying to alter PythonCGISlave.py > >And what do you know, the IDE runs. It complains of corrupt preferences, so >I removed them from wherever I could find them...but now I can't find any >preferences that have been created anywhere (where should they be?) > >So it's up and running, so why can't I... > >>>> import Tkinter >Traceback (most recent call last): > File "", line 1, in ? >ImportError: No module named Tkinter > >Any ideas? From tom@othermedia.com Mon Jun 11 17:17:07 2001 From: tom@othermedia.com (tom smith) Date: Mon, 11 Jun 2001 17:17:07 +0100 Subject: [Pythonmac-SIG] Can't install even In-Reply-To: Message-ID: > On MacOS 9.1 (i.e. not X) you run ConfigurePythonClassic (not > ConfigurePythonCarbon) if you want to use Tkinter. > > However, I'm puzzled, because I've never seen any checkbox in > ConfigurePythonCarbon or ConfigurePythonClassic, they both just run. > So I'm wondering what sort of installation you have. Problematic. :-) The checkbox is in the Get Info box of the Application. I didn't know it was there either. I'm sorry this has probably been covered already..what's the timescale for Tkinter on OSX? Anytime soon? Or anyone have WxWindows in a user-friendly state. I'm having to look at Java in order to get a gui that isn't sucky...and I'm not the "typed" type... Cheers tom From dave@diddlysquat.f2s.com Tue Jun 12 04:32:45 2001 From: dave@diddlysquat.f2s.com (dave@diddlysquat.f2s.com) Date: Tue, 12 Jun 2001 03:32:45 +0000 (GMT) Subject: [Pythonmac-SIG] Using Python to edit resources... Message-ID: <992316765.3b258d5d54f9a@www.freedom2surf.net> This may have answered before, but it isn't obvious, so I'm going to take a chance and risk making a fool of myself for asking questions that have been answered a million times ;-). I am making a resource editor using Python and have come across a major block. I have no clue how to make Python edit the resource in question. I can get Python to display its handler location (0x45674, whatever). But I can't get it to display the actual data it contains (and then allow the user to edit it). Does anybody here know how to get Python to edit the data a resource holds? Thanks. Dave ------------------------------------------------- Everyone should have http://www.freedom2surf.net/ From dave@diddlysquat.f2s.com Tue Jun 12 04:32:57 2001 From: dave@diddlysquat.f2s.com (dave@diddlysquat.f2s.com) Date: Tue, 12 Jun 2001 03:32:57 +0000 (GMT) Subject: [Pythonmac-SIG] Using Python to edit resources... Message-ID: <992316777.3b258d69946b5@www.freedom2surf.net> This may have answered before, but it isn't obvious, so I'm going to take a chance and risk making a fool of myself for asking questions that have been answered a million times ;-). I am making a resource editor using Python and have come across a major block. I have no clue how to make Python edit the resource in question. I can get Python to display its handler location (0x45674, whatever). But I can't get it to display the actual data it contains (and then allow the user to edit it). Does anybody here know how to get Python to edit the data a resource holds? Thanks. Dave ------------------------------------------------- Everyone should have http://www.freedom2surf.net/ From dave@diddlysquat.f2s.com Tue Jun 12 04:32:54 2001 From: dave@diddlysquat.f2s.com (dave@diddlysquat.f2s.com) Date: Tue, 12 Jun 2001 03:32:54 +0000 (GMT) Subject: [Pythonmac-SIG] Using Python to edit resources... Message-ID: <992316774.3b258d662b72a@www.freedom2surf.net> This may have answered before, but it isn't obvious, so I'm going to take a chance and risk making a fool of myself for asking questions that have been answered a million times ;-). I am making a resource editor using Python and have come across a major block. I have no clue how to make Python edit the resource in question. I can get Python to display its handler location (0x45674, whatever). But I can't get it to display the actual data it contains (and then allow the user to edit it). Does anybody here know how to get Python to edit the data a resource holds? Thanks. Dave ------------------------------------------------- Everyone should have http://www.freedom2surf.net/ From dave@diddlysquat.f2s.com Tue Jun 12 04:32:58 2001 From: dave@diddlysquat.f2s.com (dave@diddlysquat.f2s.com) Date: Tue, 12 Jun 2001 03:32:58 +0000 (GMT) Subject: [Pythonmac-SIG] Using Python to edit resources... Message-ID: <992316778.3b258d6aeebf5@www.freedom2surf.net> This may have answered before, but it isn't obvious, so I'm going to take a chance and risk making a fool of myself for asking questions that have been answered a million times ;-). I am making a resource editor using Python and have come across a major block. I have no clue how to make Python edit the resource in question. I can get Python to display its handler location (0x45674, whatever). But I can't get it to display the actual data it contains (and then allow the user to edit it). Does anybody here know how to get Python to edit the data a resource holds? Thanks. Dave ------------------------------------------------- Everyone should have http://www.freedom2surf.net/ From dave@diddlysquat.f2s.com Tue Jun 12 04:33:09 2001 From: dave@diddlysquat.f2s.com (dave@diddlysquat.f2s.com) Date: Tue, 12 Jun 2001 03:33:09 +0000 (GMT) Subject: [Pythonmac-SIG] Using Python to edit resources... Message-ID: <992316789.3b258d75638fc@www.freedom2surf.net> This may have answered before, but it isn't obvious, so I'm going to take a chance and risk making a fool of myself for asking questions that have been answered a million times ;-). I am making a resource editor using Python and have come across a major block. I have no clue how to make Python edit the resource in question. I can get Python to display its handler location (0x45674, whatever). But I can't get it to display the actual data it contains (and then allow the user to edit it). Does anybody here know how to get Python to edit the data a resource holds? Thanks. Dave ------------------------------------------------- Everyone should have http://www.freedom2surf.net/ From dave@diddlysquat.f2s.com Tue Jun 12 04:33:10 2001 From: dave@diddlysquat.f2s.com (dave@diddlysquat.f2s.com) Date: Tue, 12 Jun 2001 03:33:10 +0000 (GMT) Subject: [Pythonmac-SIG] Using Python to edit resources... Message-ID: <992316790.3b258d7643d21@www.freedom2surf.net> This may have answered before, but it isn't obvious, so I'm going to take a chance and risk making a fool of myself for asking questions that have been answered a million times ;-). I am making a resource editor using Python and have come across a major block. I have no clue how to make Python edit the resource in question. I can get Python to display its handler location (0x45674, whatever). But I can't get it to display the actual data it contains (and then allow the user to edit it). Does anybody here know how to get Python to edit the data a resource holds? Thanks. Dave ------------------------------------------------- Everyone should have http://www.freedom2surf.net/ From draayer@surfglobal.net Tue Jun 12 08:02:10 2001 From: draayer@surfglobal.net (Dean Draayer) Date: Tue, 12 Jun 2001 03:02:10 -0400 Subject: [Pythonmac-SIG] Import errors when NOT using Navigation Services Message-ID: When the "Edit Preferences" checkbox for "Don't use NavServices for macfs calls" is checked, I am not getting old-style Open/Save dialogs. Instead, I am getting import errors. From the traceback, I get: from macfs import StandardGetFile ImportError: cannot import name StandardGetFile When the box is unchecked, there is no problem - NavServices dialogs work as expected. I am running Python 2.1 under MacOS 8.6. Is something broken here? Or is there something that am I missing in order to get old-style dialogs? Dean From just@letterror.com Tue Jun 12 09:26:52 2001 From: just@letterror.com (Just van Rossum) Date: Tue, 12 Jun 2001 10:26:52 +0200 Subject: [Pythonmac-SIG] from PIL import Image vs. import Image Message-ID: <20010612102657-r01010600-16248581@213.84.27.177> I see that in MacPython 2.1 the standard sys.path is configured for PIL so you have to do "import Image" instead of the now preferred "from PIL import Image". I suggest we change this for the next release. But should we allow both ways, or force people to update their programs to do "from PIL import Image"? I tend to go for the latter... Just From jack@oratrix.nl Tue Jun 12 14:37:01 2001 From: jack@oratrix.nl (Jack Jansen) Date: Tue, 12 Jun 2001 15:37:01 +0200 Subject: [Pythonmac-SIG] Can't install even In-Reply-To: Message by tom smith , Mon, 11 Jun 2001 17:17:07 +0100 , Message-ID: <20010612133702.964903BCC9D@snelboot.oratrix.nl> > > On MacOS 9.1 (i.e. not X) you run ConfigurePythonClassic (not > > ConfigurePythonCarbon) if you want to use Tkinter. > > > > However, I'm puzzled, because I've never seen any checkbox in > > ConfigurePythonCarbon or ConfigurePythonClassic, they both just run. > > So I'm wondering what sort of installation you have. > > Problematic. :-) The "run in classic" check box is in the get info window on OSX. However, for MacPython I think I wouldn't check it, because the libraries have all been installed in the "wrong" place. They're in the OSX native locations, like /Library/CFMSupport and not in the classic locations (like /System Folder/Extensions). Actually, nwo that I think of it I think that even Classic MacPython will not run very well under OSX, for this same reason. Although ConfigurePythonClassic may solve that problem all by itself, I'm not sure. Hmm, now that I think of it a bit more I think that maybe it _may_ work. It sort-of depends on how gestalt() and FindFolder() operate when they're run in the classic compatibily box. I'll try and find the time to do some investigations. But I'm really busy right now, so it may be a few days before I get around to it. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From Ben@widemedia.com Tue Jun 12 15:08:37 2001 From: Ben@widemedia.com (Ben Edwards) Date: Tue, 12 Jun 2001 15:08:37 +0100 Subject: [Pythonmac-SIG] ftplib performance Message-ID: I have a big performance problem with a script I have written using ftplib= on my Mac. When I use the storlines method of an ftp object, the file= transfers up to 50 times slower than via my ftp client, or a similar script= running on a Linux machine. I am assuming that this is due to the= cumulative overhead of passing loads of small transfers back and forth (if= I use storbinary, with 8k chunks, it goes much quicker), but it may be= because I've overlooked something. I am using Python 1.5.2 for this job because 2.1 seems to have another= problem with ftp: I get illegal port errors from the server which appears= to be unable to read my IP address correctly. tia for any advice, Ben From dano@brightfire.com Wed Jun 13 06:04:31 2001 From: dano@brightfire.com (Daniel Lord) Date: Tue, 12 Jun 2001 22:04:31 -0700 Subject: [Pythonmac-SIG] Tkinter on OSX works... In-Reply-To: Message-ID: <200106130504.BAA16650@repulse.cnchost.com> 0) You need and X Server (Tenon xTools or XFree86) installed--there is no Quartz/Aqua Tkinter support. If you can compile unix software and don't mind using opt-cmd-A to change between Aqua & X, Xfree86 CVS source is free. Xfree installation is not for the faint of heart. read about it here: http://mrcla.com/XonX/start.html. Otherwise, Tenon's commercial package is installable as a binary--simple and 'rootless' meaning it runs in a window under Aqua. It is pricey ($199) and more buggy with some X programs than XFree though. XFree works for me. 1) Be sure you have the Mac OSX tools installed since the next steps will require compilation and linking. 2) Go to http://www.scriptics.org and get tcl8.3.3 and tk 8.8.3 and build (./configure, make, make install). They worked fine for me on OSX 10.0.3. 3) Get the Python 2.1 sources and build it from source. Read the README They suggest: "Run configure with "OPT='-g -traditional-cpp' ./configure --with-suffix=.exe --with-dyld" . Well , since the shell is tcsh, this works better: set OPT='-g -traditional-cpp'; ./configure --with-dyld Trust me--you can leave out the --with-suffix=.exe, but the rest is important. NOTE: read the README on how to enable Tkinter. i.e Be sure to go into the Modules/Setup file and edit the tkinter lines to ensure Tkinter support is built. The README give details. DO this before compiling. I have done the above and have Tkinter running on OSX. Even Python MegaWidgets (Pmw) works! Now if I could just get Apple's Perl to see Tk.... On Tuesday, June 12, 2001, at 09:01 AM, pythonmac-sig-request@python.org wrote: > > I'm sorry this has probably been covered already..what's the timescale > for > Tkinter on OSX? Anytime soon? Or anyone have WxWindows in a > user-friendly > state. I'm having to look at Java in order to get a gui that isn't > sucky...and I'm not the "typed" type... > > Cheers > > tom > From jack@oratrix.nl Wed Jun 13 09:43:51 2001 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 13 Jun 2001 10:43:51 +0200 Subject: [Pythonmac-SIG] Import errors when NOT using Navigation Services In-Reply-To: Message by Dean Draayer , Tue, 12 Jun 2001 03:02:10 -0400 , Message-ID: <20010613084352.922EB303181@snelboot.oratrix.nl> > When the "Edit Preferences" checkbox for "Don't use NavServices for > macfs calls" is checked, I am not getting old-style Open/Save dialogs. > Instead, I am getting import errors. From the traceback, I get: > > from macfs import StandardGetFile > ImportError: cannot import name StandardGetFile Oops, under Carbon Python disabling navservices isn't an option, because there are no old style dialogs. I'll disable the option. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From moehl@akaflieg.extern.tu-berlin.de Wed Jun 13 18:52:14 2001 From: moehl@akaflieg.extern.tu-berlin.de (Torsten Sadowski) Date: Wed, 13 Jun 2001 19:52:14 +0200 (CEST) Subject: [Pythonmac-SIG] Partial success installing pyOpenGL Message-ID: I had a partial success in compiling pyOpenGL on the Mac. When running setup.py with the install option under Python 2.1 everything was fine=20 until compilation startet. Somehow not all required libraries are added=20 to the CW projects. Missing are: _opengl.mcp =09OpenGLLibraryStub =09 _opengl_num.mcp =09OpenGLLibraryStub _glu.mcp =09OpenGLLibraryStub =09OpenGLUtilityStub =09 _glu_num.mcp =09OpenGLLibraryStub =09OpenGLUtilityStub _glut.mcp =09OpenGLLibraryStub =09OpenGLUtilityStub =09glut.lib openglutil.mcp =09OpenGLLibraryStub =09OpenGLUtilityStub openglutil.mcp =09OpenGLLibraryStub =09OpenGLUtilityStub =09=09and something else because I had the following link error: =09=09 Link Error : undefined 'PyArray_API' (data) Referenced from 'contiguous_typed_array' in openglutil_num.c If anyone knows what else I have to link against I would appreciate any hint. I tried all numeric shared libs without success. Until now I didn=B4t get any demos to work. I still hope I am going to succeed sometime in the future. -Torsten From Benjamin.Schollnick@usa.xerox.com Wed Jun 13 19:10:05 2001 From: Benjamin.Schollnick@usa.xerox.com (Schollnick, Benjamin) Date: Wed, 13 Jun 2001 14:10:05 -0400 Subject: [Pythonmac-SIG] Automation on Mac OS X? Message-ID: We're using SilkTest / QA Partner here for reliability testing on our Mac machines, but since Segue doesn't support the Mac anymore we're slightly up the creek. I'm trying to find a way to automate the Mac, both keyboard & mouse control.... Beyond the limited (??) functionality of AppleScripting... For example, choosing PPD's in QuarkXpress or in Printer dialog windows.... But it really needs to support MAC OS X... I'm not aware of anyway to do this via Python, or at least an organized method to do this in Python.... Is there???? And if not, does anyone have any suggestions for alternatives? - Benjamin From fernstrom@geocities.com Wed Jun 13 23:04:09 2001 From: fernstrom@geocities.com (Christer =?iso-8859-1?Q?Fernstr=F6m?=) Date: Wed, 13 Jun 2001 23:04:09 +0100 Subject: [Pythonmac-SIG] print to console window very slow Message-ID: <3B27E355.47144AA@geocities.com> Printing to the console window is very slow, especially when the interpretor dumps out the execution stack after an exception. This takes more than a minute for the 15-20 lines! Anybody else having the same problem? christer From tom@othermedia.com Wed Jun 13 23:16:06 2001 From: tom@othermedia.com (tom smith) Date: Wed, 13 Jun 2001 23:16:06 +0100 Subject: [Pythonmac-SIG] Automation on Mac OS X? In-Reply-To: Message-ID: > But it really needs to support MAC OS X... > > I'm not aware of anyway to do this via Python, or at least an organized > method to do this in Python.... Is there???? > > And if not, does anyone have any suggestions for alternatives? I always used to use KeyQuencer. It was a bit strange but easy to install and could be controlled via AppleScript ( or I imagine python) I've no idea if it works with X but it's worth a whirl Cheers tom From hummelsean@mac.com Thu Jun 14 01:06:03 2001 From: hummelsean@mac.com (Sean Hummel) Date: Wed, 13 Jun 2001 17:06:03 -0700 Subject: [Pythonmac-SIG] Automation on Mac OS X? In-Reply-To: Message-ID: No doubt Apple has a mechanism for testing with MacOS X. on 6/13/01 11:10 AM, Schollnick, Benjamin at Benjamin.Schollnick@usa.xerox.com wrote: > We're using SilkTest / QA Partner here for reliability testing on our Mac > machines, but since Segue doesn't support the Mac anymore we're slightly up > the creek. > > I'm trying to find a way to automate the Mac, both keyboard & mouse > control.... Beyond the limited (??) functionality of AppleScripting... For > example, choosing PPD's in QuarkXpress or in Printer dialog windows.... > > But it really needs to support MAC OS X... > > I'm not aware of anyway to do this via Python, or at least an organized > method to do this in Python.... Is there???? > > And if not, does anyone have any suggestions for alternatives? > > - Benjamin > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From dave@diddlysquat.f2s.com Thu Jun 14 04:30:47 2001 From: dave@diddlysquat.f2s.com (dave@diddlysquat.f2s.com) Date: Thu, 14 Jun 2001 03:30:47 +0000 (GMT) Subject: [Pythonmac-SIG] Using Python to edit resources... In-Reply-To: <20010612134714.AFE7C3BCC9D@snelboot.oratrix.nl> References: <20010612134714.AFE7C3BCC9D@snelboot.oratrix.nl> Message-ID: <992489447.3b282fe7a9ce9@www.freedom2surf.net> Quoting Jack Jansen : > Well, you're already well underway to *asking* the question a million > times:-) Sorry, something screwed up :-(. If this sends 4 messages now, I should probably change email services. > > Look at the .data attribute: > h = Res.Get1Resource(.....) > print 'data as string:', h.data > > Accessing h.data does all the HLock() magic for you too, and you get a > copy of > the data. Assigning will work too. Thank you. That helps me _immensely_. I'll put it in my code as soon as possible. Dave ------------------------------------------------- Everyone should have http://www.freedom2surf.net/ From jack@oratrix.nl Thu Jun 14 14:18:28 2001 From: jack@oratrix.nl (Jack Jansen) Date: Thu, 14 Jun 2001 15:18:28 +0200 Subject: [Pythonmac-SIG] print to console window very slow In-Reply-To: Message by Christer =?iso-8859-1?Q?Fernstr=F6m?= , Wed, 13 Jun 2001 23:04:09 +0100 , <3B27E355.47144AA@geocities.com> Message-ID: <20010614131833.6D315F8C62@oratrix.oratrix.nl> Recently, Christer =?iso-8859-1?Q?Fernstr=F6m?= said: > Printing to the console window is very slow, especially when the > interpretor dumps out the execution stack after an exception. This takes > more than a minute for the 15-20 lines! Anybody else having the same > problem? Strange... Is printing to the console always slow, or only in specific cases? If it's only slow after a specific script crashes it could be that the script sets sys.stdout to unbuffered, that will definitely make output very slow. If it's a general problem maybe you should give us a little more information: Python version (including carbon/classic), OS version, machine type, etc. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From slk@sei.cmu.edu Thu Jun 14 19:17:33 2001 From: slk@sei.cmu.edu (Suresh L Konda) Date: Thu, 14 Jun 2001 14:17:33 -0400 Subject: [Pythonmac-SIG] where is xstat/rstat Message-ID: <3B28FFBD.A6907F72@sei.cmu.edu> Hello, While there is a reference to xstat/rstat (name differs between two versions of the ref. doc) in module os, I cannot find the actual method itself. Any help in finding it or a workaround would be much appreciated. Thanks. Suresh From jack@oratrix.nl Thu Jun 14 20:36:05 2001 From: jack@oratrix.nl (Jack Jansen) Date: Thu, 14 Jun 2001 21:36:05 +0200 Subject: [Pythonmac-SIG] where is xstat/rstat In-Reply-To: Message by Suresh L Konda , Thu, 14 Jun 2001 14:17:33 -0400 , <3B28FFBD.A6907F72@sei.cmu.edu> Message-ID: <20010614193610.D8222F8C62@oratrix.oratrix.nl> Recently, Suresh L Konda said: > Hello, > > While there is a reference to xstat/rstat (name differs between two > versions of the ref. doc) in module os, I cannot find the actual method > itself. Any help in finding it or a workaround would be much > appreciated. In the Carbon version it's gone, in the classic version of 2.1 it's still available. This is mentioned in the release notes. xstat() turned out to be difficult to implement for carbon, and the information that it provides as available through other methods as well. os.stat and macfs.FSSpec().GetCreatorType()... Hmm, the size of the resource fork is not so easy to determine, using MacOS.openrf() and seek()/tell() is the only way I can think of. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From fernstrom@geocities.com Thu Jun 14 23:21:29 2001 From: fernstrom@geocities.com (Christer Fernstrom) Date: Thu, 14 Jun 2001 23:21:29 +0100 Subject: [Pythonmac-SIG] print to console window very slow Message-ID: <3b292a193b30d906@antholoma.wanadoo.fr> (added by antholoma.wanadoo.fr) Actually, printing from the application is fine. It's the traceback that's really slow (watching it feels like watching an old movie where a policeman takes down a report on a typewriter with two fingers). Environment: Python 2.1, carbon, MacOs 8.5.1 (French). Since traceback writes to sys.stderr, then maybe it's sys.stderr that's unbuffered? And maybe for good reasons? christer ---------- >De=A0: Jack Jansen >=C0 : fernstrom@geocities.com >Cc : pythonmac-sig@python.org >Objet=A0: Re: [Pythonmac-SIG] print to console window very slow >Date=A0: Jeu 14 juin 2001 14:18 > > > Recently, Christer =3D?iso-8859-1?Q?Fernstr=3DF6m?=3D said: >> Printing to the console window is very slow, especially when the >> interpretor dumps out the execution stack after an exception. This takes >> more than a minute for the 15-20 lines! Anybody else having the same >> problem? > > Strange... Is printing to the console always slow, or only in specific > cases? If it's only slow after a specific script crashes it could be > that the script sets sys.stdout to unbuffered, that will definitely > make output very slow. > > If it's a general problem maybe you should give us a little more > information: Python version (including carbon/classic), OS version, > machine type, etc. > -- > Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ > Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig = ++++ > www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.= htm From JoeB@psscorp.com Fri Jun 15 04:47:30 2001 From: JoeB@psscorp.com (Joe Banko) Date: Thu, 14 Jun 2001 23:47:30 -0400 Subject: [Pythonmac-SIG] Automation on Mac OS X? Message-ID: There is also QuickKeys which is a little more robust and once you get by all the gotchas you can do some pretty nifty automation using QK/AppleScript which CAN talk to each other. I have OSX running and I'll take a look at whether QK runs under OSX on Monday. My daughter is graduating so I'm working from home on Friday and don't have the QK installers here. I'll post one way or another though.... joeb Coder and Color Co-ordinator PSS joeb@psscorp.com ps Take a look in Python 2.1:Mac:Contrib folder. There's an AE parser which might help as well as a couple of BBEdit extensions/plug-ins which are based on AppleScript and AE. I will say this, Python runs like a dream on OSX!!!!! Thanks Mr. Jansen..... -----Original Message----- From: tom smith [mailto:tom@othermedia.com] Sent: Wednesday, June 13, 2001 6:16 PM To: Schollnick, Benjamin; pythonmac-sig@python.org Subject: Re: [Pythonmac-SIG] Automation on Mac OS X? > But it really needs to support MAC OS X... > > I'm not aware of anyway to do this via Python, or at least an organized > method to do this in Python.... Is there???? > > And if not, does anyone have any suggestions for alternatives? I always used to use KeyQuencer. It was a bit strange but easy to install and could be controlled via AppleScript ( or I imagine python) I've no idea if it works with X but it's worth a whirl Cheers tom From JoeB@psscorp.com Fri Jun 15 05:10:25 2001 From: JoeB@psscorp.com (Joe Banko) Date: Fri, 15 Jun 2001 00:10:25 -0400 Subject: [Pythonmac-SIG] Python, Oracle and the Mac Message-ID: All, I am like a newborn babe with Python (first saw it about a week ago), and I like it a lot. Although a Machead my company develops advertising agency software in a 4GL which runs on multiple platforms (Win, Mac, Linux). The backend is Oracle 8 and we will soon be moving to 9. We need to import data into our system from a lot of different sources and the data tends to be LARGE, 100-300MB. I've written some of the data parsers for importing and they are SLOW in the 4GL. 10M file is about 6 minutes to process before import. I rewrote the same parser in Python and it's down to 15 seconds. The output from Python is a SQL loader .dat file. I'd get big points if I could get the whole import process running as a server process under Python, of course. I have seen a Oracle/Python module/object api which is supposed to work on a Windows or Unix platform. Does anyone know of something similar on the Mac OR has an idea of how to compile the Unix source to run under OSX? I'll be using Codewarrior for OSX which is due to ship any day. Also for Mac/Win/Linux. Thanks.... Joe B Coder & Color Co-ordinator Professional Software Systems joeb@psscorp.com From deirdre@deirdre.net Fri Jun 15 06:01:58 2001 From: deirdre@deirdre.net (Deirdre Saoirse Moen) Date: Thu, 14 Jun 2001 22:01:58 -0700 Subject: [Pythonmac-SIG] Python, Oracle and the Mac In-Reply-To: References: Message-ID: >I am like a newborn babe with Python (first saw it about a week ago), and I >like it a lot. Although a Machead my company develops advertising agency >software in a 4GL which runs on multiple platforms (Win, Mac, Linux). The >backend is Oracle 8 and we will soon be moving to 9. We need to import data >into our system from a lot of different sources and the data tends to be >LARGE, 100-300MB. I've written some of the data parsers for importing and >they are SLOW in the 4GL. 10M file is about 6 minutes to process before >import. I rewrote the same parser in Python and it's down to 15 seconds. The >output from Python is a SQL loader .dat file. I'd get big points if I could >get the whole import process running as a server process under Python, of >course. I have seen a Oracle/Python module/object api which is supposed to >work on a Windows or Unix platform. Which one are you referring to? >Does anyone know of something similar >on the Mac OR has an idea of how to compile the Unix source to run under >OSX? I'll be using Codewarrior for OSX which is due to ship any day. Also >for Mac/Win/Linux. While I'm a database person, I don't know much about the current state of Oracle on the Mac (last I used it was when they shipped a PowerPC version of Oracle; that's been AGES). You can probably try the source on gcc if you've installed the development tools, but the limiting factor is the client libraries. Normally, when you compile oracle support (at least for PHP and I recall the same issue with Python), you have oracle client stuff installed. Does that even exist for MacOS X? -- _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net "Cannot run out of time.... Is infinite time. You... are finite.... Zathrus... is finite. This... is wrong tool!" -- Zathrus From jack@oratrix.nl Fri Jun 15 09:02:17 2001 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 15 Jun 2001 10:02:17 +0200 Subject: [Pythonmac-SIG] Python, Oracle and the Mac In-Reply-To: Message by Joe Banko , Fri, 15 Jun 2001 00:10:25 -0400 , Message-ID: <20010615080312.58EE5F8C62@oratrix.oratrix.nl> If you're only interested in MacOSX you shouldn't have any problem if the module runs on Unix: MacOSX is unix. At least: it is from a unix-Python point of view (from MacPython's point of view MacOSX is a Mac), but unix-Python would be the logical choice for something like this anyway. And even if you'd want to run this on OS9: something that works on Unix and Windows will probably work on the Mac too. -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From ntiffin@earthlink.net Fri Jun 15 12:38:36 2001 From: ntiffin@earthlink.net (Neil Tiffin) Date: Fri, 15 Jun 2001 06:38:36 -0500 Subject: [Pythonmac-SIG] Python, Oracle and the Mac In-Reply-To: References: Message-ID: Joe, I am not sure how we did it. But we have a 2 tier (not mac yet) client server system that uses python for UI and works with several SQL backends including DB2, Oracle, MySQL and PostgreSQL. We have a person experienced with using Oracle with for our Python Code. So you might want to join us on IRC at irc.openprojects.net channel #gnuenterprise and either Jason or Jamest might be able to help you with the optimization/Python question. Neil Tiffin GNU Enterprise http://www.gnue.org neilt@gnue.org At 12:10 AM -0400 6/15/01, Joe Banko wrote: >All, > >I am like a newborn babe with Python (first saw it about a week ago), and I >like it a lot. Although a Machead my company develops advertising agency >software in a 4GL which runs on multiple platforms (Win, Mac, Linux). The >backend is Oracle 8 and we will soon be moving to 9. We need to import data >into our system from a lot of different sources and the data tends to be >LARGE, 100-300MB. I've written some of the data parsers for importing and >they are SLOW in the 4GL. 10M file is about 6 minutes to process before >import. I rewrote the same parser in Python and it's down to 15 seconds. The >output from Python is a SQL loader .dat file. I'd get big points if I could >get the whole import process running as a server process under Python, of >course. I have seen a Oracle/Python module/object api which is supposed to >work on a Windows or Unix platform. Does anyone know of something similar >on the Mac OR has an idea of how to compile the Unix source to run under >OSX? I'll be using Codewarrior for OSX which is due to ship any day. Also >for Mac/Win/Linux. > >Thanks.... > >Joe B >Coder & Color Co-ordinator >Professional Software Systems >joeb@psscorp.com > >_______________________________________________ >Pythonmac-SIG maillist - Pythonmac-SIG@python.org >http://mail.python.org/mailman/listinfo/pythonmac-sig From jlegg@acs.wooster.edu Fri Jun 15 13:27:38 2001 From: jlegg@acs.wooster.edu (jlegg@acs.wooster.edu) Date: Fri, 15 Jun 2001 08:27:38 -0400 (EDT) Subject: [Pythonmac-SIG] macostools.copytree() problems... Message-ID: I'm working on a python program to do automatic backups of specific folders/files to a Novell server. I'm using macostools.copytree() to do the actual file copying but I'm having a very hard time. Why, when I do: s = 'System:System Folder' d = 'NOVELL_SERVER:Home:User:Whatever' macostools.copytree(s, d) Everything works fine, all files copy and folder structure is recreated. However, I want to add extensibility to my program by being able to read in a list of folders/files to backup from a file. I do: f=open('backuplist', 'r+') str_list = f.readlines() backup_folder = 'NOVELL_SERVER:Home:User:Whatever' for s in str_list: s = re.sub('\n', '', s) if os.path.isdir(s): d = backup_folder + ':' + s # The above is just to recreate my HDD folder structure macostools.copytree(s, d) This does not work on any mac I've tried it on. I've suspected it may have something to do with the way I get rid of '\n' from each line in the file, or maybe that I'm missing some other special characters that are causing weird behaviors? Or perhaps my re.sub() is adding something? The error I get is as follows: File "system:applications:python 2.1:mac:lib:macostools.py", line 126, in copytree copy(src, dst, 1, copydates) File "system:applications:python 2.1:mac:lib:macostools.py", line 107, in copy df = dstfss.GetFInfo() Mac OS Error: (-43, 'File not found') It does not matter if I use different folders, adding ':' to the end of my folder names, etc. I've tried each and with the same results. copytree() does crash when it encounters a broken alias with this similar message but I am sure this is not the case here. I've also on occasion observed this same message with a file name, the first file in the folder I was trying to copy, and it was a *file* called 'Adobe Prefs' but the error message produced 'Adobe Prefs:' ?? Anyone have ideas? From jack@oratrix.nl Fri Jun 15 14:00:42 2001 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 15 Jun 2001 15:00:42 +0200 Subject: [Pythonmac-SIG] macostools.copytree() problems... In-Reply-To: Message by jlegg@acs.wooster.edu , Fri, 15 Jun 2001 08:27:38 -0400 (EDT) , Message-ID: <20010615130042.0D6ADF8C62@oratrix.oratrix.nl> After looking at this for a long time I think I have a possible solution. If NOVELL_SERVER:Home:User:Whatever exists, and let's say for sake of argument that there's nothing in there at the moment, then it's OK to copy something into NOVELL_SERVER:Home:User:Whatever:bla but it is NOT ok to copy something into NOVELL_SERVER:Home:User:Whatever:bla:bletch. Or, in other words: copytree will create the destination but it will not create the whole path leading up to the destination. You can use mkdirs to do this, something like this just before the copytree call: parent_d = os.path.split(d)[0] macostools.mkdirs(parent_d) But note that this is all from just thinking about the problem a bit, so it could be wildly off. PS: here's a tip: if you run this thing under the IDE you get a chance to inspect the variables after the crash. If you can't run under the IDE for some reason: