From prastawa@cs.unc.edu Fri Feb 1 00:21:54 2002 From: prastawa@cs.unc.edu (Marcel Prastawa) Date: Thu, 31 Jan 2002 19:21:54 -0500 Subject: [Pythonmac-SIG] dynload_darwin.c In-Reply-To: Message-ID: On Wednesday, January 30, 2002, at 06:05 , Steven Majewski wrote: > Could some of the folks who are having problems give this one a > try ? It's named dynload_darwin.c because we'll probably change > it and the config files for the next release. You need to > rename it dynload_next.c and stick it in Python-2.2/Python to > replace the old dynload_next.c It works! Well, for what I have at least. I did get the warning messages... This happens when I load a module with the same name: "... _init_foo already defined". It's not an issue for me, but maybe there's a way to suppress this? Marcel From jack@oratrix.com Fri Feb 1 13:58:22 2002 From: jack@oratrix.com (Jack Jansen) Date: Fri, 1 Feb 2002 14:58:22 +0100 Subject: [Pythonmac-SIG] SIOUX Console ( was sys.exit ) In-Reply-To: Message-ID: On Thursday, January 31, 2002, at 11:35 , Alexandre Parenteau wrote: >> What platform? Could you create a dummy embedding app that shows >> the problem so I can have a look? > > It was fixed after 2.2. You incorporated the fix inside > GUSISIOUXSocket::GUSISIOUXSocket, remember ? Ah, so that's what I fixed:-) I was just doing what you told me, -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From jack@oratrix.com Fri Feb 1 14:05:32 2002 From: jack@oratrix.com (Jack Jansen) Date: Fri, 1 Feb 2002 15:05:32 +0100 Subject: [Pythonmac-SIG] SIOUX Console ( was sys.exit ) In-Reply-To: Message-ID: On Thursday, January 31, 2002, at 11:37 , Alexandre Parenteau wrote: > Jack, > >> On Wednesday, January 30, 2002, at 06:42 PM, Alexandre Parenteau >> wrote: >>> [unrelated] Jack, I understand why you put it inside #ifdef >>> USE_GUSI2 but it >>> forces us to have the GUSI2 header externally, whereas in >>> theory we would >>> not have to use GUSI in order to use for the Python SDK. >> >> You'll have to explain what you mean here, "forces us to have >> the GUSI2 header externally". > > Let say I want to use MacPython embedded in an application Y. When I > compile > Y, I don't have necessarily to use GUSI 1 or 2. I can use MSL instead or > anything else (it is not completely true because if I end-up using > another > C-library for Y, I may not be able to pass a FILE object to Python). This is very dangerous. You must make absolutely sure that MSL is linked before PythonCore, and that there's no way your hosting program can ever satisfy a reference to an external from the GUSI-enabled MSL in PythonCore, or very bad things will happen. >>> [unrelated] About a SDK, I regret we don't have PEF stub library and a >>> dedicated folder that we could copy at once to write >>> components. Something >>> like Python2.2/SDF/Headers, Python2.2/SDF/Headers/Mac, >>> Python2.2/SDF/Libraries, Python2.2/SDF/Resources. >> >> Again, you have to explain, I understand neither what you're >> trying to accomplish, nor how:-) > > I try to still embed MacPython in the application Y. I like to embed, > it's > me... :-) > > I'd like to have a MacPython SDK folder. If I'm interested only in > making > compiled components to Python, it is handy to get the minimal set of > Headers > and Libraries for doing so. Having a stub library is part of the "nice" > thing. If I understand this correctly the only thing needed, aside from what is installed by the "developer" option in the installer already, is a PythonCore.lib stub library, right? That should be reasonably simple: an extra "stub library" project in PythonCore.prj should do the trick. An advantage of this might be that we could possibly also create a PythonCoreNoMSL.lib stub library which is the same stub library but with all MSL symbols removed. This would make life easier for the case where you want to embed Python into a non-GUSI application. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From stefan.witzgall@online.de Fri Feb 1 19:00:30 2002 From: stefan.witzgall@online.de (Stefan Witzgall) Date: Fri, 1 Feb 2002 20:00:30 +0100 Subject: [Pythonmac-SIG] Re: OzTeX 5 final approaching so... Message-ID: Andrew, you were asked about the shipping date and contents of the OzTeX- CD. [...] >Sure, if people want to pre-order the OzTeX 5 CD then just go to >the order page and put something like "wait for OzTeX 5" in the >comment box. Late March is my best guesstimate for when the >new CD will be ready. > >Andrew I want to ask another question: As a German user of OzTeX is it possible to get it here? Or should I beg you to send it to me? How should I pay for it then? My shareware fee I sent cash, wrapped in some paper. You told me you got it :) Stefan From csmith@blakeschool.org Fri Feb 1 22:26:47 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Fri, 01 Feb 2002 16:26:47 -0600 Subject: [Pythonmac-SIG] sitecustomize and pythonstartup In-Reply-To: References: Message-ID: I've been trying to learn what behaviors can be automated at start up and have come up with the following which might be useful for others. Corrections are welcome. It also raises a question that I ask below. --- _____ A script can import user which will run the script ".pythonrc.py" if it exists in the same directory as the script. Objects in .pythonrc.py (imported modules, function definitions, or variables) are accessible to the calling script by using the "user." prefix. For example, if math has been loaded in .pythonrc.py, the main program can access math.pi as user.math.pi {see user.py} _____ The Python IDE will attempt to load a file named sitecustomize.pyc if it exists on the paths defined by sys.path. No objects therein (modules, functions, variables) are accessible to the IDE interactive console or scripts, but changes to variables like sys.path can be made. If there is any printing done in the file, this will create a window titled "Python IDE.out" which can be moved and resized but not closed. {see site.py and the file sitecustomize.py} _____ The Python Interpreter will attempt to run the sitecustomize.pyc script if it exists on the paths defined by sys.path. No objects therein (modules, functions, variables) are accessible to the IDE interactive console or scripts. The Interpreter will also attempt to import and run the contents of a file named PythonStartup if it exists on in the same directory as the interpreter. Objects in PythonStartup are then accessible directly to the interpreter (e.g. if "import math" appears in PythonStartup then typing "math.pi" in the interpreter will yield the value of pi). Commands like "from __future__ import division" will not affect the Interpreter, however, and must be reimported there. If PythonStartup imports a module A which in turn imports a module B, B's namespace must be accessed as A.B.name. {see section "Interactive startup file" in the using.html file in the Mac:Demo folder. ------- OK, the question is this. The interpreter can be educated as to what modules are loaded (i.e. if pythonstartup imports math, you can type math.pi in the interpreter and be understood). Is there a way to get this to happen in the IDE's interpreter as well? If sitecustomize.py imports math I can't seem to access that at the >>> prompt. Also, is there a way to get "from __future__ import division" to be the default behavior in the interpreter? This statement in the startup file does not create the floating integer behavior in the IDE's interpreter or in the Python Interpreter itself. /c From dyoo@hkn.eecs.berkeley.edu Fri Feb 1 22:41:33 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Fri, 1 Feb 2002 14:41:33 -0800 (PST) Subject: [Pythonmac-SIG] Re: [Tutor] sitecustomize and pythonstartup In-Reply-To: Message-ID: On Fri, 1 Feb 2002, Christopher Smith wrote: > OK, the question is this. The interpreter can be educated as to what > modules are loaded (i.e. if pythonstartup imports math, you can type > math.pi in the interpreter and be understood). Is there a way to get > this to happen in the IDE's interpreter as well? If sitecustomize.py > imports math I can't seem to access that at the >>> prompt. Yes, it's possible. If we add the following fragment to our sitecustomize.py: ### import math import __builtin__ __builtin__.math = math del math ### then the math module will magically turn on for all new interactive sessions. Pretty convenient! *grin* At least, this works from a regular interpreter window; I'm not quite so sure if this will work with all IDE's. From csmith@blakeschool.org Fri Feb 1 22:54:14 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Fri, 01 Feb 2002 16:54:14 -0600 Subject: [Pythonmac-SIG] reset and IDE Message-ID: Now that I have started teaching Python in school, I can see that I would really like it if the IDE would automatically flush out the namespace so that all functions and modules would be reloaded when a script is re-run. A "reset" script was offered during the 2001 summer by Jesse W on the tutor list and I use it regularly myself but would love to have this be the automatic behavior when the "Run All" button is pressed in the IDE. Here is the script: def reset(namespace, user_safe_items=()): """Reset given namespace to a "pristine" state. This is a widely requested function which will remove from the current namespace everything execpt the items listed in below.""" safe_items=['__builtins__', '__doc__', '__name__', 'reset']\ +list(user_safe_items) for item in namespace.keys(): if item not in safe_items: exec ("del "+item) in namespace When running this from a script I just type "reset(vars())" at the top of the program to avert having functions that I have changed not be read as changed by Python. A couple questions here: 1) If I wanted to build a copy of the IDE with this as the default behavior, where do I have to insert this code? (I was unable to find where a press on the "Run All" button takes you in terms of program flow.) 2) Instead of wiping out the whole namespace, might another productive approach be to keep track of dirty modules and reload them. But hmm...if someone were using a different editor to edit the files then there would be no way of knowing that those modules had changed. But if someone only used the IDE for development, then this would be feasible. Every time a module is opened and edited, its name would be added to the list of dirty modules. Then, when a script is to be executed, the names of all dirty modules would be deleted from that script's namespace if they exist *and then* normally running of the script would occur. Something like: RunAll is pressed on script with namespace = "foo" for item in dirty: exec ("del "+item) in foo Do normal action that RunAll would do Is this feasible somewhere in the Python code for the IDE? /c From Jack.Jansen@oratrix.nl Fri Feb 1 23:16:44 2002 From: Jack.Jansen@oratrix.nl (Jack Jansen) Date: Sat, 2 Feb 2002 00:16:44 +0100 Subject: [Pythonmac-SIG] sitecustomize and pythonstartup In-Reply-To: Message-ID: There's some good info in your piece, I would really like it if it could be turned into something (customizing.html?) that could go into the documentation at some point. Some comments: On Friday, February 1, 2002, at 11:26 PM, Christopher Smith wrote: > I've been trying to learn what behaviors can be automated at > start up and > have come up with the following which might be useful for others. > Corrections are welcome. It also raises a question that I ask below. > > --- > > _____ > A script can > > import user > > which will run the script ".pythonrc.py" if it exists in the same > directory as the script. Objects in .pythonrc.py (imported modules, > function definitions, or variables) are accessible to the > calling script > by using the "user." prefix. For example, if math has been loaded in > .pythonrc.py, the main program can access math.pi as user.math.pi {see > user.py} > > _____ > The Python IDE will attempt to load a file named > sitecustomize.pyc if it > exists on the paths defined by sys.path. No objects therein (modules, > functions, variables) are accessible to the IDE interactive console or > scripts, but changes to variables like sys.path can be made. If > there is > any printing done in the file, this will create a window titled "Python > IDE.out" which can be moved and resized but not closed. {see > site.py and > the file sitecustomize.py} Actually sitecustomize.py works just as well as .pyc. The sitecustomize module is simply imported (by site.py, which is in it's turn "magically" imported during startup of every interpreter, interactive, running a script or applet (such as IDE). The bit about the Python IDE.out window is a bug, really: sitecustomize is imported before the IDE is running, so the output is going to the "normal" PythonInterpreter output window, which is normally suppressed. Unfortunately it is a bug that is difficult to fix (because fixing it would mean that IDE crashes resulted in no stack trace). > _____ > The Python Interpreter will attempt to run the > sitecustomize.pyc script if > it exists on the paths defined by sys.path. No objects therein > (modules, > functions, variables) are accessible to the IDE interactive console or > scripts. > > The Interpreter will also attempt to import and run the > contents of a file > named PythonStartup if it exists on in the same directory as the > interpreter. Objects in PythonStartup are then accessible > directly to the > interpreter (e.g. if "import math" appears in PythonStartup then typing > "math.pi" in the interpreter will yield the value of pi). > Commands like > "from __future__ import division" will not affect the Interpreter, > however, and must be reimported there. If PythonStartup > imports a module > A which in turn imports a module B, B's namespace must be accessed as > A.B.name. {see section "Interactive startup file" in the > using.html file > in the Mac:Demo folder. > > > > > ------- > > OK, the question is this. The interpreter can be educated as to what > modules are loaded (i.e. if pythonstartup imports math, you can type > math.pi in the interpreter and be understood). Is there a way > to get this > to happen in the IDE's interpreter as well? If > sitecustomize.py imports > math I can't seem to access that at the >>> prompt. This would be A Good Thing. Maybe you can submit it as a feature request in the sourceforge tracker? You can assign it to jvr, which is Just:-) > Also, is there a way to get "from __future__ import division" to be the > default behavior in the interpreter? This statement in the > startup file > does not create the floating integer behavior in the IDE's > interpreter or > in the Python Interpreter itself. Hmm, I there may be a good reason for this, but it might also be an oversight. You definitely don't want to enable it globally (as this would break lots of standard modules) but I can't think of a reason why it can't be enabled for the interactive interpreter in PythonStartup (or the unix-equivalent PYTHONSTARTUP environment variable). Maybe submit this as a feature request (or bug report) too? I'm not sure who you should assign this to, probably Guido. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From Jack.Jansen@oratrix.nl Fri Feb 1 23:18:11 2002 From: Jack.Jansen@oratrix.nl (Jack Jansen) Date: Sat, 2 Feb 2002 00:18:11 +0100 Subject: [Pythonmac-SIG] Re: [Tutor] sitecustomize and pythonstartup In-Reply-To: Message-ID: On Friday, February 1, 2002, at 11:41 PM, Danny Yoo wrote: > On Fri, 1 Feb 2002, Christopher Smith wrote: > >> OK, the question is this. The interpreter can be educated as to what >> modules are loaded (i.e. if pythonstartup imports math, you can type >> math.pi in the interpreter and be understood). Is there a way to get >> this to happen in the IDE's interpreter as well? If sitecustomize.py >> imports math I can't seem to access that at the >>> prompt. > > Yes, it's possible. If we add the following fragment to our > sitecustomize.py: > > ### > import math > import __builtin__ > __builtin__.math = math > del math > ### But this will not only make it show up in interactive interpreters, it will also make it show up globally, in every module. I'm not sure this is a good idea... -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From Jack.Jansen@oratrix.nl Fri Feb 1 23:34:51 2002 From: Jack.Jansen@oratrix.nl (Jack Jansen) Date: Sat, 2 Feb 2002 00:34:51 +0100 Subject: [Pythonmac-SIG] Patch to enable sys.setdlopenflags() on MacOSX Message-ID: <49FC9AC9-176C-11D6-9B87-003065517236@oratrix.nl> I put a patch on sourceforge, #511962, which enables sys.setdlopenflags() on MacOSX. The only values you can pass are 0 (the default, dynamic modules are each loaded into their own private symbol namespace) and 0x100 (modules are loaded into the process' global symbol namespace, so they can refer to eah other's symbols). As the API is compatible with Linux I hope this solves the problem of the people who want a global namespace, could they please apply the patch and see whether it works? As I myself think this is a hack upon a hack, could people with Strong Opinions (you know who you are:-) please tell (a) me to commit the patch, (b) me to change the patch, or (c) the people addressed in the previous paragraph to not do what they're doing:-) -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From mmiller@adobe.com Sat Feb 2 02:35:58 2002 From: mmiller@adobe.com (Martin Miller) Date: Fri, 01 Feb 2002 18:35:58 -0800 Subject: [Pythonmac-SIG] C Extension Modules and GUSI References: Message-ID: <3C5B508E.EFF7429E@adobe.com> I understand that the MacPython interpreter uses the GUSI 2 headers and library created by Matthias Neeracher. My question is: Is it necessary to use the GUSI headers when building C Extension modules that will become dynamically-linked shared libraries. One reason I ask is because the GUSI 2 documentation talks about putting the GUSI include folder in front of all other system include access paths, and likewise, generally putting the GUSI libraries ahead of most others for the link step. I realize, from other threads on this list, that the situation might be different when embedding MacPython in another application, where there might be linkage problems especially when they are statically linked together. If that situation could be explained, too, it would be helpful, although that is not a primary interest at this time for me, others where I work are interested. TIA, Martin M. From just@letterror.com Sat Feb 2 07:15:41 2002 From: just@letterror.com (Just van Rossum) Date: Sat, 2 Feb 2002 08:15:41 +0100 Subject: [Pythonmac-SIG] reset and IDE In-Reply-To: Message-ID: <20020202081542-r01010800-eb2e2c7b-0920-010c@10.0.0.23> Christopher Smith wrote: > 1) If I wanted to build a copy of the IDE with this as the default > behavior, where do I have to insert this code? (I was unable to find > where a press on the "Run All" button takes you in terms of program flow.) Have a look at PyEdit.py, the run() method of the Editor class. Just From dyoo@hkn.eecs.berkeley.edu Sat Feb 2 10:38:05 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sat, 2 Feb 2002 02:38:05 -0800 (PST) Subject: [Pythonmac-SIG] Re: [Tutor] sitecustomize and pythonstartup In-Reply-To: Message-ID: On Sat, 2 Feb 2002, Jack Jansen wrote: > > Yes, it's possible. If we add the following fragment to our > > sitecustomize.py: > > > > ### > > import math > > import __builtin__ > > __builtin__.math = math > > del math > > ### > > But this will not only make it show up in interactive > interpreters, it will also make it show up globally, in every > module. I'm not sure this is a good idea... Good point! Yikes..., ok if we want this automatic math import to work on interactive sessions without completely munging every other library in Python, perhaps we can employ a variation of the tricky code that pydoc.help() uses to try detecting if a session is interactive: ### import inspect def isInteractive(): """Returns 1 if we're running in an interpreter window, and false otherwise. At least, it tries to. This is a variation of what pydoc.help() tries.""" return inspect.stack()[-1][1:4] == (None, 1, "?") ### The idea of this is to look at the very end of the frame stack, and if the following three characteristics hold: 1. The "file" part of the frame is None. 2. We're on line number 1. 3. We have no clue what function we're in. ("?") then we're probably in interactive mode. And speaking of no clue... I have NO clue if this will work on an IDE. I think that other IDE's actually set the "file name" to something other than "None", so perhaps this heuristic needs to be relaxed. Does anyone know a better way of testing if we're in interactive mode or not? If we have something like this like this, we might be able to limit the extent of the math import to just interactive shells: ### ## Within sitecustomize.py import inspect def isInteractive(): """Returns 1 if we're running in an interpreter window, and false otherwise. At least, it tries to. This is a variation of what pydoc.help() tries.""" return inspect.stack()[-1][1:4] == (None, 1, "?") class _InteractiveMath: def __repr__(self): if isInteractive(): import math return repr(math) else: raise NameError, 'name "math" is not defined' def __getattr__(self, attr): if isInteractive(): import math return getattr(math, attr) else: raise NameError, 'name "math" is not defined' import __builtin__ __builtin__.math = _InteractiveMath() ### To tell the truth, I feel very somewhat ashamed about this code, as it doesn't quite work perfectly. It tries to simulate the NameErrors that should occur in a noninteractive Python program --- the _InteractiveMath() instance tries to pretend that it's not there if the right person doesn't knock --- but either way, we can still hear some strange shuffling behind the door. *sigh* This is what I could cook up in thirty minutes, and I'm sure there's a better way to do this. From keithn@2xtreme.net Sat Feb 2 14:13:51 2002 From: keithn@2xtreme.net (keith nemitz=?ISO-8859-1?Q?=a0=a0=a0=a0=a0?=) Date: Sat, 2 Feb 2002 06:13:51 -0800 Subject: [Pythonmac-SIG] socket test fails on macpython 2.2 Message-ID: I just downloaded and installed MacPython 2.2. When I ran the test sweet socket and email failed in addition to the expected failures. I have an active network connection, via Airport to a DSL router. My TCP/IP control panel is set to DCHP. When I investigated the problem, I discovered that the following snipet of code in the test script, failed. socktype = socket.SocketType hostname = socket.gethostname() ip = socket.gethostbyname(hostname) hname, aliases, ipaddrs = socket.gethostbyaddr(ip) The last line generates an error. (dead) herror: (3, 'host not found') When I check the value for ip, it contains the same ip address listed in the TCP/IP control panel. If I ignore the line, and assign blank values into the three return values, the program outputs a 'parent accepting' message. hname, aliases, ipaddrs = ' ', [' '], [' '] #### socket.gethostbyaddr(ip) I've never used python before. What should I do? Keith Nemitz From csmith@blakeschool.org Sat Feb 2 17:22:22 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Sat, 02 Feb 2002 11:22:22 -0600 Subject: [Pythonmac-SIG] Re: sitecustomize and pythonstartup In-Reply-To: References: Message-ID: >On Sat, 2 Feb 2002, Jack Jansen wrote: >> > Yes, it's possible. If we add the following fragment to our >> > sitecustomize.py: >> > >> > ### >> > import math >> > import __builtin__ >> > __builtin__.math = math >> > del math >> > ### >> >> But this will not only make it show up in interactive >> interpreters, it will also make it show up globally, in every >> module. I'm not sure this is a good idea... > > >Good point! Yikes..., ok if we want this automatic math import to work on >interactive sessions without completely munging every other library in >Python, perhaps we can employ a variation of the tricky code that >pydoc.help() uses to try detecting if a session is interactive: > > >### >import inspect >def isInteractive(): > """Returns 1 if we're running in an interpreter window, and false > otherwise. At least, it tries to. This is a variation of what > pydoc.help() tries.""" > return inspect.stack()[-1][1:4] == (None, 1, "?") >### > >The idea of this is to look at the very end of the frame stack, and if the >following three characteristics hold: > > 1. The "file" part of the frame is None. > 2. We're on line number 1. > 3. We have no clue what function we're in. ("?") > >then we're probably in interactive mode. > > >And speaking of no clue... I have NO clue if this will work on an IDE. I >think that other IDE's actually set the "file name" to something other >than "None", so perhaps this heuristic needs to be relaxed. Does anyone >know a better way of testing if we're in interactive mode or not? Your code is very close to working in the IDE. It didn't initially, so I printed out the contents of the stack() and saw that on the Mac the (None, 1, "?") appears up toward the top after lines telling what current function is running. So to make the code work I had to change your [-1] to a [2] and then it works fine: math is automatically loaded and available to the interactive display. Unfortunately, it also enabled a call to math that occured in the first line of a script!? The problem was that the (None, 1, "?") tuple appears in the stack of an untitled new script which has, as it's first line, "print math.pi" :-) So, I looked at the stack again and saw that PyInteractive appeared in the next line whereas the stack for a script contains PyEdit instead, so there, I think is the way to know if you are in the Interactive window or not. The new code for sitecustomize.py is below and will work, I believe as long as the name of the Interactive script doesn't change from PyInteractive. It will also break if some other functions are running before the call to _InteractiveMath (e.g. the __getattr__ appears on the stack above the line telling that PyInteractive is running and that's what makes you have to read further down in the stack to [3] to find the PyInteractive). #### def isInteractive(): """Returns 1 if we're running in an interpreter window, and false otherwise. This is a variation of what pydoc.help() tries.""" """ return inspect.stack()[3][1].find("PyInteractive")<>0 > >class _InteractiveMath: > def __repr__(self): > if isInteractive(): > import math > return repr(math) > else: > raise NameError, 'name "math" is not defined' > > def __getattr__(self, attr): > if isInteractive(): > import math > return getattr(math, attr) > else: > raise NameError, 'name "math" is not defined' > >import __builtin__ >__builtin__.math = _InteractiveMath() >### Perhaps this could be extended now to look for module aliases in a folder like "AutoLoad" and automatically load these at startup, too. (I would copy the behavior of the present sitecustomize script that ships with the mac version which appends search paths to sys.path.) Thanks for the help, all. (Now, thanks to the point from Just, I will take a look at getting the reset to work in the IDE.) /c From csmith@blakeschool.org Sat Feb 2 17:54:02 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Sat, 02 Feb 2002 11:54:02 -0600 Subject: [Pythonmac-SIG] Re: sitecustomize and pythonstartup In-Reply-To: References: Message-ID: >#### >def isInteractive(): > """Returns 1 if we're running in an interpreter window, and false > otherwise. This is a variation of what pydoc.help() tries.""" > > """ > return inspect.stack()[3][1].find("PyInteractive")<>0 > Well...this doesn't quite work because in a script, [3][1] might return None which doesn't support the find function. SO...rather than guess where that PyInteractive might be I just turned the whole stack into a string and looked for it. The only problem with that is that even in a script, the stack will contain the word "PyInteractive" because that is the text that is being searched for. SO...I just pulled out element [1] from the stack and search through it for "PyInteractive" and that works: def isInteractive(): . . . return str([x[1] for x in inspect.stack()]).find("PyInteractive")>-1 So math can now be accessed at the interpreter's prompt and within a function: >>> def f(): ... print math.pi ... >>> f() 3.14159265359 >>> math.pi 3.1415926535897931 >>> So the IDE now behaves like the Interpreter in this regard. In a script created within the IDE, both of the the following attempts at printing pi fail (as they should): print math.pi def f(): print math.pi f() /c From keithn@2xtreme.net Sat Feb 2 21:51:47 2002 From: keithn@2xtreme.net (keith nemitz=?ISO-8859-1?Q?=a0=a0=a0=a0=a0?=) Date: Sat, 2 Feb 2002 13:51:47 -0800 Subject: [Pythonmac-SIG] Rumor: test_socket and test_email don't work on OS9. Message-ID: Hello, I was told by an experienced python and mac person that test_socket and test_email don't work on OS9. And worse, the underlying modules don't work either, due to problems with OpenTransport under OS9. I believe I have encountered this problem. Can anyone confirm a positive experience for using the sockets modules and email modules under OS9. What exact version do you have? I have OS 9.0.4. running on a Pismo Powerbook G3 (firewire). Perhaps I can upgrade OpenTransport or the OS itself. I am not ready to upgrade to OS-X. appreciate your help, Keith From csmith@blakeschool.org Sat Feb 2 22:45:39 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Sat, 02 Feb 2002 16:45:39 -0600 Subject: [Pythonmac-SIG] RE: reset and IDE In-Reply-To: <20020202081542-r01010800-eb2e2c7b-0920-010c@10.0.0.23> References: <20020202081542-r01010800-eb2e2c7b-0920-010c@10.0.0.23> Message-ID: just@letterror.com writes: >Christopher Smith wrote: > >> 1) If I wanted to build a copy of the IDE with this as the default >> behavior, where do I have to insert this code? (I was unable to find >> where a press on the "Run All" button takes you in terms of program >flow.) > >Have a look at PyEdit.py, the run() method of the Editor class. Thanks for the pointer, Just. Here's what I've come up with so far. In the _run function I have inserted a modification of Jesse W's reset code (as advertised on tutor). It implements a total reload of modules, whether they have been changed or not. I am not yet sure how to find out which ones have been changed and actually need reloading. In addition, I have preserved Jesse's user_safe_items option which allows you to specify things that shouldn't be reloaded. I'm not sure at this point why that might be needed so maybe the best bet is to leave it out. One of the problems it has right now is that the user_safe_items are only paid attention to the *2nd* time that the script is run. For example, let's say you ran the script with imported module A and you didn't have any user_safe_items defined. Then you make modifications to A but don't want those changes read so you add the line user_safe_items=['A'] to your script. When you run it, the present modifications to the _run definition don't honor that change to the script so module A is re-read anyway. It won't be re-read the next time you run the script, though. This might be because until the code is executed, this new variable doesn't yet exist in the namespace. I think this is why the reverse happens, too. If you now remove the user_safe_items line from your script, module A won't be read the first time, but it will be read the next time the script is run. Does anyone have some thoughts on this? What might someone *not* want wiped out between runs? Is it worth figuring out which modules actually need reloading or not? Perhaps one could fund out which modules actually need reloading by checking the modification dates on the .py and the .pyc files and see if the .py is newer and only then reload the module. HERE'S WHAT IT CATCHES NOW -------------------------- #x=1 was changed to y=1 but print x was not changed; #x is flagged as not being defined #y=1 #print x #print 'f' in function f was changed to print 'g'; #it does so correctly #def f(): # print 'g' #f() #a module was imported and then changed; the modified #module is re-loaded and shows the changed behavior import ext ext.ex() HERE'S THE MODIFICATION TO THE _run DEFINITION ---------------------------------------------- def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run unsaved file" self._run_with_interpreter() else: pytext = self.editgroup.editor.get() globals, file, modname = self.getenvironment() #-------cps addition (note: the namespace is called "globals") safe_items=['__builtins__', '__doc__', '__file__', '__name__'] if 'user_safe_items' in globals.keys(): safe_items+=globals['user_safe_items'] for item in globals.keys(): if item not in safe_items: if str(type(globals[item]))=="": exec "reload("+item+")" in globals else: exec ("del "+item) in globals #-------end cps addition self.execstring(pytext, globals, globals, file, modname) -------------- /c From csmith@blakeschool.org Sat Feb 2 23:08:02 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Sat, 02 Feb 2002 17:08:02 -0600 Subject: [Pythonmac-SIG] cls in the IDE Message-ID: I believe this issue has been addressed on the Windows/Unix? systems but it perisists as far as I can tell on the Mac: how to clear the output window. I have been poking around in the code for the Mac's IDE and found the place that clears the screen of the output window. In order to issue a clear screen command I think that one would simply need a module like this: def cls(): import PyConsole PyConsole.PyOutput.clearbuffer(X) where X is the instance of the PyOutput window...which I don't know how to get. Can anyone help me here? The actual error I get when trying to execute a PyConsole.PyOutput.clearbuffer() command is unbound method clearbuffer() must be called with PyOutput instance as first argument (got NoneType instance instead). I see that in PythonIDEMain there is the command PyConsole.installoutput() which I assume creates the output window. If so, am I doomed because the instance information has not been stored anywhere? Thanks for any assistance. /c From fgranger@altern.org Sun Feb 3 17:16:44 2002 From: fgranger@altern.org (Francois Granger) Date: Sun, 3 Feb 2002 18:16:44 +0100 Subject: [Pythonmac-SIG] Strange ? Message-ID: I did a simple script to work info inside some files. It gave me strange results, so I have reduced it to the bare script needed to show the behaviour. Config: MacOS 9.1, Python 2.2 Make this script an applet and drop the filenames showed in the list. All filenames are different. I expect it to return the full filename plus a space unless the filename is longer than 30 char. In this case, it should return the first 30 char plus a space. But it return only the first word of the name plus a space. I did test with files = os.listdir(os.getcwd()) and I did not get the same behaviour. # python import sys, re, os print sys.argv[1:] files = sys.argv[1:] for file in files: out = file[:30] + ' ' print out output of the script below. ==================================================== ['HD:Dev:stats usenet:Classement hebdo020118', 'HD:Dev:stats usenet:Classement hebdo020125', 'HD:Dev:stats usenet:Classement hebdo020201', 'HD:Dev:stats usenet:Classement mensuel 0201', 'HD:Dev:stats usenet:Classement hebdo020111'] HD:Dev:stats usenet:Classement HD:Dev:stats usenet:Classement HD:Dev:stats usenet:Classement HD:Dev:stats usenet:Classement HD:Dev:stats usenet:Classement ==================================================== From lmeyn@mail.arc.nasa.gov Sun Feb 3 18:16:33 2002 From: lmeyn@mail.arc.nasa.gov (Larry Meyn) Date: Sun, 3 Feb 2002 10:16:33 -0800 Subject: [Pythonmac-SIG] Strange ? In-Reply-To: References: Message-ID: Note, len('HD:Dev:stats usenet:Classement') = 30 Try: print sys.argv[1:] files = sys.argv[1:] for file in files: out = file.split(':')[-1] if len(out)>30: out = out[:30] + ' ' print out At 6:16 PM +0100 2/3/02, Francois Granger wrote: >I did a simple script to work info inside some files. It gave me >strange results, so I have reduced it to the bare script needed to >show the behaviour. >Config: MacOS 9.1, Python 2.2 > >Make this script an applet and drop the filenames showed in the list. >All filenames are different. I expect it to return the full filename >plus a space unless the filename is longer than 30 char. In this >case, it should return the first 30 char plus a space. But it return >only the first word of the name plus a space. > >I did test with >files = os.listdir(os.getcwd()) >and I did not get the same behaviour. > ># python > >import sys, re, os > >print sys.argv[1:] >files = sys.argv[1:] >for file in files: > out = file[:30] + ' ' > print out > >output of the script below. >==================================================== >['HD:Dev:stats usenet:Classement hebdo020118', 'HD:Dev:stats >usenet:Classement hebdo020125', 'HD:Dev:stats usenet:Classement >hebdo020201', 'HD:Dev:stats usenet:Classement mensuel 0201', >'HD:Dev:stats usenet:Classement hebdo020111'] >HD:Dev:stats usenet:Classement >HD:Dev:stats usenet:Classement >HD:Dev:stats usenet:Classement >HD:Dev:stats usenet:Classement >HD:Dev:stats usenet:Classement >==================================================== > >_______________________________________________ >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 E-FAX: (425) 944-5526 sent via e-mail ---------------------------------------------------------------------- From rfheeter@speakeasy.net Sun Feb 3 19:09:34 2002 From: rfheeter@speakeasy.net (Bob Heeter) Date: Sun, 3 Feb 2002 11:09:34 -0800 Subject: [Pythonmac-SIG] Re: Rumor: test_socket and test_email don't work on OS9. In-Reply-To: References: Message-ID: Perhaps a true expert could say something about when GUSI and/or Python is likely to be fully fixed, and if there are any ways that those of us in the user community could help? Meanwhiles, here's a user-level perspective for Keith: >Can anyone confirm a positive experience for using the sockets modules >and email modules under OS9. What exact version do you have? I'm running Python 2.1.1 on OS9.1 (original 250 MHz G3 powerbook built on the 3400 chassis) and OS9.2.2 (G4 desktop, 733 MHz, vintage November 2001). With Python 2.1.1, I've had some mixed experiences with sockets used by ftplib and smtplib, but aside from a few problems the overall behavior is not bad. I previously ran Python 1.5.2 for over a year without any real problems (but without all the new features of the newer Pythons). With regard to Python 2.1.1: Based on past list discussions, it seems like the main problem is in the underlying (and relatively new) GUSI2 socket library which goes into Python. The older Python internet-support modules expect different socket behavior than GUSI2 is now providing. However, the problems are generally solvable with a bit of work. I don't believe the newer Pythons have fixed them yet. However, until I started using Python 2.1.1 I didn't even need to know what a socket was, and if you aren't willing to fiddle with the libraries a little, Python *might* give you some headaches. For instance, here on my systems, ftplib.py in 2.1.1 would sometimes cough up "socket not connected" errors when downloading files, apparently because it has trouble telling when all the data has been received. When I ran into this it was very frustrating, but with a few hours of reviewing the list discussions and a bit of hacking around, I got a workaround that was good enough for my purposes: >From old ftplib.retrbinary: while 1: data = conn.recv(blocksize) if not data: break callback(data) conn.close() My hack goes like this: while 1: data = "" try: data = conn.recv(blocksize) except: pass # (I have the program warn me when it gets here) if not len(data): break else: callback(data) try: conn.close() except: pass # (I have the program warn me when it gets here) I'm sure someone with more experience can do better, but this works so far. Also, I've been having some minor trouble with smtplib. The module works, but right now it is really slow in connecting to the mailserver to send a single message. I recently changed my local network configuration (adding an AirPort2 between my cable modem and my local hub), and it is now taking over 20 seconds (on the newer G4) to 50 seconds (on the older G3) for smtplib.SMTP to connect to my ISP's email server and send a single message. Previously, with the same Python and MacOS, the same task took at most a few seconds. (Subsequent messages using the same link transmit very quickly, though.) What puzzles me is that this problem only affects Python; all my regular Internet software works the same as it always did! And if the problem was purely network-related, I wouldn't expect the speed to depend so strongly on which machine I was using. So I suspect there's something amiss inside smtplib or the libraries it calls, but I haven't sorted out where the problem occurs yet. There are also reports of issues with urllib and some of the other internet libraries, but I haven't investigated them since I don't need them. But the ftplib and smtplib interfaces are critical for what I am doing, which is to run a small multiplayer online turn-based game as a hobby. -- Bob Bob Heeter Livermore, California From jay@heynow.com Sun Feb 3 19:14:27 2002 From: jay@heynow.com (Jay Koutavas) Date: Sun, 3 Feb 2002 14:14:27 -0500 Subject: [Pythonmac-SIG] Anyone built the OSX C++ samples for wxDesigner? Message-ID: Seems the makefile isn't quite Mac OSX aware. Nor is the one for Mac OS 9.x. Help? /Jay -- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Jay Koutavas mailto:jay@heynow.com Heynow Software http://www.heynow.com Windham, New Hampshire, USA ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' From fgranger@altern.org Sun Feb 3 21:23:38 2002 From: fgranger@altern.org (Francois Granger) Date: Sun, 3 Feb 2002 22:23:38 +0100 Subject: [Pythonmac-SIG] Strange ? In-Reply-To: References: Message-ID: At 10:16 -0800 3/02/02, in message Re: [Pythonmac-SIG] Strange ?, Larry Meyn wrote: >Note, len('HD:Dev:stats usenet:Classement') = 30 >Try: > >print sys.argv[1:] >files = sys.argv[1:] >for file in files: > out = file.split(':')[-1] > if len(out)>30: out = out[:30] + ' ' > print out Thanks, chasing for the wrong reason ;-) I'll use os.path to do it. From Jack.Jansen@oratrix.nl Sun Feb 3 22:59:11 2002 From: Jack.Jansen@oratrix.nl (Jack Jansen) Date: Sun, 3 Feb 2002 23:59:11 +0100 Subject: [Pythonmac-SIG] socket test fails on macpython 2.2 In-Reply-To: Message-ID: On Saturday, February 2, 2002, at 03:13 PM, keith nemitz=A0=A0=A0=A0=A0=20= wrote: > I just downloaded and installed MacPython 2.2. When I ran the=20 > test sweet > socket and email failed in addition to the expected failures. I have = an > active network connection, via Airport to a DSL router. My=20 > TCP/IP control > panel is set to DCHP. > > When I investigated the problem, I discovered that the following = snipet > of code in the test script, failed. > > socktype =3D socket.SocketType > hostname =3D socket.gethostname() > ip =3D socket.gethostbyname(hostname) > hname, aliases, ipaddrs =3D socket.gethostbyaddr(ip) > > The last line generates an error. (dead) herror: (3, 'host=20 > not found') This is not a bug with Python, this is a bug with your ISP:-) The reverse lookup for your IP address does not return a valid=20 domain name. You will find that you have other vague trouble too=20 when you're internetting (such as not being able to get=20 MacPython distributions with FTP from ftp.cwi.nl:-). The various=20 standards explicitly say that for each active IP address there=20 must be a valid domain name. -- - Jack Jansen =20 http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution --=20 Emma Goldman - From Jack.Jansen@oratrix.nl Sun Feb 3 23:03:23 2002 From: Jack.Jansen@oratrix.nl (Jack Jansen) Date: Mon, 4 Feb 2002 00:03:23 +0100 Subject: [Pythonmac-SIG] Rumor: test_socket and test_email don't work on OS9. In-Reply-To: Message-ID: <394AFE30-18FA-11D6-A9E9-003065517236@oratrix.nl> On Saturday, February 2, 2002, at 10:51 PM, keith nemitz=A0=A0=A0=A0=A0=20= wrote: > Hello, > > > I was told by an experienced python and mac person that test_socket = and > test_email don't work on OS9. And worse, the underlying modules don't > work either, due to problems with OpenTransport under OS9. ??!? test_socket and test_email should work fine, on OS9 and any=20 other MacOS. The underlying modules should also work fine. I am=20 aware of exactly one problem with the socket module: under some=20 circumstances a read() on a file object obtained from a socket=20 (such as through urllib) can return before all data is read, so=20 you may need to put a while loop around it. This is currently an=20 open bug. If there are any other problems with sockets in MacPython they=20 should definitely be reported, please! -- - Jack Jansen =20 http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution --=20 Emma Goldman - From bobsavage@mac.com Mon Feb 4 19:36:11 2002 From: bobsavage@mac.com (Bob Savage) Date: Mon, 04 Feb 2002 13:36:11 -0600 Subject: [Pythonmac-SIG] unexpected behavior with $PYTHONHOME for Mach-O Python Message-ID: I don't understand something about mach-o Python. If I don't have the $PYTHONHOME variable set, everything works properly, ---------------------------------------- [~/Desktop] bsavage % echo $PYTHONHOME PYTHONHOME: Undefined variable. [~/Desktop] bsavage % python Python 2.2 (#1, Jan 9 2002, 15:28:46) [GCC 2.95.2 19991024 (release)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> os.getcwd() '/Users/bsavage/Desktop' >>> ^D But if I set it, Python breaks! ---------------------------------------- [~/Desktop] bsavage % setenv PYTHONHOME "/sw/lib/python2.2/:/sw/lib/python2.2/plat-darwin" [~/Desktop] bsavage % python 'import site' failed; use -v for traceback Python 2.2 (#1, Jan 9 2002, 15:28:46) [GCC 2.95.2 19991024 (release)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import os Traceback (most recent call last): File "", line 1, in ? ImportError: No module named os >>> ^D Isn't this the opposite of what is supposed to happen? Bob From prastawa@cs.unc.edu Mon Feb 4 20:09:54 2002 From: prastawa@cs.unc.edu (Marcel Prastawa) Date: Mon, 4 Feb 2002 15:09:54 -0500 Subject: [Pythonmac-SIG] unexpected behavior with $PYTHONHOME for Mach-O Python In-Reply-To: Message-ID: <271D4005-19AB-11D6-8821-000A27942780@cs.unc.edu> Bob, Try setting PYTHONHOME to /sw. Marcel On Monday, February 4, 2002, at 02:36 , Bob Savage wrote: > I don't understand something about mach-o Python. > > If I don't have the $PYTHONHOME variable set, everything works properly, > ---------------------------------------- > [~/Desktop] bsavage % echo $PYTHONHOME > PYTHONHOME: Undefined variable. > [~/Desktop] bsavage % python > Python 2.2 (#1, Jan 9 2002, 15:28:46) > [GCC 2.95.2 19991024 (release)] on darwin > Type "help", "copyright", "credits" or "license" for more information. >>>> import os >>>> os.getcwd() > '/Users/bsavage/Desktop' >>>> ^D > > But if I set it, Python breaks! > ---------------------------------------- > [~/Desktop] bsavage % setenv PYTHONHOME > "/sw/lib/python2.2/:/sw/lib/python2.2/plat-darwin" > [~/Desktop] bsavage % python > 'import site' failed; use -v for traceback > Python 2.2 (#1, Jan 9 2002, 15:28:46) > [GCC 2.95.2 19991024 (release)] on darwin > Type "help", "copyright", "credits" or "license" for more information. >>>> import os > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named os >>>> ^D > > Isn't this the opposite of what is supposed to happen? > > Bob > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From mmiller@adobe.com Tue Feb 5 02:57:28 2002 From: mmiller@adobe.com (Martin Miller) Date: Mon, 04 Feb 2002 18:57:28 -0800 Subject: [Pythonmac-SIG] Re: C Extension Modules and GUSI References: Message-ID: <3C5F4A18.86EEA8F0@adobe.com> So far there haven't been any response to my GUSI questions and I can't help wonder if it's because: 0) Nobody reads the list on the weekend, or 1) Nobody understand the question, 2) It's a too dumb newbie question, 4) Nobody knows, 3) No one cares. ;-( On the off-chance it's 0 or 1, let me post the question again. Martin =========================================== On Fri, 01 Feb 2002 18:35:58 -0800, I wrote: > I understand that the MacPython interpreter uses the GUSI 2 headers and > library created by Matthias Neeracher. > > My question is: Is it necessary to use the GUSI headers when building C > Extension modules that will become dynamically-linked shared libraries. > One reason I ask is because the GUSI 2 documentation talks about putting > the GUSI include folder in front of all other system include access > paths, and likewise, generally putting the GUSI libraries ahead of most > others for the link step. > > I realize, from other threads on this list, that the situation might be > different when embedding MacPython in another application, where there > might be linkage problems especially when they are statically linked > together. If that situation could be explained, too, it would be > helpful, although that is not a primary interest at this time for me, > others where I work are interested. > > TIA, > Martin M. > From i.caven@ieee.org Tue Feb 5 04:54:07 2002 From: i.caven@ieee.org (Ian Caven) Date: Mon, 4 Feb 2002 20:54:07 -0800 Subject: [Pythonmac-SIG] Question about MacPython and AE Message-ID: George Song george.song@webwarecorp.com Thu, 31 Jan 2002 15:07:17 -0800 wrote: > >Hi everyone, > >First day trying to use MacPython, fairly experienced with Python. > >Can someone tell me how to get a list of the processes running on the >machine? > >I see Finder.processes and I can use Finder.Finder() > >Is it something like: > >f = Finder.Finder() >f.sendevent(...?) > >Please help. The easiest way to get a list of processes is to use the findertools module (in MacPython 2.2) or the morefindertools module in earlier releases. Note that the names can contain Mac-specific characters, such as the trademark symbol. import findertools processNamesAndCreators = findertools.processes() processNames = [] for p in processNamesAndCreators: processNames.append(p[0]) -- --- Ian Caven i.caven@ieee.org From csmith@blakeschool.org Tue Feb 5 07:35:06 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Tue, 05 Feb 2002 01:35:06 -0600 Subject: [Pythonmac-SIG] cls(),inkey(),prompt() Message-ID: I have written 3 function for MacPython IDE (Carbon) which allow 1) clearing of the output window with the cls() command 2) polling the keyboard (like BASIC's inkey$() command) 3) prompting and viewing user input on the output window rather than in a separate dialog box as is generated with input() and raw_input(). All together they come to 50 lines. If there is interest I can post them here or send them to interested individuals who contact me at this address. One thing I don't know how to do, and would appreciate some help on, is bringing the output window to the foreground (i.e. making it active) so the user input to the prompt can be seen in case the output window is initially behind the script window. /c From jack@oratrix.com Tue Feb 5 10:40:12 2002 From: jack@oratrix.com (Jack Jansen) Date: Tue, 5 Feb 2002 11:40:12 +0100 Subject: [Pythonmac-SIG] Re: C Extension Modules and GUSI In-Reply-To: <3C5F4A18.86EEA8F0@adobe.com> Message-ID: On Tuesday, February 5, 2002, at 03:57 , Martin Miller wrote: > So far there haven't been any response to my GUSI questions and I can't > help wonder if it's because: > 0) Nobody reads the list on the weekend, or > 1) Nobody understand the question, > 2) It's a too dumb newbie question, > 4) Nobody knows, > 3) No one cares. ;-( It's actually 5) Jack was going to answer but forgot. >> My question is: Is it necessary to use the GUSI headers when building C >> Extension modules that will become dynamically-linked shared libraries. >> One reason I ask is because the GUSI 2 documentation talks about >> putting >> the GUSI include folder in front of all other system include access >> paths, and likewise, generally putting the GUSI libraries ahead of most >> others for the link step. The answer is: it depends. If your extension module does not use stdio, sockets or any of the unix-compatibility routines (open/close/read/write, signal, readdir, stat, etc) you can safely build without using GUSI. But if your module does use any of these (or if you're not sure) you'd better use the GUSI includes, otherwise you may be compiling with the MSL definition of, say, struct stat, while the stat() routine you'll be linked against will have been compiled with the GUSI variant of struct stat. Even in the latter situation you may be able to get away with not using the GUSI includes, but only if you know what you're doing (i.e. not running into the struct conflict situation above). But note that it's not only struct definitions, there are also a couple of #defines that are different and a few other things. Note that you shouldn't link against the GUSI libraries: GUSI is included in PythonCore (and all symbols are exported from there). -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From blacktrash@gmx.net Tue Feb 5 11:07:53 2002 From: blacktrash@gmx.net (Christian Ebert) Date: Tue, 5 Feb 2002 12:07:53 +0100 Subject: [Pythonmac-SIG] revue of basic tkinter issues Message-ID: <20020205120908-r01010800-f3e38288-0922-0108@217.0.172.212> Hello there, As little by little I approach the state where I want to work on some gui stuff I face the tkinter problems again (Mac OS D1-9.2.2). Time to get on your nerves again ;-) Here's a try to sum up the problems that present itselves right from the beginning: 1. "Hello world" demo script: Classic: Runs, but the closing button reacts only to the second click. Carbon (latest version of _tkinter.carbon.slb): The window appears (no looking in vain for tcl any more, but no reaction clicking or typing. When I force quit sometimes a crash (I made a stdlog of one if anyone's interested). 2. "Hanoi" demo script: Classic and Carbon behave the same way: Window comes up, but I can only watch the red disks switching from tower to tower. Is there some more to it? No reaction to neither mouse nor keyboard. When I want to quit, no reaction to cmd-q, menu file -> quit (or ctr-d for that matter). The only exit is either cmd-w or menu file -> close which leads to the following error message: Traceback (most recent call last): File "Christians PB HD:Applications (Mac OS 9):Scripting:Python 2.2:Demo:tkinter:guido:hanoi.py", line 154, in ? main() File "Christians PB HD:Applications (Mac OS 9):Scripting:Python 2.2:Demo:tkinter:guido:hanoi.py", line 149, in main h.run() File "Christians PB HD:Applications (Mac OS 9):Scripting:Python 2.2:Demo:tkinter:guido:hanoi.py", line 81, in run hanoi(self.n, 1, 2, 0, self.report) File "Christians PB HD:Applications (Mac OS 9):Scripting:Python 2.2:Demo:tkinter:guido:hanoi.py", line 22, in hanoi hanoi(n-1, c, b, a, report) File "Christians PB HD:Applications (Mac OS 9):Scripting:Python 2.2:Demo:tkinter:guido:hanoi.py", line 20, in hanoi hanoi(n-1, a, c, b, report) File "Christians PB HD:Applications (Mac OS 9):Scripting:Python 2.2:Demo:tkinter:guido:hanoi.py", line 20, in hanoi hanoi(n-1, a, c, b, report) File "Christians PB HD:Applications (Mac OS 9):Scripting:Python 2.2:Demo:tkinter:guido:hanoi.py", line 21, in hanoi report(n, a, b) File "Christians PB HD:Applications (Mac OS 9):Scripting:Python 2.2:Demo:tkinter:guido:hanoi.py", line 97, in report x1, y1, x2, y2 = c.bbox(p) File "Christians PB HD:Applications (Mac OS 9):Scripting:Python 2.2:Lib:lib-tk:Tkinter.py", line 1897, in bbox return self._getints( TclError: invalid command name ".256895824" The number in the last line varies, that's all. 3. Perhaps related: In EditPythonPrefs, Default Startup Options: Text "On error exit" is truncated to "On error exi". The two radio buttons on the right of four do not work properly: I have to click in the text to right of them. The balloon help is a bit dislocated too. idle.py: keyboard shortcut display in the menus overlays the commands, but empty space on the right of the menu. 4. Trying to resort to W.Widgets: Scripts can only be run from the scripts menu inside IDE. Opening in the finder only opens the script in IDE. When dropped on BuildApplet, applet is build, but on run doesn't find module W (I inserted the path to Mac:Tools:IDE in the prefs). As Python is so much fun otherwise, this all the more frustrating. Am I the only one to experience this? Any kind of hint or help appreciated. Christian -- Unlike the clitoris, you don't have to know where the intellect is to stimulate it. But if I ever find mine, I might get it pierced. (geek_girl in alt.angst) From Benjamin.Schollnick@usa.xerox.com Tue Feb 5 12:59:43 2002 From: Benjamin.Schollnick@usa.xerox.com (Schollnick, Benjamin) Date: Tue, 05 Feb 2002 07:59:43 -0500 Subject: [Pythonmac-SIG] cls(),inkey(),prompt() Message-ID: Certainly.... I would definitely have a use for those routines. - Benjamin -----Original Message----- From: Christopher Smith [mailto:csmith@blakeschool.org] Sent: Tuesday, February 05, 2002 2:35 AM To: pythonmac-sig@python.org Cc: tutor@python.org Subject: [Pythonmac-SIG] cls(),inkey(),prompt() I have written 3 function for MacPython IDE (Carbon) which allow 1) clearing of the output window with the cls() command 2) polling the keyboard (like BASIC's inkey$() command) 3) prompting and viewing user input on the output window rather than in a separate dialog box as is generated with input() and raw_input(). All together they come to 50 lines. If there is interest I can post them here or send them to interested individuals who contact me at this address. One thing I don't know how to do, and would appreciate some help on, is bringing the output window to the foreground (i.e. making it active) so the user input to the prompt can be seen in case the output window is initially behind the script window. /c _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig From fgranger@altern.org Tue Feb 5 13:08:45 2002 From: fgranger@altern.org (Francois Granger) Date: Tue, 05 Feb 2002 14:08:45 +0100 Subject: [Pythonmac-SIG] cls(),inkey(),prompt() In-Reply-To: Message-ID: on 5/02/02 8:35, Christopher Smith at csmith@blakeschool.org wrote: > I have written 3 function for MacPython IDE (Carbon) which allow >=20 > 1) clearing of the output window with the cls() command >=20 > 2) polling the keyboard (like BASIC's inkey$() command) >=20 > 3) prompting and viewing user input on the output window rather > than in a separate dialog box as is generated with input() and > raw_input(). >=20 > All together they come to 50 lines. If there is interest I can > post them here or send them to interested individuals who > contact me at this address. >=20 > One thing I don't know how to do, and would appreciate some help on, > is bringing the output window to the foreground (i.e. making it > active) so the user input to the prompt can be seen in case the > output window is initially behind the script window. I'd be pleased to get a copy. Regards, Fran=E7ois From gherman@darwin.in-berlin.de Tue Feb 5 14:44:15 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Tue, 05 Feb 2002 15:44:15 +0100 (CET) Subject: [Pythonmac-SIG] Screen saver sample, embedded Python in OS X apps Message-ID: <1012920255.3c5fefbfc6390@webmail.in-berlin.de> Hi, I've written a more or less fancy OS X screen saver that I'm happy to share with people interested. In fact, I prototyped it in Python using the ReportLab graphics library and packaged it with my buildpkg.py tool (with minimal deltas applied). Actually, I'd like to use more Python under the hood in similar and/or more useful little apps, and would kindly ask someone if he or she could provide me some working sample toy sources which embed the (Unix) Py- thon interpreter in a native OS X application. Now, here is the screen saver. Unfortunately, I could not quickly get the colors to be persistently saved in the user's defaults database, but would welcome any hints on how to do that. And, yes, of course the name will change to something less braindead... ;-) http://starship.python.net/crew/gherman/#MyScreenSaver Thanks and regards, Dinu From gherman@darwin.in-berlin.de Tue Feb 5 17:23:28 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Tue, 05 Feb 2002 18:23:28 +0100 (CET) Subject: [Pythonmac-SIG] compiling woes with libart/distutils-related project Message-ID: <1012929808.3c6015106a513@webmail.in-berlin.de> Hi, I'm trying to compile ReportLab's rendering support module=20 on OS X (Unix-Python 2.1) that makes heavy use of libart.=20 On http://www.reportlab.com/rl_addons.html you can read where to get it. I then executed these lines (with my login instead of anonymous): =A0=A0cvs -d :pserver:anonymous@cvs.reportlab.sourceforge.net:/cvsroot/re= portlab login =A0=A0cvs -d :pserver:anonymous@cvs.reportlab.sourceforge.net:/cvsroot/re= portlab co rl_addons/renderPM and typed: python ./setup.py build in the appropriate directory (you need to add 'darwin1' first to the list of allowed platforms in setup.py...). On the second, shorter, build attempt I then get the following complaint at the end: [...] running build_ext building '_renderPM' extension skipping _renderPM.c (build/temp.darwin-5.2-Power_Macintosh-2.1/_renderPM= .o up-to-date) cc -bundle -undefined suppress build/temp.darwin-5.2-Power_Macintosh-2.1/= _renderPM.o -Lbuild/temp.darwin-5.2-Power_Macintosh-2.1 -l_renderPM_libar= t -l_renderPM_gt1 -o build/lib.darwin-5.2-Power_Macintosh-2.1/_renderPM.s= o /usr/bin/ld: -undefined error must be used when -twolevel_namespace is in= effect error: command 'cc' failed with exit status 1 I think I've seen some similar post on this list, maybe even with myself as the originator (?), but I can't remem- ber what the issue actually was... Thanks for any kind of enlightenment, Dinu From noon@snow.nrcc.cornell.edu Tue Feb 5 18:30:48 2002 From: noon@snow.nrcc.cornell.edu (William Noon) Date: Tue, 05 Feb 2002 13:30:48 -0500 Subject: [Pythonmac-SIG] compiling woes with libart/distutils-related project In-Reply-To: Your message of "Tue, 05 Feb 2002 18:23:28 +0100." <1012929808.3c6015106a513@webmail.in-berlin.de> Message-ID: <200202051830.NAA05764@snow.nrcc.cornell.edu> Dinu -- You ran into the standard problem where Apple changed the linking rules in OS 10.1. They have made -two_level_namespace the default and that requires special handling in most third party software. You may be able to just rebuild python 2.1 to get distutils to put in the right flags. I have been using python 2.2 (cvs) build as a framework with reasonable success. I just updated and built the rl_addons after modifying setup.py 'cause the sys.platform is now 'darwin' not 'darwin1'. --Bill Noon Northeast Regional Climate Center Cornell University > > Hi, > > I'm trying to compile ReportLab's rendering support module > on OS X (Unix-Python 2.1) that makes heavy use of libart. > On http://www.reportlab.com/rl_addons.html you can read > where to get it. > > I then executed these lines (with my login instead of > anonymous): > > >   cvs -d :pserver:anonymous@cvs.reportlab.sourceforge.net:/cvsroot/reportlab login >   cvs -d :pserver:anonymous@cvs.reportlab.sourceforge.net:/cvsroot/reportlab co rl_addons/renderPM > > > and typed: > > > python ./setup.py build > > > in the appropriate directory (you need to add 'darwin1' > first to the list of allowed platforms in setup.py...). > > On the second, shorter, build attempt I then get the > following complaint at the end: > > > [...] > running build_ext > building '_renderPM' extension > skipping _renderPM.c (build/temp.darwin-5.2-Power_Macintosh-2.1/_renderPM.o up-to-date) > cc -bundle -undefined suppress build/temp.darwin-5.2-Power_Macintosh-2.1/_renderPM.o -Lbuild/temp.darwin-5.2-Power_Macintosh-2.1 -l_renderPM_libart -l_renderPM_gt1 -o build/lib.darwin-5.2-Power_Macintosh-2.1/_renderPM.so > /usr/bin/ld: -undefined error must be used when -twolevel_namespace is in effect > error: command 'cc' failed with exit status 1 > > > I think I've seen some similar post on this list, maybe > even with myself as the originator (?), but I can't remem- > ber what the issue actually was... > > Thanks for any kind of enlightenment, > > Dinu > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From jack@oratrix.com Wed Feb 6 10:24:07 2002 From: jack@oratrix.com (Jack Jansen) Date: Wed, 6 Feb 2002 11:24:07 +0100 Subject: [Pythonmac-SIG] fread() returning short reads in some cases Message-ID: I've finally been going after a bug that has plagued MacPython since we started using GUSI 2: reads on sockets sometimes return short data. After reading the MSL source, the unix manual and the ANSI C standard I think GUSI is to blame. I'd like to hear whether others agree with this:-) Here's the scenario. In this case Python has done an fdopen() on the socket, binary read mode, and set the socket to unbuffered. A Python file.read() call should return all the data in the stream. This is implemented by calling fread() and realloc() in a loop until fread returns less data than requested. This is correct according to the C standard: fread() should always return what you've requested, if it is there. The MSL fread() implementation has an optimization that if a stream is binary and unbuffered it will call the underlying (file->read_proc)() directly without going through the buffering scheme. This works fine for the read_proc's that are supplied by MSL (__read_file and __read_console), because only files can be opened in binary mode, and a short read there indeed means end of file. It breaks, however, with GUSI on a socket. A Unix read() call on a socket does not necessarily return all the data you requested; to quote from "man 2 read": The system guarantees to read the number of bytes requested if the descriptor references a normal file that has that many bytes left before the end-of-file, but in no other case. The problem here is that GUSI adheres to the unix semantics, but the MSL internal semantics for read_proc functions are different. Does this analysis sound correct? Any suggestions as to how to fix this for stdio buffer loading for sockets, without breaking it for buffer loading for terminal I/O and without breaking read() semantics on a socket? -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From gherman@darwin.in-berlin.de Wed Feb 6 13:15:58 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Wed, 06 Feb 2002 14:15:58 +0100 (CET) Subject: [Pythonmac-SIG] compiling woes with libart/distutils-related project In-Reply-To: <200202051830.NAA05764@snow.nrcc.cornell.edu> References: <200202051830.NAA05764@snow.nrcc.cornell.edu> Message-ID: <1013001358.3c612c8e61e2f@webmail.in-berlin.de> William Noon : > Dinu -- You ran into the standard problem where Apple changed the > linking rules in OS 10.1. They have made -two_level_namespace the > default and that requires special handling in most third party > software. > > You may be able to just rebuild python 2.1 to get distutils to put > in the right flags. > > I have been using python 2.2 (cvs) build as a framework with > reasonable success. > > I just updated and built the rl_addons after modifying setup.py > 'cause the sys.platform is now 'darwin' not 'darwin1'. Thanks... I guess this is a distutils issue then, isn't it? But for the fun of it I downloaded fink and installed it as desribed on this page (hoping to install Python 2.2 with it): http://people.ucsc.edu/~jacobkm/tkinter_osx_howto.html but then installing xfree86-base failed, so I added the string unstable/main to /sw/etc/fink.conf as described in the section "The longer version:". It failed again, giv- ing me this: [localhost:/Users/dinu] root# fink install xfree86-base [...] gzip: stdin: unexpected end of file tar: unexpected end of file in archive. tar: Error is not recoverable: exiting now ### tar failed, exit code 2 Unpacking the tarball X420src-1.tgz of package xfree86-base-4.2.0-4 failed. The most likely cause for this is a corrupted or incomplete download. Do you want to delete the tarball and download it again? [Y/n] n Failed: unpacking tarball X420src-1.tgz of package xfree86-base-4.2.0-4 failed Unfortunately, SF is extremely slow right now, and regu- larly interrupts started fink installs, but even when a full package is downloaded it still seems to fail as shown above... Quite puzzled, Dinu From gherman@darwin.in-berlin.de Wed Feb 6 14:00:09 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Wed, 06 Feb 2002 15:00:09 +0100 (CET) Subject: [Pythonmac-SIG] compiling woes with libart/distutils-related project In-Reply-To: <1013001358.3c612c8e61e2f@webmail.in-berlin.de> References: <200202051830.NAA05764@snow.nrcc.cornell.edu> <1013001358.3c612c8e61e2f@webmail.in-berlin.de> Message-ID: <1013004009.3c6136e91fcd6@webmail.in-berlin.de> Dinu Gherman : > Unfortunately, SF is extremely slow right now, and regu- > larly interrupts started fink installs, but even when > a full package is downloaded it still seems to fail as > shown above... Sorry, but this seems also related to a local disk size problem. I didn't expect to shuffle hundreds of megabytes to compile Python... Will report later... Dinu From ariza@flexatone.com Wed Feb 6 18:36:37 2002 From: ariza@flexatone.com (christopher ariza) Date: Wed, 6 Feb 2002 13:36:37 -0500 (EST) Subject: [Pythonmac-SIG] compiling woes with libart/distutils-related In-Reply-To: Message-ID: regarding the fink problem: try this % su root % apt-get update and then try the % fink install xfree86-base not sure if this will help, but its fixed strange fink things for me in the past. christopher ariza But for the fun of it I downloaded fink and installed it as desribed on this page (hoping to install Python 2.2 with it): http://people.ucsc.edu/~jacobkm/tkinter_osx_howto.html but then installing xfree86-base failed, so I added the string unstable/main to /sw/etc/fink.conf as described in the section "The longer version:". It failed again, giv- ing me this: [localhost:/Users/dinu] root# fink install xfree86-base [...] From rdacker@pacbell.net Wed Feb 6 19:03:52 2002 From: rdacker@pacbell.net (bob ackerman) Date: Wed, 06 Feb 2002 11:03:52 -0800 Subject: [Pythonmac-SIG] pthread problem Message-ID: <42A67F5B-1B34-11D6-BF58-003065428126@pacbell.net> osx 10.1.2, sendmail-8.12.2, milter-0.3.9, python2.1 when i run sample.py i get: dyld: python Undefined symbols: _pthread_sigmask _sigwait does this mean i haven't built python correctly or that i haven't built my milter module correctly? i added 'pthread' to libs in setup.py, but it said everything was up to date, so it looks like i have to rebuld python, unless someone tells me otherwise. From paulm@profoundeffects.com Wed Feb 6 23:42:33 2002 From: paulm@profoundeffects.com (Paul Miller) Date: Wed, 06 Feb 2002 17:42:33 -0600 Subject: [Pythonmac-SIG] Debug dlls for Python 2.2? Message-ID: <5.1.0.14.2.20020206174145.03d55e28@mars.he.net> I noticed there are no pre-built Python 2.2 Windows Debug DLLS on the Python site. Anyone have a pointer for these? -- Paul T. Miller | VP of Engineering, Profound Effects, Inc. | http://www.profoundeffects.com From lee@lee-phillips.org Thu Feb 7 16:30:00 2002 From: lee@lee-phillips.org (Lee Phillips) Date: Thu, 7 Feb 2002 11:30:00 -0500 Subject: [Pythonmac-SIG] boolean values in appleevents Message-ID: I am trying to learn how to send appleevents with python (because I want to script applications on the Macintosh and I dislike AppleScript). I've had good luck with what comes in Mac/Demo/applescript in MacPython, except that I can't figure out how to send boolean flags to applications. I guess neither can the authors of the included example, makedisk.py, that tells Disk Copy to make a disk image, because their argument, "leave_image_mounted=3D1", has the same effect if you change it to "leave_image_mounted=3D0" : the default, which is to leave the image mounted. I know that a boolean value is not being sent, because when I monitor the appleevents with the Capture AE control panel, I see this: Process("Disk Copy").SendAE "ddsk,Crea,'----':"my disk image", SvAs:fss (=AB[long string]=BB), Moun:1" where that bit at the end, "Moun:1" or "Moun:0", is ignored by the receiver (Disk Copy), because it is expecting a boolean rather than an integer. If you send the command from AppleScript, using tell application "Disk Copy" activate create "my disk image" saving as "my disk image.img" with leave image mounted end tell the appleevent that gets sent is this: Process("Disk Copy").SendAE "ddsk,Crea,'----':"my disk image", SvAs:"my disk image.img", Moun:'true'(), &subj:'null'()" where "Moun:'true'()" or, if you say "without leave image mounted", "Moun:'fals'()", actually changes what the receiver does. Sorry about the the verboseness. Maybe I should just ask: does anyone out there actually know how to send boolean values in appleevents? From managan@llnl.gov Thu Feb 7 17:33:50 2002 From: managan@llnl.gov (Rob Managan) Date: Thu, 7 Feb 2002 09:33:50 -0800 Subject: [Pythonmac-SIG] Building Numeric 20.3 Message-ID: I tried to build Numeric 20.3 since I am trying to debug a module that uses it. I wanted to be able to step into the module with the debugger... With distutils I got these errors when I tried to build it. Anyone know the trick to get it to build. Either Jack ot just has done it since this is the version included with the standard installation. Error : illegal implicit conversion from 'double *' to 'char *' multiarraymodule.c line 1444 dbl_descr->cast[type](&value, 0, rptr, 0, 1); Error : illegal implicit conversion from 'struct _object * (struct _object *, struct _object *, struct _object *)' to 'struct _object * (*)(struct _object *, struct _object *)' multiarraymodule.c line 1481 {"fromstring", array_fromString, 3, doc_fromString}, From vincem@en.com Thu Feb 7 21:31:46 2002 From: vincem@en.com (Vincent Marchetti) Date: Thu, 7 Feb 2002 16:31:46 -0500 Subject: [Pythonmac-SIG] boolean values in appleevents Message-ID: -- Lee Phillips asked how to send boolean arguments in a AppleEvent via Python, using the makedisk.py example... I have not tested this, but I believe that this is at least intended to work: import aetypes AETrue = aetypes.Boolean(1) # or AEFalse = aetypes.Boolean(0) ## pasted from makedisk.py talker = Disk_Copy.Disk_Copy(start=1) talker.activate() filespec = macfs.FSSpec('my disk image.img') try: objref = talker.create('my disk image', saving_as=filespec, leave_image_mounted=AETrue) # this is the correction! except Disk_Copy.Error, arg: print "ERROR: my disk image:", arg ### Vince Marchetti From lakay@gmx.net Wed Feb 6 17:49:19 2002 From: lakay@gmx.net (lakay@gmx.net) Date: Wed, 6 Feb 2002 18:49:19 +0100 (MET) Subject: [Pythonmac-SIG] how to locate volumes Message-ID: <18324.1013017759@www21.gmx.net> Hi Folks, I'm new to scripting on the mac, and have difficulties with the Pathes/Volumes. I want to locate in script which is running without gui all volumes on a mac, and search them. Does anyone have a hint how to retrieve the list of volumes mounted on a mac? thx in advance kay -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From Jack.Jansen@oratrix.nl Thu Feb 7 23:04:16 2002 From: Jack.Jansen@oratrix.nl (Jack Jansen) Date: Fri, 8 Feb 2002 00:04:16 +0100 Subject: [Pythonmac-SIG] boolean values in appleevents In-Reply-To: Message-ID: <026766EA-1C1F-11D6-B5C4-003065517236@oratrix.nl> On Thursday, February 7, 2002, at 05:30 PM, Lee Phillips wrote: > I am trying to learn how to send appleevents with python (because > I want to script applications on the Macintosh and I dislike > AppleScript). I've had good luck with what comes in > Mac/Demo/applescript in MacPython, except that I can't figure out how > to send boolean flags to applications. I guess neither can the > authors of the included example, makedisk.py, that tells Disk Copy to > make a disk image, because their argument, "leave_image_mounted=3D1", > has the same effect if you change it to "leave_image_mounted=3D0" : = the > default, which is to leave the image mounted. > I know that a boolean value is not being sent, because when I > monitor the appleevents with the Capture AE control panel, I see this: > > Process("Disk Copy").SendAE "ddsk,Crea,'----':"my disk image", > SvAs:fss (=AB[long string]=BB), Moun:1" > > where that bit at the end, "Moun:1" or "Moun:0", is ignored by the > receiver (Disk Copy), because it is expecting a boolean rather than > an integer. [cut explanation that an AppleScript gets it right] This is probably again a misunderstanding on my part. Conversion=20 of booleans should be automatic, but the problem is that the=20 Disk Copy AETE talks about an "enum bool" all the time, where it=20 should be a "type bool". So, gensuitemodule doesn't recognize=20 bool as being the wellknown (in aetypes) bool type. The same is true for various other types the Disk Copy AETE=20 uses: it even defines fsspecs as being enums. Hmm, this is only part of the problem: I had also expected the=20 receiving end to do the type cast, if needed. Most receivers=20 seem to do so... OSA gurus: should I simply ignore the "enum" if an enum with=20 such a 4-char name doesn't exist, and treat it as a type? Or is=20 Disk Copy in error here? And if Disk Copy is in error, why would=20 script editor accept it? If I should ignore the enum then the bad news is that I finally=20 have to do away with the single pass over the AETE resource, oh=20 well... -- - Jack Jansen =20 http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution --=20 Emma Goldman - From bobsavage@mac.com Thu Feb 7 23:39:15 2002 From: bobsavage@mac.com (Bob Savage) Date: Thu, 07 Feb 2002 17:39:15 -0600 Subject: [Pythonmac-SIG] how to locate volumes In-Reply-To: <18324.1013017759@www21.gmx.net> Message-ID: Hi, you don't say which version of the operating system you are using. This makes a big difference, because the old and new ways are totally different. on 2/6/02 11:49 AM, lakay@gmx.net wrote: > Hi Folks, > > I'm new to scripting on the mac, and have difficulties with the > Pathes/Volumes. > I want to locate in script which is running without gui all volumes on a > mac, and search them. > Does anyone have a hint how to retrieve the list of volumes mounted on a > mac? > > thx in advance > > kay From lphillip@lcp.nrl.navy.mil Fri Feb 8 15:00:49 2002 From: lphillip@lcp.nrl.navy.mil (Lee Phillips) Date: Fri, 8 Feb 2002 10:00:49 -0500 Subject: [Pythonmac-SIG] boolean values in appleevents - solution Message-ID: Several people generously responded to my question; one response actually provided a solution to the problem: From Vincent Marchetti, using import aetypes AETrue = aetypes.Boolean(1) # or AEFalse = aetypes.Boolean(0) works perfectly, at least for the two applications I've tested it for: the makedisk.py example and a test I wrote that talks to BBedit. Thank you! From Jack Jansen, > I had also expected the receiving end to do the type cast, if > needed. Most receivers seem to do so I've only experimented with Disk Copy and BBedit, and neither one understands "1" or "0" as boolean. If that's not what you mean, just ignore me; I'm just starting with this and don't understand most of what you said. Bill fancher writes that if he tells Disk Copy create "testImg" saving as file "Nanook:testImg.dmg" leave image mounted 0 a message is sent that he thinks looks ok, and the image is indeed not mounted. When I try this from the Script Editor the image is mounted. When I change it to .... leave image mounted 1 the image is also mounted. When I use the formulations "with leave image mounted" or "without leave image mounted", things work as they should. Maybe we have different versions of Disk Copy, or something. Also, the events sent are different, of course. Am I alone in thinking that appleevents are a fairly hairy system of IAC? From Benjamin.Schollnick@usa.xerox.com Fri Feb 8 15:19:47 2002 From: Benjamin.Schollnick@usa.xerox.com (Schollnick, Benjamin) Date: Fri, 08 Feb 2002 10:19:47 -0500 Subject: [Pythonmac-SIG] boolean values in appleevents - solution Message-ID: > Am I alone in thinking that appleevents are a fairly hairy system of IAC? I agree... I haven't researched it too well, but I'm fairly intimidated with AECapture, and so forth... It seems to work (AppleEvents as IAC), but I've never seen good documentation on it... The biggest help would be guildelines to help prevent version issues...But of course, that's not _directly_ an python issue. - Benjamin From jack@oratrix.com Fri Feb 8 15:35:59 2002 From: jack@oratrix.com (Jack Jansen) Date: Fri, 8 Feb 2002 16:35:59 +0100 Subject: [Pythonmac-SIG] Serious bug with FSSpecs (and GUSI, and MacPython) on OSX In-Reply-To: <04468B7E-1456-11D6-9D1D-00039354009A@mac.com> Message-ID: <8D282CC6-1CA9-11D6-B51B-0030655234CE@oratrix.com> On Tuesday, January 29, 2002, at 02:17 , Mark Day wrote: > Jack, > > You've found a bug in the Carbon File Manager on Mac OS X. > > When you pass in a mangled filename, the File Manager is supposed to > try finding the name literally, then try finding it based by its ID > (the XXXXX part). > > If it finds the file by ID, it is supposed to then derive the mangled > name again and compare it to what you passed in. Carbon isn't doing > this. You can definitely write up a bug and describe how it has data > losing consequences (in the hopes that a fix gets released sooner). I filed the bug, number 2854931, and as of yesterday the state has been set to "verify" and the resolution to "Not to be fixed". I assume that this means "we've looked at it, it's indeed a problem, but we're not going to do anything about it" :-( -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From csmith@blakeschool.org Fri Feb 8 23:36:29 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Fri, 08 Feb 2002 17:36:29 -0600 Subject: [Pythonmac-SIG] precedence bug? Message-ID: Say, I noticed the following on the mac and wonder if others might try this: The python reference (ref/summary.html) it says that 'negation' and 'bitwise not' have higher precedence than exponentiation but this is not born out by the interpreter (MacPython 2.2): >>> ~0**2 -1 >>> (-1)**2 #~0 is -1 so if it were done first this is the equivalent expression 1 >>> -2**2 -4 >>> (-2)**2 #if negation were done first then this would be the equivalent 4 Could someone try this on a Windows or other interpreter and compare results. Is this a bug? (If so, I suppose the easiest fix is to change the documentation.) In terms of the programming world at large, I suppose one should clear up any ambiguity with parenthesis. How is -2**2 handled by other languages? MacFortran returns -4 for -2**2 Chipmunk Basic gives +4 Python 2.2 (Mac) gives -4 /c From mday@mac.com Sat Feb 9 01:24:11 2002 From: mday@mac.com (Mark Day) Date: Fri, 8 Feb 2002 17:24:11 -0800 Subject: [Pythonmac-SIG] precedence bug? In-Reply-To: Message-ID: On Friday, February 8, 2002, at 03:36 PM, Christopher Smith wrote: > The python reference (ref/summary.html) it says that 'negation' and > 'bitwise not' have higher precedence than exponentiation but this is = not > born out by the interpreter (MacPython 2.2): I think you're reading the table wrong. To quote that page: > The following table summarizes the operator precedences=A0in Python, = from=20 > lowest precedence (least binding) to highest precedence (most = binding). And note that exponentiation is listed *after* bitwise not and=20 negative. That means that exponentiation has higher precedence (since=20= it comes later in the table). -Mark From csmith@blakeschool.org Sat Feb 9 03:56:06 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Fri, 08 Feb 2002 21:56:06 -0600 Subject: [Pythonmac-SIG] Re: precedence bug? In-Reply-To: References: Message-ID: mday@mac.com writes: >On Friday, February 8, 2002, at 03:36 PM, Christopher Smith wrote: > >> The python reference (ref/summary.html) it says that 'negation' and >> 'bitwise not' have higher precedence than exponentiation but this is n= ot >> born out by the interpreter (MacPython 2.2): > >I think you're reading the table wrong. To quote that page: > >> The following table summarizes the operator precedences=A0in Python, f= rom=20 >> lowest precedence (least binding) to highest precedence (most binding). > >And note that exponentiation is listed *after* bitwise not and=20 >negative. That means that exponentiation has higher precedence (since=20 >it comes later in the table). Hmmm...here it is (the reference section 5.12) in the 2.1 documents: ** Exponentiation +x, -x Positive, negative ~x Bitwise not and here it is in the 2.2 docs: +x, -x Positive, negative ~x Bitwise not ** Exponentiation I thought I actually had checked that it was the same in the 2.2 docs but I see that I must have looked a the same set of docs (the 2.1 version) twice. Can anyone confirm that the behavior didn't change between versions and that the documentation was just changed to reflect the actua= l behavior? I guess I would still favor not relying on the precedence rules here and go for ease of reading and say it explicitly: -(a**2) or (-a)**2. /c From lakay@gmx.net Fri Feb 8 11:47:53 2002 From: lakay@gmx.net (lakay@gmx.net) Date: Fri, 8 Feb 2002 12:47:53 +0100 (MET) Subject: [Pythonmac-SIG] Better defined: How to locate volumes? Message-ID: <14364.1013168873@www25.gmx.net> Sorry folks, for the unsharp definition of the question. Thanx to Dan Grassi for pointing out the way to do it under MacOS X. Still I am in desperate need of a way to locate Volumes available under MacOS 8.x/9.x. cheers kay -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net From Jack.Jansen@oratrix.nl Sun Feb 10 22:18:54 2002 From: Jack.Jansen@oratrix.nl (Jack Jansen) Date: Sun, 10 Feb 2002 23:18:54 +0100 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. Message-ID: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> Folks, I'm going to give up on supporting Tkinter under Carbon. Over the last week I've lost many hours trying to beat _tkinter.carbon.slb into shape, with no effect. I've tried various devious approaches, such as linking against both CarbonLib and InterfaceLib, using the PseudoCarbonLib from Tk 8.3.2 (when I finally managed to find and download it:-) and a couple of other things, but I simply cannot get it to work: the mouse problem and the delayed even problem keep happening (or I simply can't get the thing to run at all). So, unless someone else wants to take over: there's not going to be Tk support in Carbon MacPython. That, however, means I want to put an earlier issue back to the vote: should MacPython 2.3 be Carbon-only or both classic and Carbon? People overwhelmingly voted for Carbon-only in December, but that was when Tk support under carbon still looked possible. There is a third possibility: that MacPython 2.3 has limited support for classic PPC: a ClassicPythonInterpreter only, no support (or limited support) for a classic IDE and other goodies. This will mean that IDE development can go fully Carbon and not be hampered by classic, while people who want to run occasional Tkinter scripts can still do so. So: let's have your votes, or if there are alternatives I missed: speak up! -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From lmeyn@mail.arc.nasa.gov Sun Feb 10 23:06:53 2002 From: lmeyn@mail.arc.nasa.gov (Larry Meyn) Date: Sun, 10 Feb 2002 15:06:53 -0800 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. In-Reply-To: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> References: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> Message-ID: At 11:18 PM +0100 2/10/02, Jack Jansen wrote: > >That, however, means I want to put an earlier issue back to the >vote: should MacPython 2.3 be Carbon-only or both classic and >Carbon? People overwhelmingly voted for Carbon-only in December, but >that was when Tk support under carbon still looked possible. > >There is a third possibility: that MacPython 2.3 has limited support >for classic PPC: a ClassicPythonInterpreter only, no support (or >limited support) for a classic IDE and other goodies. This will mean >that IDE development can go fully Carbon and not be hampered by >classic, while people who want to run occasional Tkinter scripts can >still do so. I see three MacPython 2.3 options which I'll number: Option 1: Carbon Only Option 2: Carbon & Classic Option 3: Carbon & Interpreter Only Classic I would vote for #1. If I need Tk, I can run 2.2 Classic or earlier. And this frees up Jack's valuable time. If people really feel they need Python 2.3 and newer features along with Tk support, maybe option 3 if it is not too much of a burden on Jack's time. -- ---------------------------------------------------------------------- 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 E-FAX: (425) 944-5526 sent via e-mail ---------------------------------------------------------------------- From csmith@blakeschool.org Sun Feb 10 23:21:35 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Sun, 10 Feb 2002 17:21:35 -0600 Subject: [Pythonmac-SIG] making an alias of a folder Message-ID: I think I put this request out before but haven't received any replies...perhaps there is someone new on the list that could help: Does anyone have a piece of code that successfully makes an alias of a folder on the MacOS? Even if you know how to do this in RealBasic or VisualBasic and could send me that code snippet I think it would be useful. I'm trying to complete a patch to a file copying routine. /c From jwblist@olympus.net Mon Feb 11 01:07:28 2002 From: jwblist@olympus.net (John W Baxter) Date: Sun, 10 Feb 2002 17:07:28 -0800 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. In-Reply-To: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> References: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> Message-ID: At 23:18 +0100 2/10/2002, Jack Jansen wrote: >So, unless someone else wants to take over: there's not going to >be Tk support in Carbon MacPython. As a confirmed non-user of Tk on any platform, I have no problem with that. Mac: I'm so used to Tk problems I haven't tried in ages Unix/Linux: I *could* use Tk on the Linux "side" of my laptop, but I couldn't transport the results to work (we don't use X-Windows except on the machine consoles, which are 15 miles away from me). Windows: I've never seen any reason to install Python on the Windows "side" of my laptop. > >That, however, means I want to put an earlier issue back to the >vote: should MacPython 2.3 be Carbon-only or both classic and >Carbon? People overwhelmingly voted for Carbon-only in December, >but that was when Tk support under carbon still looked possible. > >There is a third possibility: that MacPython 2.3 has limited >support for classic PPC: a ClassicPythonInterpreter only, no >support (or limited support) for a classic IDE and other >goodies. This will mean that IDE development can go fully Carbon >and not be hampered by classic, while people who want to run >occasional Tkinter scripts can still do so. I think your third possibility makes sense (on the assumption that you wouldn't have offered it if it caused you much trouble to create). [I also don't use the IDE...I edit in BBEdit whilst building Python scripts on the Mac...in emacs whilst on Linux.] Because I don't use two things I say I don't care about, I would think my vote would be discounted...perhaps to a half vote. --John -- John Baxter jwblist@olympus.net Port Ludlow, WA, USA From dyoo@hkn.eecs.berkeley.edu Mon Feb 11 03:23:11 2002 From: dyoo@hkn.eecs.berkeley.edu (Danny Yoo) Date: Sun, 10 Feb 2002 19:23:11 -0800 (PST) Subject: [Pythonmac-SIG] Re: [Tutor] making an alias of a folder In-Reply-To: Message-ID: On Sun, 10 Feb 2002, Christopher Smith wrote: > I think I put this request out before but haven't received any > replies...perhaps there is someone new on the list that could help: > > Does anyone have a piece of code that successfully makes an alias of a > folder on the MacOS? Hello! First, I'd better admit I'm clueless about this one... *grin* You might be able to find something in here: http://www.python.org/doc/current/mac/mac.html I don't have a Macintosh available at the moment, so I can't test this, but I believe that the macfs.NewAliasMinimalFromFullPath() is the function that you're looking for: http://www.python.org/doc/current/mac/module-macfs.html Good luck to you! From jack@oratrix.com Mon Feb 11 10:29:04 2002 From: jack@oratrix.com (Jack Jansen) Date: Mon, 11 Feb 2002 11:29:04 +0100 Subject: [Pythonmac-SIG] Re: [Tutor] making an alias of a folder In-Reply-To: Message-ID: <2C5ABB21-1EDA-11D6-8176-0030655234CE@oratrix.com> I was going to point you to the convenience routine macostools.mkalias(src, dst), until I tried it and noticed it didn't work for folders:-( I've filed a sourceforge bug report (#515830), you may want to monitor this if you're interested in when this is fixed. On Monday, February 11, 2002, at 04:23 , Danny Yoo wrote: > On Sun, 10 Feb 2002, Christopher Smith wrote: > >> I think I put this request out before but haven't received any >> replies...perhaps there is someone new on the list that could help: >> >> Does anyone have a piece of code that successfully makes an alias of a >> folder on the MacOS? > > Hello! > > First, I'd better admit I'm clueless about this one... *grin* You might > be > able to find something in here: > > http://www.python.org/doc/current/mac/mac.html > > I don't have a Macintosh available at the moment, so I can't test this, > but I believe that the macfs.NewAliasMinimalFromFullPath() is the > function > that you're looking for: > > http://www.python.org/doc/current/mac/module-macfs.html > > > Good luck to you! > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From jbradley@thinqinteractive.com Mon Feb 11 11:24:37 2002 From: jbradley@thinqinteractive.com (Jon Bradley) Date: Mon, 11 Feb 2002 06:24:37 -0500 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. In-Reply-To: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> Message-ID: > From: Jack Jansen > > So, unless someone else wants to take over: there's not going to > be Tk support in Carbon MacPython. > > That, however, means I want to put an earlier issue back to the > vote: should MacPython 2.3 be Carbon-only or both classic and > Carbon? People overwhelmingly voted for Carbon-only in December, > but that was when Tk support under carbon still looked possible. > > There is a third possibility: that MacPython 2.3 has limited > support for classic PPC: a ClassicPythonInterpreter only, no > support (or limited support) for a classic IDE and other > goodies. This will mean that IDE development can go fully Carbon > and not be hampered by classic, while people who want to run > occasional Tkinter scripts can still do so. > > So: let's have your votes, or if there are alternatives I > missed: speak up! > -- > - Jack Jansen MacApp, please. :) It's going to be around for a long time and supporting it could be a great great thing. I know you'd make my job easier, and would make tons and tons of mac developers psyched. Jon Bradley Multimedia Developer T H I N Q Interactive ------ 693 East Avenue - Suite 102 Rochester, New York 14607 From just@letterror.com Mon Feb 11 14:35:16 2002 From: just@letterror.com (Just van Rossum) Date: Mon, 11 Feb 2002 15:35:16 +0100 Subject: [Pythonmac-SIG] Unix Python on OSX Message-ID: <20020211153527-r01010800-306e7276-0920-010c@10.0.0.23> I'm trying to update my plain vanilla unix Python install to the current CVS state, and now get this error during make: Python/dynload_next.o Python/dynload_next.c Python/dynload_next.c: In function `_PyImport_GetDynLoadFunc': Python/dynload_next.c:113: warning: control reaches end of non-void function Python/dynload_next.c: At top level: Python/dynload_next.c:115: parse error before `return' make: *** [Python/dynload_next.o] Error 1 ./configure was invoked without arguments, which I thought was meant to work these days? Just From csmith@blakeschool.org Mon Feb 11 15:09:35 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Mon, 11 Feb 2002 09:09:35 -0600 Subject: [Pythonmac-SIG] Re: making an alias of a folder In-Reply-To: References: Message-ID: Danny Yoo writes: > >I don't have a Macintosh available at the moment, so I can't test this, >but I believe that the macfs.NewAliasMinimalFromFullPath() is the function >that you're looking for: > > http://www.python.org/doc/current/mac/module-macfs.html I looked at that and didn't initially think that it was going to help but your saying it might be the thing made me look again. Though I don't know if I've got everything right, I do have a routine now that will make an alias of a folder. I don't understand the "relative" option yet, though. Those more in the know about the mac toolbox may see other things that I don't know as well. :-) Until the macostools.makealias is fixed, this is a workaround. Thanks for the nudge, Danny. And thanks for filing a bug report, Jack. /c #### import macfs from Carbon import Res # # Doesn't yet handle the relative option; I'm not sure what this # means for an alias yet. # def mkfolderalias(src, dst, relative=None): """Create an alias to a folder""" alias = macfs.NewAliasMinimalFromFullPath(dst) dstfss = alias.Resolve()[0] Res.FSpCreateResFile(dstfss, 'MACS', 'fdrp', -1) # make it point at the src and update the resource # {see Mac Lib Modules; v 2.2; sect 2.4.2 Alias Objects} # If the source is itself an alias, the new alias # will point at the same thing that the src alias is # pointing at. If the src is *not* a folder it will then # still point at the file but the icon will be a folder # icon until it is updated by the Finder (e.g. after # double clicking on it in the Finder). # alias.Update(src) h = Res.FSpOpenResFile(dstfss, 3) resource = Res.Resource(alias.data) resource.AddResource('alis', 0, '') Res.CloseResFile(h) # turn it into an alias icon; before doing this the # folder icon will be "busy and in use by the system" # dstfss = macfs.FSSpec(dst) dstfinfo = dstfss.GetFInfo() dstfinfo.Flags = dstfinfo.Flags|0x8000 # Alias flag dstfss.SetFInfo(dstfinfo) #### From jack@oratrix.com Mon Feb 11 15:52:27 2002 From: jack@oratrix.com (Jack Jansen) Date: Mon, 11 Feb 2002 16:52:27 +0100 Subject: [Pythonmac-SIG] Unix Python on OSX In-Reply-To: <20020211153527-r01010800-306e7276-0920-010c@10.0.0.23> Message-ID: <58FEAED4-1F07-11D6-8176-0030655234CE@oratrix.com> On Monday, February 11, 2002, at 03:35 , Just van Rossum wrote: > I'm trying to update my plain vanilla unix Python install to the > current CVS > state, and now get this error during make: > > Python/dynload_next.o Python/dynload_next.c > Python/dynload_next.c: In function `_PyImport_GetDynLoadFunc': > Python/dynload_next.c:113: warning: control reaches end of non-void > function > Python/dynload_next.c: At top level: > Python/dynload_next.c:115: parse error before `return' > make: *** [Python/dynload_next.o] Error 1 Ouch, that is a very silly error, there's an extra "}" in the file! The strange thing is that I did actually test my mods, so I don't know when it creeped in... I'll check in the fix when I've tested that it doesn't break anything (at least: doesn't break the standard test suite), in the mean time you can remove line 114 (with the lone "}"). -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From Chris.Barker@noaa.gov Mon Feb 11 16:28:55 2002 From: Chris.Barker@noaa.gov (Chris Barker) Date: Mon, 11 Feb 2002 08:28:55 -0800 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. References: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> Message-ID: <3C67F0E0.66192BF4@noaa.gov> Jack Jansen wrote: > There is a third possibility: that MacPython 2.3 has limited > support for classic PPC: a ClassicPythonInterpreter only, no > support (or limited support) for a classic IDE and other > goodies. This will mean that IDE development can go fully Carbon > and not be hampered by classic, while people who want to run > occasional Tkinter scripts can still do so. I think this is a good option. tkInter never played well with the IDE anyway. Don't put too much work into it, however, as someone pointed out, we can always use tkInter with 2.2, and personally, I'm waiting for wxPython anyway, which will be Carbon only. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From chrisl@fone.net Mon Feb 11 17:28:08 2002 From: chrisl@fone.net (Chris Lumsargis) Date: Mon, 11 Feb 2002 10:28:08 -0700 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. References: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> Message-ID: <3C67FF28.6040605@fone.net> I vote to scrap Tkinter and just go with a Carbon-only MacPython. I have tried to use Tkinter on the mac and other platforms for some time now. I am not convinced that it works on any platform very well. If people are really desperate for Tkinter, the pygame folks have hacked a python for OS X that does have a working Tkinter. But then again, pygame itself has some good GUI possibilities (pyui). Chris Lumsargis-- Jack Jansen wrote: > Folks, > I'm going to give up on supporting Tkinter under Carbon. Over the last > week I've lost many hours trying to beat _tkinter.carbon.slb into > shape, with no effect. I've tried various devious approaches, such as > linking against both CarbonLib and InterfaceLib, using the > PseudoCarbonLib from Tk 8.3.2 (when I finally managed to find and > download it:-) and a couple of other things, but I simply cannot get > it to work: the mouse problem and the delayed even problem keep > happening (or I simply can't get the thing to run at all). > > So, unless someone else wants to take over: there's not going to be Tk > support in Carbon MacPython. > > That, however, means I want to put an earlier issue back to the vote: > should MacPython 2.3 be Carbon-only or both classic and Carbon? People > overwhelmingly voted for Carbon-only in December, but that was when Tk > support under carbon still looked possible. > > There is a third possibility: that MacPython 2.3 has limited support > for classic PPC: a ClassicPythonInterpreter only, no support (or > limited support) for a classic IDE and other goodies. This will mean > that IDE development can go fully Carbon and not be hampered by > classic, while people who want to run occasional Tkinter scripts can > still do so. > > So: let's have your votes, or if there are alternatives I missed: > speak up! > -- > - Jack Jansen > http://www.cwi.nl/~jack - > - If I can't dance I don't want to be part of your revolution -- Emma > Goldman - > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From csmith@blakeschool.org Mon Feb 11 19:57:47 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Mon, 11 Feb 2002 13:57:47 -0600 Subject: [Pythonmac-SIG] import sys; reload(sys) bug? Message-ID: I encountered the following interesting behavior: if sys is reloaded in an IDE script (as import sys; reload(sys)), the output is directed to an enclosable interpreter-like window with the name Python IDE; input is echoed to this new output window (instead of going through the dialog box that is usually generated with input()); the keyboard shortcuts become broken; and File and Edit duplicate menus appear after the Scripts menu item and before the Help menu item. Apparently reloading sys is not a good thing. Should the reload module be modified so sys doesn't get reloaded? Are there other routines that might have a similar bad result when reloaded? Also, would someone be able to field a few questions about how to fill out bug reports. I hate to bother Jack with this. I'm wondering what the normal protocol is: post here for bug confirmation (if in doubt); then post to sourceforge? But it is the posting to the sourceforge that I have questions about and would appreciate someone to walk me though it the first time. /c From mmiller@adobe.com Mon Feb 11 20:12:19 2002 From: mmiller@adobe.com (Martin Miller) Date: Mon, 11 Feb 2002 12:12:19 -0800 Subject: [Pythonmac-SIG] Re: Tkinter support for Carbon - I give up. References: Message-ID: <3C6825A3.26549632@adobe.com> Before I cast a vote, can someone tell me if there's an alternative way to create Python programs with a portable GUI? "Portable" here meaning same things runs on Unix, Carbon MacOS, and 32-bit Windows. Regards, Martin ====================================== pythonmac-sig-request@python.org wrote: > > Send Pythonmac-SIG mailing list submissions to > pythonmac-sig@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/pythonmac-sig > or, via email, send a message with subject or body 'help' to > pythonmac-sig-request@python.org > > You can reach the person managing the list at > pythonmac-sig-admin@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Pythonmac-SIG digest..." > > ------------------------------------------------------------------------ > Today's Topics: > > 1. Tkinter support for Carbon - I give up. (Jack Jansen) > 2. Re: Tkinter support for Carbon - I give up. (Larry Meyn) > 3. making an alias of a folder (Christopher Smith) > 4. Re: Tkinter support for Carbon - I give up. (John W Baxter) > 5. Re: [Tutor] making an alias of a folder (Danny Yoo) > 6. Re: Re: [Tutor] making an alias of a folder (Jack Jansen) > 7. Re: Tkinter support for Carbon - I give up. (Jon Bradley) > 8. Unix Python on OSX (Just van Rossum) > 9. Re: making an alias of a folder (Christopher Smith) > 10. Re: Unix Python on OSX (Jack Jansen) > > ------------------------------------------------------------------------ > > Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. > Date: Sun, 10 Feb 2002 23:18:54 +0100 > From: Jack Jansen > To: pythonmac-sig@python.org > > Folks, > I'm going to give up on supporting Tkinter under Carbon. Over > the last week I've lost many hours trying to beat > _tkinter.carbon.slb into shape, with no effect. I've tried > various devious approaches, such as linking against both > CarbonLib and InterfaceLib, using the PseudoCarbonLib from Tk > 8.3.2 (when I finally managed to find and download it:-) and a > couple of other things, but I simply cannot get it to work: the > mouse problem and the delayed even problem keep happening (or I > simply can't get the thing to run at all). > > So, unless someone else wants to take over: there's not going to > be Tk support in Carbon MacPython. > > That, however, means I want to put an earlier issue back to the > vote: should MacPython 2.3 be Carbon-only or both classic and > Carbon? People overwhelmingly voted for Carbon-only in December, > but that was when Tk support under carbon still looked possible. > > There is a third possibility: that MacPython 2.3 has limited > support for classic PPC: a ClassicPythonInterpreter only, no > support (or limited support) for a classic IDE and other > goodies. This will mean that IDE development can go fully Carbon > and not be hampered by classic, while people who want to run > occasional Tkinter scripts can still do so. > > So: let's have your votes, or if there are alternatives I > missed: speak up! > -- > - Jack Jansen > http://www.cwi.nl/~jack - > - If I can't dance I don't want to be part of your revolution -- > Emma Goldman - > > ------------------------------------------------------------------------ > > Subject: Re: [Pythonmac-SIG] Tkinter support for Carbon - I give up. > Date: Sun, 10 Feb 2002 15:06:53 -0800 > From: Larry Meyn > To: pythonmac-sig@python.org > References: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> > > At 11:18 PM +0100 2/10/02, Jack Jansen wrote: > > > >That, however, means I want to put an earlier issue back to the > >vote: should MacPython 2.3 be Carbon-only or both classic and > >Carbon? People overwhelmingly voted for Carbon-only in December, but > >that was when Tk support under carbon still looked possible. > > > >There is a third possibility: that MacPython 2.3 has limited support > >for classic PPC: a ClassicPythonInterpreter only, no support (or > >limited support) for a classic IDE and other goodies. This will mean > >that IDE development can go fully Carbon and not be hampered by > >classic, while people who want to run occasional Tkinter scripts can > >still do so. > > I see three MacPython 2.3 options which I'll number: > > Option 1: Carbon Only > > Option 2: Carbon & Classic > > Option 3: Carbon & Interpreter Only Classic > > I would vote for #1. If I need Tk, I can run 2.2 Classic or earlier. > And this frees up Jack's valuable time. If people really feel they > need Python 2.3 and newer features along with Tk support, maybe > option 3 if it is not too much of a burden on Jack's time. > > -- > ---------------------------------------------------------------------- > 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 > E-FAX: (425) 944-5526 sent via e-mail > ---------------------------------------------------------------------- > > ------------------------------------------------------------------------ > > Subject: [Pythonmac-SIG] making an alias of a folder > Date: Sun, 10 Feb 2002 17:21:35 -0600 > From: "Christopher Smith" > To: pythonmac-sig@python.org, tutor@python.org, edu-sig@python.org > > I think I put this request out before but haven't received any > replies...perhaps there is someone new on the list that could help: > > Does anyone have a piece of code that successfully makes an alias of a > folder on the MacOS? > > Even if you know how to do this in RealBasic or VisualBasic and could send > me that code snippet I think it would be useful. I'm trying to complete a > patch to a file copying routine. > > /c > > ------------------------------------------------------------------------ > > Subject: Re: [Pythonmac-SIG] Tkinter support for Carbon - I give up. > Date: Sun, 10 Feb 2002 17:07:28 -0800 > From: John W Baxter > To: pythonmac-sig@python.org > References: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> > > At 23:18 +0100 2/10/2002, Jack Jansen wrote: > >So, unless someone else wants to take over: there's not going to > >be Tk support in Carbon MacPython. > > As a confirmed non-user of Tk on any platform, I have no problem with that. > Mac: I'm so used to Tk problems I haven't tried in ages > Unix/Linux: I *could* use Tk on the Linux "side" of my laptop, but I > couldn't transport the results to work (we don't use X-Windows except on > the machine consoles, which are 15 miles away from me). > Windows: I've never seen any reason to install Python on the Windows > "side" of my laptop. > > > > >That, however, means I want to put an earlier issue back to the > >vote: should MacPython 2.3 be Carbon-only or both classic and > >Carbon? People overwhelmingly voted for Carbon-only in December, > >but that was when Tk support under carbon still looked possible. > > > >There is a third possibility: that MacPython 2.3 has limited > >support for classic PPC: a ClassicPythonInterpreter only, no > >support (or limited support) for a classic IDE and other > >goodies. This will mean that IDE development can go fully Carbon > >and not be hampered by classic, while people who want to run > >occasional Tkinter scripts can still do so. > > I think your third possibility makes sense (on the assumption that you > wouldn't have offered it if it caused you much trouble to create). > > [I also don't use the IDE...I edit in BBEdit whilst building Python scripts > on the Mac...in emacs whilst on Linux.] > > Because I don't use two things I say I don't care about, I would think my > vote would be discounted...perhaps to a half vote. > > --John > > -- > John Baxter jwblist@olympus.net Port Ludlow, WA, USA > > ------------------------------------------------------------------------ > > Subject: [Pythonmac-SIG] Re: [Tutor] making an alias of a folder > Date: Sun, 10 Feb 2002 19:23:11 -0800 (PST) > From: Danny Yoo > To: Christopher Smith > CC: pythonmac-sig@python.org, tutor@python.org, edu-sig@python.org > > On Sun, 10 Feb 2002, Christopher Smith wrote: > > > I think I put this request out before but haven't received any > > replies...perhaps there is someone new on the list that could help: > > > > Does anyone have a piece of code that successfully makes an alias of a > > folder on the MacOS? > > Hello! > > First, I'd better admit I'm clueless about this one... *grin* You might be > able to find something in here: > > http://www.python.org/doc/current/mac/mac.html > > I don't have a Macintosh available at the moment, so I can't test this, > but I believe that the macfs.NewAliasMinimalFromFullPath() is the function > that you're looking for: > > http://www.python.org/doc/current/mac/module-macfs.html > > Good luck to you! > > ------------------------------------------------------------------------ > > Subject: Re: [Pythonmac-SIG] Re: [Tutor] making an alias of a folder > Date: Mon, 11 Feb 2002 11:29:04 +0100 > From: Jack Jansen > To: Christopher Smith > CC: Danny Yoo , pythonmac-sig@python.org, > tutor@python.org, edu-sig@python.org > > I was going to point you to the convenience routine > macostools.mkalias(src, dst), until I tried it and noticed it didn't > work for folders:-( > > I've filed a sourceforge bug report (#515830), you may want to monitor > this if you're interested in when this is fixed. > > On Monday, February 11, 2002, at 04:23 , Danny Yoo wrote: > > > On Sun, 10 Feb 2002, Christopher Smith wrote: > > > >> I think I put this request out before but haven't received any > >> replies...perhaps there is someone new on the list that could help: > >> > >> Does anyone have a piece of code that successfully makes an alias of a > >> folder on the MacOS? > > > > Hello! > > > > First, I'd better admit I'm clueless about this one... *grin* You might > > be > > able to find something in here: > > > > http://www.python.org/doc/current/mac/mac.html > > > > I don't have a Macintosh available at the moment, so I can't test this, > > but I believe that the macfs.NewAliasMinimalFromFullPath() is the > > function > > that you're looking for: > > > > http://www.python.org/doc/current/mac/module-macfs.html > > > > > > Good luck to you! > > > > > > _______________________________________________ > > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > > http://mail.python.org/mailman/listinfo/pythonmac-sig > > > -- > - Jack Jansen > http://www.cwi.nl/~jack - > - If I can't dance I don't want to be part of your revolution -- Emma > Goldman - > > ------------------------------------------------------------------------ > > Subject: Re: [Pythonmac-SIG] Tkinter support for Carbon - I give up. > Date: Mon, 11 Feb 2002 06:24:37 -0500 > From: Jon Bradley > To: > > > From: Jack Jansen > > > > So, unless someone else wants to take over: there's not going to > > be Tk support in Carbon MacPython. > > > > That, however, means I want to put an earlier issue back to the > > vote: should MacPython 2.3 be Carbon-only or both classic and > > Carbon? People overwhelmingly voted for Carbon-only in December, > > but that was when Tk support under carbon still looked possible. > > > > There is a third possibility: that MacPython 2.3 has limited > > support for classic PPC: a ClassicPythonInterpreter only, no > > support (or limited support) for a classic IDE and other > > goodies. This will mean that IDE development can go fully Carbon > > and not be hampered by classic, while people who want to run > > occasional Tkinter scripts can still do so. > > > > So: let's have your votes, or if there are alternatives I > > missed: speak up! > > -- > > - Jack Jansen > > MacApp, please. :) It's going to be around for a long time and supporting > it could be a great great thing. I know you'd make my job easier, and would > make tons and tons of mac developers psyched. > > Jon Bradley > Multimedia Developer > > T H I N Q Interactive ------ > 693 East Avenue - Suite 102 > Rochester, New York 14607 > > ------------------------------------------------------------------------ > > Subject: [Pythonmac-SIG] Unix Python on OSX > Date: Mon, 11 Feb 2002 15:35:16 +0100 > From: Just van Rossum > To: pythonmac-sig@python.org > > I'm trying to update my plain vanilla unix Python install to the current CVS > state, and now get this error during make: > > Python/dynload_next.o Python/dynload_next.c > Python/dynload_next.c: In function `_PyImport_GetDynLoadFunc': > Python/dynload_next.c:113: warning: control reaches end of non-void function > Python/dynload_next.c: At top level: > Python/dynload_next.c:115: parse error before `return' > make: *** [Python/dynload_next.o] Error 1 > > ./configure was invoked without arguments, which I thought was meant to work > these days? > > Just > > ------------------------------------------------------------------------ > > Subject: [Pythonmac-SIG] Re: making an alias of a folder > Date: Mon, 11 Feb 2002 09:09:35 -0600 > From: "Christopher Smith" > To: dyoo@hkn.eecs.berkeley.edu > CC: jack@oratrix.com, pythonmac-sig@python.org, edu-sig@python.org, > tutor@python.org > References: > > Danny Yoo writes: > > > > >I don't have a Macintosh available at the moment, so I can't test this, > >but I believe that the macfs.NewAliasMinimalFromFullPath() is the function > >that you're looking for: > > > > http://www.python.org/doc/current/mac/module-macfs.html > > I looked at that and didn't initially think that it was going to help but > your saying it might be the thing made me look again. Though I don't know > if I've got everything right, I do have a routine now that will make an > alias of a folder. I don't understand the "relative" option yet, though. > Those more in the know about the mac toolbox may see other things that I > don't know as well. :-) Until the macostools.makealias is fixed, this is > a workaround. > > Thanks for the nudge, Danny. And thanks for filing a bug report, Jack. > > /c > > #### > import macfs > from Carbon import Res > > # > # Doesn't yet handle the relative option; I'm not sure what this > # means for an alias yet. > # > def mkfolderalias(src, dst, relative=None): > """Create an alias to a folder""" > alias = macfs.NewAliasMinimalFromFullPath(dst) > dstfss = alias.Resolve()[0] > Res.FSpCreateResFile(dstfss, 'MACS', 'fdrp', -1) > > # make it point at the src and update the resource > # {see Mac Lib Modules; v 2.2; sect 2.4.2 Alias Objects} > # If the source is itself an alias, the new alias > # will point at the same thing that the src alias is > # pointing at. If the src is *not* a folder it will then > # still point at the file but the icon will be a folder > # icon until it is updated by the Finder (e.g. after > # double clicking on it in the Finder). > # > alias.Update(src) > h = Res.FSpOpenResFile(dstfss, 3) > resource = Res.Resource(alias.data) > resource.AddResource('alis', 0, '') > Res.CloseResFile(h) > > # turn it into an alias icon; before doing this the > # folder icon will be "busy and in use by the system" > # > dstfss = macfs.FSSpec(dst) > dstfinfo = dstfss.GetFInfo() > dstfinfo.Flags = dstfinfo.Flags|0x8000 # Alias flag > dstfss.SetFInfo(dstfinfo) > #### > > ------------------------------------------------------------------------ > > Subject: Re: [Pythonmac-SIG] Unix Python on OSX > Date: Mon, 11 Feb 2002 16:52:27 +0100 > From: Jack Jansen > To: Just van Rossum > CC: pythonmac-sig@python.org > > On Monday, February 11, 2002, at 03:35 , Just van Rossum wrote: > > > I'm trying to update my plain vanilla unix Python install to the > > current CVS > > state, and now get this error during make: > > > > Python/dynload_next.o Python/dynload_next.c > > Python/dynload_next.c: In function `_PyImport_GetDynLoadFunc': > > Python/dynload_next.c:113: warning: control reaches end of non-void > > function > > Python/dynload_next.c: At top level: > > Python/dynload_next.c:115: parse error before `return' > > make: *** [Python/dynload_next.o] Error 1 > > Ouch, that is a very silly error, there's an extra "}" in the file! The > strange thing is that I did actually test my mods, so I don't know when > it creeped in... > > I'll check in the fix when I've tested that it doesn't break anything > (at least: doesn't break the standard test suite), in the mean time you > can remove line 114 (with the lone "}"). > -- > - Jack Jansen > http://www.cwi.nl/~jack - > - If I can't dance I don't want to be part of your revolution -- Emma > Goldman - From khk@uiah.fi Mon Feb 11 20:31:09 2002 From: khk@uiah.fi (Kari-Hans Kommonen) Date: Mon, 11 Feb 2002 22:31:09 +0200 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. In-Reply-To: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> References: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> Message-ID: as someone who does not have the experience yet, but is looking forward to being able to use python in the future as the main programming environment on the mac: I would vote for a search for a route that delivers the best possible GUI experience. It would be great to be able to use the best features of the mac interface, especially on the X, to the maxxxx but keep all the logic in python. I think that this would open up the chance that python could eventually become THE language of choice for the mac, and consequently, the best user interfaces in the industry. But of course, a cross-platform solution is necessary as well. Maybe there could be two paths? I have to say that the Tkinter has really turned off my enthusiasm for python for any apps that need a gui. I believe it is a benefit for the language and especially the mac version if there is a more pronounced need to invent some other solution. cheers, khk ... At 23:18 +0100 10.2.2002, Jack Jansen wrote: >Folks, >I'm going to give up on supporting Tkinter under Carbon. Over the >last week I've lost many hours trying to beat _tkinter.carbon.slb >into shape, with no effect. I've tried various devious approaches, >such as linking against both CarbonLib and InterfaceLib, using the >PseudoCarbonLib from Tk 8.3.2 (when I finally managed to find and >download it:-) and a couple of other things, but I simply cannot get >it to work: the mouse problem and the delayed even problem keep >happening (or I simply can't get the thing to run at all). > >So, unless someone else wants to take over: there's not going to be >Tk support in Carbon MacPython. > >That, however, means I want to put an earlier issue back to the >vote: should MacPython 2.3 be Carbon-only or both classic and >Carbon? People overwhelmingly voted for Carbon-only in December, but >that was when Tk support under carbon still looked possible. > >There is a third possibility: that MacPython 2.3 has limited support >for classic PPC: a ClassicPythonInterpreter only, no support (or >limited support) for a classic IDE and other goodies. This will mean >that IDE development can go fully Carbon and not be hampered by >classic, while people who want to run occasional Tkinter scripts can >still do so. > >So: let's have your votes, or if there are alternatives I missed: speak up! >-- >- Jack Jansen >http://www.cwi.nl/~jack - >- If I can't dance I don't want to be part of your revolution -- >Emma Goldman - > > >_______________________________________________ >Pythonmac-SIG maillist - Pythonmac-SIG@python.org >http://mail.python.org/mailman/listinfo/pythonmac-sig From Chris.Barker@noaa.gov Mon Feb 11 23:47:45 2002 From: Chris.Barker@noaa.gov (Chris Barker) Date: Mon, 11 Feb 2002 15:47:45 -0800 Subject: [Pythonmac-SIG] Re: Tkinter support for Carbon - I give up. References: <3C6825A3.26549632@adobe.com> Message-ID: <3C6857B2.8D07ACD0@noaa.gov> Martin Miller wrote: > Before I cast a vote, can someone tell me if there's an alternative way > to create Python programs with a portable GUI? "Portable" here meaning > same things runs on Unix, Carbon MacOS, and 32-bit Windows. Kari-Hans Kommonen wrote: > But of course, a cross-platform solution is necessary as well. Maybe > there could be two paths? > I have to say that the Tkinter has really turned off my enthusiasm > for python for any apps that need a gui. I believe it is a benefit > for the language and especially the mac version if there is a more > pronounced need to invent some other solution. I've never like TKinter either, particularly on the Mac. The other options in the running for X-platform GUIs with Python are: PyQT: TrollTech is supporting OS-X. PyQT could be coming for OS-X. Like wxPython, the limitation here is that the PyQT developer does not have a Mac, or Mac experience. Also, QT is pretty expensive to use, so TrollTech will hopefully allow PyQT to be used for free on OS-X, like the Windows version is. PyGTK: I have no idea what the status of GTK on the Mac is. I know it can be used under OS-X, with an X-server; not exactly the native solution we all would like. There is some hope for a more native port, but I'm sure it's a long way in the future. wxPython: Here I think there is real promise. wxWindows, the C++ toolkit that wxPython is based on has seen a great deal of Mac development in the last year, and I understand it is in pretty good shape on the Mac (I havn't tried it, I try to avoid C++). It is carbon based, and thus runs on OS 8.6+ and OS-X. wxPython for OS-X has seen a lot of work recently as well. It's still not quite there, but it is seeing active development. At the moment, I think everyone working on it is doing only OS-X, but as both Python and wxWindows are Carbon based, and run on OS < X, it should be possible to get it working there as well, and the wxMac developer has said that it is important to him that it does, so I think once the OS-X port is working, the OS < X one will come along as well. Again, I havn't tried it, I'm not running OS-X yet. So, the answer is that TK is the only solution that works now, but only as well as it does. Personally, I like wxPython quite a bit, I am using it fairly extensively on Linux and Windows, and waiting with eager anticipation for the Mac version. I really don't have the C++ or MAC programming skills to contribute, but I'll be doing a lot of testing as soon as there is a OS -- I have to say that the Tkinter has really turned off my enthusiasm for python for any apps that need a gui. I believe it is a benefit for the language and especially the mac version if there is a more pronounced need to invent some other solution. I am a novice programmer who has used python for over three years or so. Previously, I have tried perl, Tcl/Tk and C++ (Yuck!!) on Linux, Windoze , and, of course, a mac. Although python is the best language I've run across, so far I have not had any success with RAD GUI programs/languages. I would encourage you not to give up on python. Instead, try out the new stuff that is out there. Some of it may end up as a viable cross platform solution. Of the ones I have played with are: Gumbie - translates a text file into a GUI pyui - uses pygame's graphics library for a GUI Adder - uses XML in some way for a GUI All of these I have used on a hacked version of a Carbonized python developed by the pygame folks. There is also wxPython which I have not used yet, which I hear holds much promise. As an interim solution, you can also use anygui.py on jython where you would code straight python code using the anygui interface. Once a MacPython GUI emerges (probably wxPython), you could then use that code directly on MacPython without much. Chris Lumsargis From kp87@lycos.com Tue Feb 12 14:21:44 2002 From: kp87@lycos.com (kevin parks) Date: Tue, 12 Feb 2002 23:21:44 +0900 Subject: [Pythonmac-SIG] option #1 Message-ID: i could never get Tk to do diddly sqat on my mac (even when i programmed in TCL) so i wouldn't be missing anything probably. wxPython is on the horizon. Your time is valuable so i say later Tk, & later to classic. disclaimer: I am a mega amateur pythonite so please count my vote as 1/128th of a vote. -kevin Go Get It! Send FREE Valentine eCards with Lycos Greetings http://greetings.lycos.com From landauer@got.net Tue Feb 12 15:32:28 2002 From: landauer@got.net (Doug Landauer) Date: Tue, 12 Feb 2002 07:32:28 -0800 Subject: [Pythonmac-SIG] Re: Tkinter support for Carbon - I give up. In-Reply-To: <3C6825A3.26549632@adobe.com> References: <3C6825A3.26549632@adobe.com> Message-ID: At 12:12 PM -0800 2/11/02, Martin Miller wrote: >Before I cast a vote, can someone tell me if there's an alternative way >to create Python programs with a portable GUI? "Portable" here meaning >same things runs on Unix, Carbon MacOS, and 32-bit Windows. The only solution for that today is Jython & Swing. I hope wxWindows and wxPython get there soon, though. Please edit your responses, don't include the entire digest! Chris Barke wrote: >So, the answer is that TK is the only solution that works now, >but only as well as it does. Actually, Jython is the only solution that works now, but (to quote someone) only as well as *it* does. -- Doug L. From mmiller@adobe.com Tue Feb 12 19:43:41 2002 From: mmiller@adobe.com (Martin Miller) Date: Tue, 12 Feb 2002 11:43:41 -0800 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. References: Message-ID: <3C69706D.C11E4A06@adobe.com> > Please edit your responses, don't include the entire digest! Oops, sorry, I realized what I had done a little too late to fix it. Won't happen again. The overall consensus seems to be wxWindows/wxPython...real soon now. I need to take another look at it, as it wasn't even close (on the MacOS) when I played with it last year the beginning of July. I'll also have to size up Jython and try to figure out what the ramifications of using it might be on the other work we've already done. Thanks, Martin ================ On Tue, 12 Feb 2002 at 07:32:28 -0800, Doug Landauer wrote: > > At 12:12 PM -0800 2/11/02, Martin Miller wrote: > >Before I cast a vote, can someone tell me if there's an alternative way > >to create Python programs with a portable GUI? "Portable" here meaning > >same things runs on Unix, Carbon MacOS, and 32-bit Windows. > > The only solution for that today is Jython & Swing. I hope wxWindows > and wxPython get there soon, though. > > Please edit your responses, don't include the entire digest! > > > > Chris Barke wrote: > >So, the answer is that TK is the only solution that works now, > >but only as well as it does. > > Actually, Jython is the only solution that works now, but (to > quote someone) only as well as *it* does. > > > -- Doug L. From Jack.Jansen@oratrix.nl Tue Feb 12 21:09:40 2002 From: Jack.Jansen@oratrix.nl (Jack Jansen) Date: Tue, 12 Feb 2002 22:09:40 +0100 Subject: [Pythonmac-SIG] dynload_next patch - still waiting for feedback Message-ID: Folks, I'm still waiting for feedback on the patch to enable sys.setdlopenflags() and make dynload_next use module-private namespaces by default, overridable with setdlopenflags(). It's patch #511962. (Marcelinus and Manoj: I now realise that you might have missed the previous announcement and you were interested, so this may be the first you hear of this patch). -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From csmith@blakeschool.org Tue Feb 12 23:24:33 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Tue, 12 Feb 2002 17:24:33 -0600 Subject: [Pythonmac-SIG] why the recompile? Message-ID: Hello, I am trying to get an installation distributed on a set of iBooks for a course. I ran compileall on my own installation, copied that to the master server disk and from there it gets copied onto the individual iBooks. The hope was to avoid having to recompile every time a new session is started. (Even though the recompile is done, the installation is restored to the original set during shutdown of the computer.) Here's the problem: when the IDE starts up it recompiles a bunch of files. For example, codeop.py (created July 18,2001 and modified Aug 19,2001) is recompiled even though the existing codeop.pyc in that directory has the creation and modification dates of Feb 7, 2002. There are 68 files in all that are recompiled, located in lib; mac/Lib; Mac/Tools/IDE; and mac/lib/carbon. Why is this recompiling and what can I do to avoid this? The .pyc's date is more recent than the .py's. I confirmed this with the stat() function as well and can see that the time of modification matches that which I see on the file in the Finder. The IDE itself (if it matters) was created at 6:43 pm on 2/7 and the codeop.py file at 11:32 am) /c From dan@grassi.org Tue Feb 12 22:14:09 2002 From: dan@grassi.org (Dan Grassi) Date: Tue, 12 Feb 2002 17:14:09 -0500 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. In-Reply-To: <3C69706D.C11E4A06@adobe.com> Message-ID: On Tuesday, February 12, 2002, at 02:43 PM, Martin Miller wrote: > I'll also have to size up Jython and try to figure out what the > ramifications of using it might be on the other work we've already done. Using Jython for GUI apps and python for non-gui apps is really like using two different languages with great similarities but subtle and substantial differences as well. Perhaps instead of Jython just using SWING from standard python ala import swinginter. It would seem that much more is known about interfacing with Java than interfacing with TK and in the latter case getting TCL involved as well. Java SWING is a fuller GUI which is understood and used much more widely than TK. Also on the Mac OS X there is great support for java in Interface Builder which might well be leveraged. On OS < X there is at least AWT. IMHO this is a better bet than leveraging Interface Builder and Cocoa which is totally Mac specific. Is this possibly doable? Dan From landauer@got.net Tue Feb 12 23:55:40 2002 From: landauer@got.net (Doug Landauer) Date: Tue, 12 Feb 2002 15:55:40 -0800 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. In-Reply-To: References: Message-ID: At 5:14 PM -0500 2/12/02, Dan Grassi wrote: >Perhaps instead of Jython just using SWING from standard python ala import swinginter. [...] On Mac OS X there is great support for java in Interface Builder which might well be leveraged. On OS < X there is at least AWT. Also, you can get a swing.jar that works on OSIMHO this is a better bet than leveraging Interface Builder and Cocoa which is totally Mac specific. > >Is this possibly doable? I think that JPE http://sourceforge.net/projects/jpe is a project to do exactly this. I've been working on a Jython app, but I'd like to use the "email" module, which requires Python 2.2; the latest released Jython is at a 2.1 level. I did a partial back-port of the email module, transforming some of the iterators into separate classes, so that I could use it with Jython. If there's interest and if I don't start work soon, I'll complete that port and post it somewhere. Let me know... -- Doug Landauer landauer@got.net From richard@richardgordon.net Wed Feb 13 00:22:03 2002 From: richard@richardgordon.net (Richard Gordon) Date: Tue, 12 Feb 2002 19:22:03 -0500 Subject: [Pythonmac-SIG] option #1 In-Reply-To: References: Message-ID: At 11:21 PM +0900 2/12/02, kevin parks wrote: >i could never get Tk to do diddly sqat on my mac (even when i >programmed in TCL) so i wouldn't be missing anything probably. >wxPython is on the horizon. Your time is valuable so i say later Tk, >& later to classic. I don't know whether it will be of interest or if it even works, but I was trying to figure out how to use Java servlets from within Zope when somebody on the Zope list pointed me at http://sourceforge.net/projects/jpe JPE apparently provides a bridge between CPython and Java and would let you use Swing for an interface if you don't care to mess around with Jython. I assume that it would work on a Mac and might provide another alternative that isn't too widely known (or at least I didn't know about it). Richard Gordon -------------------- Gordon Design Web Design/Database Development http://www.richardgordon.net From josborne@elp.rr.com Wed Feb 13 01:19:04 2002 From: josborne@elp.rr.com (Jamey Osborne) Date: Tue, 12 Feb 2002 18:19:04 -0700 Subject: [Pythonmac-SIG] A newbie wonders about GUIs References: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> Message-ID: <3C69BF08.6090406@elp.rr.com> Greetings, all. Long time lurker, first time poster..... I'm an extreme newbie to programming with Python and have enjoyed learning Python for some of my CGI projects and see it as a tremendous opportunity to do some programming for my personal needs without going to the expense or headache of CodeWarrior, etc. I have been desiring to do some very customized database work for my PowerBook G3 (running 8.6 and Py2.2) and, since I don't find FileMaker a viable alternative for my needs, I thought of using Python for those projects. I've been avidly ramping up my programming skills (way behind you folks, though) and have run into Gadfly. So far, so good. Then I started into GUIs for my projects. Crunch! So, I thought Jack's call for opinions on the future of Tkinter a good opportunity for an introduction to the group. I've wanted for some time to ask the list for advice on GUIs for my projects, database-oriented and otherwise. As I've clunked along on the newbie line with TKinter and watching your animated discussions about it, I've been wondering how best to implement a front end to my projects. For my Gadfly-based project, at least, I'm inclined at this point to put a web server on my PowerBook and handle the GUI through the CGI model! My apologies if this would be better asked in the Py-Database or Py-Newbie groups but, since it was for a PB G3, I thought I'd venture a try here. I have to say that I'm amazed at the technical proficiency of this group! I always talk about you folks when people around me (usually at work) comment that Mac users aren't that knowledgable.... So, all that behind me.... What advice can the sages of this group offer me with respect to an efficient yet usable front end to Python based projects? Thanks in advance. Jamey Osborne El Paso, Texas From dan@grassi.org Wed Feb 13 01:30:34 2002 From: dan@grassi.org (Dan Grassi) Date: Tue, 12 Feb 2002 20:30:34 -0500 Subject: [Pythonmac-SIG] A newbie wonders about GUIs In-Reply-To: <3C69BF08.6090406@elp.rr.com> Message-ID: <465EF1C1-2021-11D6-A078-00039346A28A@grassi.org> On Tuesday, February 12, 2002, at 08:19 PM, Jamey Osborne wrote: > I'm inclined at this point to put a web server on my PowerBook and > handle the GUI through the CGI model! I'm in the same boat, using html and cgi for my GUI. Don't forget that python has a web server: CGIHTTPServer that can be embedded in your app, that is what I am doing. Also look at SkunkWeb. Dan From bobsavage@mac.com Wed Feb 13 04:10:40 2002 From: bobsavage@mac.com (Bob Savage) Date: Tue, 12 Feb 2002 22:10:40 -0600 Subject: [Pythonmac-SIG] A newbie wonders about GUIs In-Reply-To: <3C69BF08.6090406@elp.rr.com> Message-ID: Since there has been some discussion of GUI alternatives for Python on the Mac, I thought I would mention a couple. I can't say that these are perfect methods for doing your GUI-Mac-Python thing (then again we were talking about wxWindows, Qt, and TK, so...), and these are *NOT* cross-platform options, but they deserve mention: PyObjC - using Cocoa stuff from Python. MacOSX only. Still in an early state, but great promise. AppleScript Glue - With AppleScript Studio being able to make full applications, it probably is possible to integrate with Python by calling abck and forth, and/or launching python subroutines. Might be difficult to pull it of, but we already had suggestions about calling from Python to Java, and above (PyObjC) from Python to Objective-C, so I thought this was worth a mention. Mac modules (Carbon wrappers) - MacPython comes with Python modules which enable you to call through to the traditional MacOS ToolBox routines. For those who don't know what the toolbox is, think an earlier version of Carbon. Of the three methods here, this would have to be considered the most mature method for creating a GUI on the Mac, in fact nothing else really compares with it, in this regard, with the possible exception of TKinter. To sum up: For those new to the MacPython scene, things might look bleak because none of the methods are perfect (stable, cross-platform, feature-rich, and lick-able), but really there are many exciting projects, and, although the introduction of OSX has, in the short run, made things more complicated, it has jump-started several projects (Qt, was already mentioned in this respect). The roads are not paved, but things are exciting -- this is the life of the MacOSX-Pythoniers! Bob From richard@richardgordon.net Wed Feb 13 04:15:25 2002 From: richard@richardgordon.net (Richard Gordon) Date: Tue, 12 Feb 2002 23:15:25 -0500 Subject: [Pythonmac-SIG] A newbie wonders about GUIs In-Reply-To: <3C69BF08.6090406@elp.rr.com> References: <2B499A33-1E74-11D6-A888-003065517236@oratrix.nl> <3C69BF08.6090406@elp.rr.com> Message-ID: At 6:19 PM -0700 2/12/02, Jamey Osborne wrote: >For my Gadfly-based project, at least, I'm inclined at this point to >put a web server on my PowerBook and handle the GUI through the CGI >model! I don't consider that a bad idea at all, altho I'd have to say that I gave up on trying to using pre-OS X Mac for web server stuff quite awhile back (which has nothing much to do with python and a lot to do with apple events). The advantages include: a) Pretty simple "programming" for the display via html b) Extensibility via trick javascript and java c) theoretical standards d) any idiot knows how to use a browser in the event that others need to use your application The disadvantages are: a) having to run a web server b) Inherent cgi limits on write access (but do-able) c) Inherent cgi limits on statefulness (but do-able) d) *entirely* theoretical standards e) printing reports, altho CSS was supposed to take care of most of this Anyway, there are some pretty good development frameworks around if you choose to go the browser route, altho I suspect all of them either require or would work best on OS X. Someone else mentioned SkunkWorks and I will mention Webware, both of which are pretty much do it yourself and are fine, if a little immature, for their intended purposes. At the moment, I am a big fan of the Zope application server which doesn't necessarily even require any python knowledge and does a lot of things very well, especially regarding database access (gadfly is incorporated in it, altho its real gem is the ZODB object database that powers everything). Zope can be heavily customized via external methods in python, perl and java and can even work with php if, for some bizarre reason, you find that appealing. There are over 500 Zope "products" (plugins) that will let you do almost anything you can think of and all are open source, so you can change them if you like. Richard Gordon -------------------- Gordon Design Web Design/Database Development http://www.richardgordon.net From mac@wooz.org Wed Feb 13 06:09:29 2002 From: mac@wooz.org (mac@wooz.org) Date: Wed, 13 Feb 2002 01:09:29 -0500 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. References: Message-ID: <15466.793.431962.459548@anthem.wooz.org> >>>>> "DL" == Doug Landauer writes: DL> I've been working on a Jython app, but I'd like to use the DL> "email" module, which requires Python 2.2; the latest released DL> Jython is at a 2.1 level. DL> I did a partial back-port of the email module, transforming DL> some of the iterators into separate classes, so that I could DL> use it with Jython. If there's interest and if I don't start DL> work soon, I'll complete that port and post it somewhere. I suggest looking at the mimelib version of the email package, i.e. http://sourceforge.net/projects/mimelib/ I'm maintaining this as a separate distutils packages specifically for older Python versions. The one available in mimelib will work with Python 2.1 just fine. Note that version 0.97 is nearly ready and it will have much better multibyte charset support. It's untested w/ Jython AFAIK, and for now you'll need to get it out of cvs (although if you wait a few days, I'll upload a new version). -Barry From gherman@darwin.in-berlin.de Wed Feb 13 07:44:39 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Wed, 13 Feb 2002 08:44:39 +0100 (CET) Subject: [Pythonmac-SIG] Python releases compile "statistics" on OS X Message-ID: <1013586279.3c6a196758a4a@webmail.in-berlin.de> Hi, I had some fun over the last weekend reformatting my Mac, who went suddenly nuts - which is a nice opportunity to do some things from plain scratch... (especially if you did a backup on a brand new disk the day before :-/). Therefor I decided to ignore fink for a while, as it turned out it was about to install some 500 MB for X Windows and friends. Maybe there is a way to tell fink to force-install only what it is expected to, but I don't care for now. I then had some fun compiling a whole lot of Python relea- ses on MacOS X, including 1.5.2, 2.0.1, 2.1.1, 2.1.2, 2.2 and the fresh CVS one - all from SF or Python.org (1.5.2) and on a box in almost virgin state. The result is that only the CVS version (2.3a0) compiles flaw- lessly with a vanilla configure / make (which isn't surprising for 1.5.2 and maybe 2.0)! If anybody insists I can assemble some log files for reviewing... Dinu From Jack.Jansen@oratrix.com Wed Feb 13 09:35:17 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Wed, 13 Feb 2002 10:35:17 +0100 Subject: [Pythonmac-SIG] Python releases compile "statistics" on OS X In-Reply-To: <1013586279.3c6a196758a4a@webmail.in-berlin.de> Message-ID: On Wednesday, February 13, 2002, at 08:44 , Dinu Gherman wrote: > I then had some fun compiling a whole lot of Python relea- > ses on MacOS X, including 1.5.2, 2.0.1, 2.1.1, 2.1.2, 2.2 and > the fresh CVS one - all from SF or Python.org (1.5.2) and on > a box in almost virgin state. > > The result is that only the CVS version (2.3a0) compiles flaw- > lessly with a vanilla configure / make (which isn't surprising > for 1.5.2 and maybe 2.0)! If anybody insists I can assemble > some log files for reviewing... For the older versions I'm not surprised that they didn't build out of the box: Apple changed some important loader features between 10.0 and 10.1. But that 2.2 and 2.1.2 don't compile is surprising: these were done after Mac OS X 10.1, and should have catered for it. I'm interested in your logs for those two. Especially 2.2: I don't think there's going to be a 2.1.3 anyway. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From terabaap@yumpee.org Wed Feb 13 09:37:44 2002 From: terabaap@yumpee.org (Manoj Plakal) Date: Wed, 13 Feb 2002 03:37:44 -0600 Subject: [Pythonmac-SIG] Re: dynload_next patch - still waiting for feedback References: Message-ID: <3C6A33E8.40602@yumpee.org> Hi Jack, Yes, this is the first time I'm seeing this patch. My only comment: does this mean that one needs to know how a module has been compiled and then fiddle with sys.setdlopenflags() if necessary before importing it? Isn't that a problem if you're writing stuff that has to be distributed and needs to import external modules not under your control? Wouldn't it be better to shift the responsibility to the module building phase: a change to distutils which changes the link options between flat or 2-level? Keep it 2-level by default, and only those modules which absolutely need flat can specify an extra distutils option. Manoj Jack Jansen wrote: > Folks, > I'm still waiting for feedback on the patch to enable > sys.setdlopenflags() and make dynload_next use module-private namespaces > by default, overridable with setdlopenflags(). It's patch #511962. > > (Marcelinus and Manoj: I now realise that you might have missed the > previous announcement and you were interested, so this may be the first > you hear of this patch). > -- > - Jack Jansen > http://www.cwi.nl/~jack - > - If I can't dance I don't want to be part of your revolution -- Emma > Goldman - > From Jack.Jansen@oratrix.com Wed Feb 13 10:54:57 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Wed, 13 Feb 2002 11:54:57 +0100 Subject: [Pythonmac-SIG] Re: dynload_next patch - still waiting for feedback In-Reply-To: <3C6A33E8.40602@yumpee.org> Message-ID: <1E720870-2070-11D6-A8C2-0030655234CE@oratrix.com> On Wednesday, February 13, 2002, at 10:37 , Manoj Plakal wrote: > Hi Jack, > > Yes, this is the first time I'm seeing this patch. > > My only comment: does this mean that one needs > to know how a module has been compiled and then > fiddle with sys.setdlopenflags() if necessary > before importing it? Isn't that a problem if you're > writing stuff that has to be distributed and needs > to import external modules not under your control? Yes. The sys.setdlopenflag() was added explicitly for this. If I understood Marcel's comments this is good enough for VTK: apparently there's some framework there that makes sure setdlopenflag() is called before importing the interdependent extension modules. > > Wouldn't it be better to shift the responsibility > to the module building phase: a change to > distutils which changes the link options between > flat or 2-level? Keep it 2-level by default, > and only those modules which absolutely need flat > can specify an extra distutils option. That's what I thought too, but somehow it doesn't work that way. I think that for a plugin the global symbols in the plugin are in the "toplevel" namespace, so if you load the plugin into the application global namespace all symbols from the plugin will appear in the global namespace. Symbols that the plugin references from other dynamic libraries probably won't (but I didn't try this), but our real problem is the plugin initxx() routine which conflicts with the initxx() routine from a different module. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From gherman@darwin.in-berlin.de Wed Feb 13 13:29:45 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Wed, 13 Feb 2002 14:29:45 +0100 (CET) Subject: [Pythonmac-SIG] Compiling PIL Message-ID: <1013606985.3c6a6a495748b@webmail.in-berlin.de> Hi, I've got another compile issue with PIL. After compiling the JPEG and ZLIB libraries I get this when compiling PIL 1.1.2 (with TK turned off): cc -bundle -flat_namespace -undefined suppress ./_imaging.o ./ decode.o ./encode.o ./map.o ./display.o ./outline.o ./path.o libImaging/ libImaging.a -L/usr/local/lib -ljpeg -L/usr/local/lib -lz -o ./_imaging.so /usr/bin/ld: table of contents for archive: /usr/local/lib/libjpeg.a is out of date; rerun ranlib(1) (can't load from it) make: *** [_imaging.so] Error 1 Any ideas? Thanks, Dinu From noon@snow.nrcc.cornell.edu Wed Feb 13 13:57:20 2002 From: noon@snow.nrcc.cornell.edu (William Noon) Date: Wed, 13 Feb 2002 08:57:20 -0500 Subject: [Pythonmac-SIG] Compiling PIL In-Reply-To: Your message of "Wed, 13 Feb 2002 14:29:45 +0100." <1013606985.3c6a6a495748b@webmail.in-berlin.de> Message-ID: <200202131357.IAA20198@snow.nrcc.cornell.edu> Dinu -- Do a ranlib /usr/local/lib/libjpeg.a and re make. --Bill Noon Northeast Regional Climate Center Cornell University > > > Hi, > > I've got another compile issue with PIL. After compiling the > JPEG and ZLIB libraries I get this when compiling PIL 1.1.2 > (with TK turned off): > > cc -bundle -flat_namespace -undefined suppress ./_imaging.o ./ > decode.o ./encode.o ./map.o ./display.o ./outline.o ./path.o libImaging/ > libImaging.a -L/usr/local/lib -ljpeg -L/usr/local/lib -lz -o ./_imaging.so > /usr/bin/ld: table of contents for archive: /usr/local/lib/libjpeg.a is out of > date; rerun ranlib(1) (can't load from it) > make: *** [_imaging.so] Error 1 > > Any ideas? > > Thanks, > > Dinu From just@letterror.com Wed Feb 13 13:58:02 2002 From: just@letterror.com (Just van Rossum) Date: Wed, 13 Feb 2002 14:58:02 +0100 Subject: [Pythonmac-SIG] Compiling PIL In-Reply-To: <1013606985.3c6a6a495748b@webmail.in-berlin.de> Message-ID: <20020213145804-r01010800-924067d6-0920-010c@10.0.0.23> Dinu Gherman wrote: > I've got another compile issue with PIL. After compiling the > JPEG and ZLIB libraries I get this when compiling PIL 1.1.2 > (with TK turned off): > > cc -bundle -flat_namespace -undefined suppress ./_imaging.o ./ > decode.o ./encode.o ./map.o ./display.o ./outline.o ./path.o libImaging/ > libImaging.a -L/usr/local/lib -ljpeg -L/usr/local/lib -lz -o ./_imaging.so > /usr/bin/ld: table of contents for archive: /usr/local/lib/libjpeg.a is out of > date; rerun ranlib(1) (can't load from it) > make: *** [_imaging.so] Error 1 > > Any ideas? try this: $ ranlib /usr/local/lib/libjpeg.a Just From gherman@darwin.in-berlin.de Wed Feb 13 14:17:22 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Wed, 13 Feb 2002 15:17:22 +0100 (CET) Subject: [Pythonmac-SIG] Compiling PIL In-Reply-To: <20020213145804-r01010800-924067d6-0920-010c@10.0.0.23> References: <20020213145804-r01010800-924067d6-0920-010c@10.0.0.23> Message-ID: <1013609842.3c6a7572ac95b@webmail.in-berlin.de> > try this: > $ ranlib /usr/local/lib/libjpeg.a Thanks! Works ok, apart from some buglets in PIL's test code, some of which seems to be related to Python 2.2, maybe. Dinu [localhost:CompileTests/Imaging-1.1.2/MiniTest] dinu% python test.py ***************************************************************** Failure in example: _info(Image.open("Images/lena.jpg")) from line #24 of test.testimage Exception raised: Traceback (most recent call last): File "doctest.py", line 499, in _run_examples_inner exec compile(source, "", "single") in globs File "", line 1, in ? File "test.py", line 12, in _info im.load() File "/usr/local/lib/python2.2/site-packages/PIL/ImageFile.py", line 140, in load d = Image._getdecoder(self.mode, d, a, self.decoderconfig) File "/usr/local/lib/python2.2/site-packages/PIL/Image.py", line 243, in _getdecoder raise IOError, "decoder %s not available" % decoder_name IOError: decoder jpeg not available ***************************************************************** Failure in example: type(im.im) # internal image attribute from line #31 of test.testimage Expected: Got: ***************************************************************** Failure in example: im.getextrema() from line #86 of test.testimage Expected: (64, 128) Got: (0, 0) 1 items had failures: 3 of 40 in test.testimage ***Test Failed*** 3 failures. From just@letterror.com Wed Feb 13 14:56:31 2002 From: just@letterror.com (Just van Rossum) Date: Wed, 13 Feb 2002 15:56:31 +0100 Subject: [Pythonmac-SIG] Compiling PIL In-Reply-To: <1013609842.3c6a7572ac95b@webmail.in-berlin.de> Message-ID: <20020213155648-r01010800-439f5bf1-0920-010c@10.0.0.23> Dinu Gherman wrote: > Thanks! Works ok, apart from some buglets in PIL's test code, > some of which seems to be related to Python 2.2, maybe. No, the problem is not in the test code (I think, I never used it ;-), I had a really hard time to get jpeg support working also. Check the ImConfig.h header in libImaging, and make sure jpeg support is configured. I don't know what the proper way to do this is, but it may help to hand edit that file. PIL is a nightmare to install on OSX :-(. Wish it would use distutils. Just From chrisl@fone.net Wed Feb 13 20:55:43 2002 From: chrisl@fone.net (Chris Lumsargis) Date: Wed, 13 Feb 2002 13:55:43 -0700 Subject: [Pythonmac-SIG] A newbie wonders about GUIs References: Message-ID: <3C6AD2CF.8060900@fone.net> Bob Savage wrote: >Since there has been some discussion of GUI alternatives for Python on the > > I have listened to and done my share of discussion on what is available for python. Since it seems that it is mostly novices and newbies questioning whether python is suitable, my question is, what can we (novices and newbies alike) do to assist in the GUI effort? Assuming most folks are like myself, whose total programming experience is sum totalled by some Hello World and simple I/O applications, is there something we can do? Presently, I am learning Jython for my GUI needs. In learning it, I have noticed certain similarities between Jython's Java swing interface and the coding used for wxwindows, and Tkinter for that matter. It might be worth learning a little swing with Jython as an interim GUI solution. There is a tutorial out there comparing Tkinter and swing called "Jython med swing." Although it is written in a language I don't recognize, the examples and resulting screen shots are good. Regardless what GUI or flavor of python used, it is much superior to most things out there for ease of learning, has tremendous potential for a GUI solutiona, and best of all, it is free! Chris Lumsargis From pfroehli@ics.uci.edu Wed Feb 13 21:05:54 2002 From: pfroehli@ics.uci.edu (Peter H. Froehlich) Date: Wed, 13 Feb 2002 13:05:54 -0800 Subject: [Pythonmac-SIG] A newbie wonders about GUIs In-Reply-To: <3C6AD2CF.8060900@fone.net> Message-ID: <77DFE95B-20C5-11D6-9174-003065F6D8BE@ics.uci.edu> Hi! On Wednesday, February 13, 2002, at 12:55 , Chris Lumsargis wrote: > Presently, I am learning Jython for my GUI needs. In learning it, > I have noticed certain similarities between Jython's Java swing > interface and the coding used for wxwindows, and Tkinter for that > matter. A lot of GUI frameworks are based on similar ideas, many of which basically originated in Smalltalk and its "model-view-controller" approach. Although I have not really tried hacking GUIs in Python yet, it seems to me that one of the better approaches is the AnyGUI project http://anygui.sf.net/ which allows you to use a number of different technologies behind one abstract interface. Maybe you want to take a look at that? Peter -- Peter H. Froehlich []->[!]<-[] http://nil.ics.uci.edu/~phf/ OpenPGP: D465 CBDD D9D2 0D77 C5AF 353E C86C 2AD9 A6E2 309E From owen@astro.washington.edu Wed Feb 13 21:38:20 2002 From: owen@astro.washington.edu (Russell E Owen) Date: Wed, 13 Feb 2002 13:38:20 -0800 Subject: [Pythonmac-SIG] Tkinter support for Carbon - I give up. Message-ID: Jack Jansen wrote: >...should MacPython 2.3 be Carbon-only or both classic and Carbon? People overwhelmingly voted for Carbon-only in December, but that was when Tk support under carbon still looked possible. > >There is a third possibility: that MacPython 2.3 has limited support for classic PPC: a ClassicPythonInterpreter only, no support (or limited support) for a classic IDE and other goodies. This will mean that IDE development can go fully Carbon and not be hampered by classic, while people who want to run occasional Tkinter scripts can still do so. I think it's reasonable to ditch classic, except for 2.2 bug fix updates. 2.2 is an outstanding release and a perfectly reasonable place to freeze code. If having a ClassicInterpreter is REALLY straightforward, don't let me stop you. But otherwise I do not think it is likely to be worth your time. Tkinter has some issues under MacOS 9 anyway. On a related question...do you still see 2.3 being fully integrated on MacOS X, so there's not a separate MacPython and unix python? I'm hoping so, and that the unified version retains the best of each, including: - MacPython's nifty handling of file-file line endings (\r or \n both OK). - The unix version's readline enhancement (up-arrow to edit old commands, etc.) Regards, -- Russell From Chris.Barker@noaa.gov Wed Feb 13 21:05:42 2002 From: Chris.Barker@noaa.gov (Chris Barker) Date: Wed, 13 Feb 2002 13:05:42 -0800 Subject: [Pythonmac-SIG] was: Re:Tkinter support for Carbon - I give up. References: Message-ID: <3C6AD451.3A215A6F@noaa.gov> Russell E Owen wrote: > - MacPython's nifty handling of file-file line endings (\r or \n both OK). Isn't the idea to impliment this in ALL platforms (and the DOS \r\n as well, by the way) -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From prastawa@cs.unc.edu Wed Feb 13 23:23:09 2002 From: prastawa@cs.unc.edu (Marcel Prastawa) Date: Wed, 13 Feb 2002 18:23:09 -0500 Subject: [Pythonmac-SIG] Re: dynload_next patch - still waiting for feedback In-Reply-To: <1E720870-2070-11D6-A8C2-0030655234CE@oratrix.com> Message-ID: Jack and Manoj, First, a brief note/reminder: Steve's dynload_darwin.c have fixed most (all?) of the issues that some of us (or is it just me?) encountered. There's just a minor issue about warning messages. Oh, and there is a licensing issue as well, it uses some code from libdl which uses the Apple license. Maybe Steve could share his thoughts on this issue? Manoj wrote: >> My only comment: does this mean that one needs >> to know how a module has been compiled and then >> fiddle with sys.setdlopenflags() if necessary >> before importing it? Isn't that a problem if you're >> writing stuff that has to be distributed and needs >> to import external modules not under your control? Jack wrote: > Yes. The sys.setdlopenflag() was added explicitly for this. If I > understood Marcel's comments this is good enough for VTK: apparently > there's some framework there that makes sure setdlopenflag() is called > before importing the interdependent extension modules. Actually, VTK does not have any special framework that does this. Things just happened to work together when you set global imports (manually in Python, before actually doing the imports). Now that Manoj brought it up, I realize that this can be a problem. It does give you some flexibility, but maybe using sys.setdlopenflags() is not such a good idea after all. Manoj wrote: >> Wouldn't it be better to shift the responsibility >> to the module building phase: a change to >> distutils which changes the link options between >> flat or 2-level? Keep it 2-level by default, >> and only those modules which absolutely need flat >> can specify an extra distutils option. Jack wrote: > That's what I thought too, but somehow it doesn't work that way. I think > that for a plugin the global symbols in the plugin are in the "toplevel" > namespace, so if you load the plugin into the application global > namespace all symbols from the plugin will appear in the global namespace. > Symbols that the plugin references from other dynamic libraries probably > won't (but I didn't try this), but our real problem is the plugin initxx( > ) routine which conflicts with the initxx() routine from a different > module. To my knowledge, with two-level namespaces, we won't face any problems with undefined symbols and namespace clashes, even with the initxx() functions. Unfortunately, porting UNIX applications to OS X with two-level namespaces can be quite burdensome. So, if possible, I think that the dynamic loader should have some mechanisms to deal with flat namespace issues. Marcel From sdm7g@Virginia.EDU Thu Feb 14 00:17:37 2002 From: sdm7g@Virginia.EDU (Steven Majewski) Date: Wed, 13 Feb 2002 19:17:37 -0500 (EST) Subject: [Pythonmac-SIG] Re: dynload_next patch - still waiting for feedback In-Reply-To: Message-ID: On Wed, 13 Feb 2002, Marcel Prastawa wrote: > Jack and Manoj, > > First, a brief note/reminder: Steve's dynload_darwin.c have fixed most > (all?) of the issues that some of us (or is it just me?) encountered. > There's just a minor issue about warning messages. Oh, and there is a > licensing issue as well, it uses some code from libdl which uses the Apple > license. Maybe Steve could share his thoughts on this issue? My own problems were solved by adding the more specific error messages. I was happy, as long as my hands were already dirty, to try to fix the other reported problems, but I was also happy to let Jack resolve issues of "policy" . I had to construct an artificial example to elicit the duplicate symbol problem: I changed xxmodule to timemodule, and stuck it in a directory with an __init__.py file to make it into a package, so that I could both 'import time' and 'import package.time'. It might be useful if someone could construct a small example that shows the same behaviour as the VTK modules. ( But maybe that's too big of a job ? I don't know. ) I'm sure if I run into an actual problem with porting or writing an extension, I'll quickly become more opinionated! If you mean thoughts about the license: on the one hand, I think any change to a single function of a couple lines is rather contrived -- how can you do the same thing and not "copy" that function ? On the other hand, if it's that trivial (in size) a piece of code, it ought to be considered "fair use" -- quoting a single function is rather like quoting a single sentence. I don't know if the apple license presents a problem -- I though that since there seems to always be a surplus of folks ready to go on at length about the evils of GPL or some other particular license, that someone would quickly step forward to explain it all to me. Maybe I should have posted to comp.lang.python instead of sending it to pythonmac-sig and python-dev. ( Even better: cross post it to comp.lang.perl.misc, comp.lang.c++, gnu.misc.discuss and alt.philosophy along with a few others. Cc: to Tim Rue! ;-) If it does present a problem, I would probably just ask Apple about it and try to get them to release it (i.e. that function) without strings. -- Steve From kp87@lycos.com Thu Feb 14 15:10:21 2002 From: kp87@lycos.com (kevin parks) Date: Fri, 15 Feb 2002 00:10:21 +0900 Subject: [Pythonmac-SIG] IOError: [Errno 1] Operation not permitted Message-ID: Hi all, I am writing a file with Python and most of the time it is cool, but sometimes i get: IOError: [Errno 1] Operation not permitted: 'sys:Desktop Folder:ScoobyDoobyDoo.txt' If i run it again it is fine. It only happens sometimes. MacOS 9.2.1, Python 2.2 I am doing this in the regular interpreter w carbon (not the IDE) Any ideas? cheers, kevin Love is in the Air! Check out Cupid School where you will learn from Matchmaker's best and brightest. At Cupid School you'll learn how to pair up hopeful romantics with one another, based on their personal preferences. If you do well- you'll be rewarded with your own set of love bow and arrows! Good Luck! http://ecard.matchmaker.com/cupid0202/cupid0202.html From csmith@blakeschool.org Thu Feb 14 17:15:37 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Thu, 14 Feb 2002 11:15:37 -0600 Subject: [Pythonmac-SIG] IOError: [Errno 1] Operation not permitted In-Reply-To: References: Message-ID: pythonmac-sig@python.org writes: >Hi all, >I am writing a file with Python and most of the time it is cool, but >sometimes i get: > >IOError: [Errno 1] Operation not permitted: 'sys:Desktop >Folder:ScoobyDoobyDoo.txt' > >If i run it again it is fine. It only happens sometimes. > >MacOS 9.2.1, Python 2.2 I think I've seen this too and thought that it might be that the program stopped while the file was open and the file didn't get closed and is still busy. Perhaps you could try going to the command line and issuing a f.close() command where f is the file object you are working with? /c From ryanwilcox@mac.com Thu Feb 14 19:57:37 2002 From: ryanwilcox@mac.com (Ryan Wilcox) Date: Thu, 14 Feb 2002 14:57:37 -0500 Subject: [Pythonmac-SIG] [2.2 MacCarbon Python] OS.path problems In-Reply-To: Message-ID: <20020214145740-r01010800-3ea7ff04-0920-010c@192.168.42.191> print (os.path.join("HD", "Developer", "OSS-Stable")) will return :HD:Developer:OSS-Stable on my system Is this correct behavior? Thanks, -Ryan ----------------------------------------------------------------- PGP: 0x2F4E9C31 Weblog: http://radio.weblogs.com/0100544/ From Jack.Jansen@oratrix.nl Thu Feb 14 21:00:47 2002 From: Jack.Jansen@oratrix.nl (Jack Jansen) Date: Thu, 14 Feb 2002 22:00:47 +0100 Subject: [Pythonmac-SIG] was: Re:Tkinter support for Carbon - I give up. In-Reply-To: <3C6AD451.3A215A6F@noaa.gov> Message-ID: On Wednesday, February 13, 2002, at 10:05 PM, Chris Barker wrote: > Russell E Owen wrote: >> - MacPython's nifty handling of file-file line endings (\r or >> \n both OK). > > Isn't the idea to impliment this in ALL platforms (and the DOS \r\n as > well, by the way) There's a PEP and a patch in sourceforge for this (it's called Universal Newlines). Up to now I've had only very little feedback on it, it would be very welcome if people could check it out! -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From just@letterror.com Thu Feb 14 21:37:14 2002 From: just@letterror.com (Just van Rossum) Date: Thu, 14 Feb 2002 22:37:14 +0100 Subject: [Pythonmac-SIG] [2.2 MacCarbon Python] OS.path problems In-Reply-To: <20020214145740-r01010800-3ea7ff04-0920-010c@192.168.42.191> Message-ID: <20020214223716-r01010800-ad75cae2-0920-010c@10.0.0.23> Ryan Wilcox wrote: > print (os.path.join("HD", "Developer", "OSS-Stable")) > > will return > > :HD:Developer:OSS-Stable > > on my system > > Is this correct behavior? Yes. I think this is what you want: print os.path.join("HD:", "Developer", "OSS-Stable") Just From dan@gui.com Thu Feb 14 23:39:59 2002 From: dan@gui.com (Dan Shafer) Date: Thu, 14 Feb 2002 15:39:59 -0800 Subject: [Pythonmac-SIG] Finding MacPython After Fink Install In-Reply-To: References: Message-ID: I realize this question is only tangential, but I figure I'm not likely to find a more knowledgeable base of folks to answer it anyhwhere else, so.... I installed Fink on OS X and downloaded, among other things, Python. But I have scoured my system to find out where Fink (I guess that means the Debian installer) put the stupid thing. I find all the files, but not the executable. Asking find, whereis, or locate to help produces no results. Anyone know where Fink stuffs MacPython? -- Dan Shafer, Personal Creativity Trainer and Consultant Trained Hartman Value Profile Analyst http://www.danshafer.com/valueprofile.html From rmore@rmore.net Thu Feb 14 23:50:24 2002 From: rmore@rmore.net (Rod Morehead) Date: Thu, 14 Feb 2002 17:50:24 -0600 Subject: [Pythonmac-SIG] Finding MacPython After Fink Install In-Reply-To: Message-ID: <9D5E39CA-21A5-11D6-A553-000502705B79@rmore.net> On Thursday, February 14, 2002, at 05:39 PM, Dan Shafer wrote: > I realize this question is only tangential, but I figure I'm not likely > to find a more knowledgeable base of folks to answer it anyhwhere else, > so.... > > I installed Fink on OS X and downloaded, among other things, Python. > But I have scoured my system to find out where Fink (I guess that means > the Debian installer) put the stupid thing. I find all the files, but > not the executable. Asking find, whereis, or locate to help produces no > results. > > Anyone know where Fink stuffs MacPython? Try /sw/bin/python --Rod Morehead rmore@rmore.net From adam@switchedonsoftware.com Thu Feb 14 23:51:14 2002 From: adam@switchedonsoftware.com (Adam Eijdenberg) Date: Fri, 15 Feb 2002 10:51:14 +1100 Subject: [Pythonmac-SIG] Finding MacPython After Fink Install In-Reply-To: Message-ID: > I installed Fink on OS X and downloaded, among other things, Python. > But I have scoured my system to find out where Fink (I guess that means > the Debian installer) put the stupid thing. I find all the files, but > not the executable. Asking find, whereis, or locate to help produces no > results. My understanding of Fink is that it will download and install the Unix version of Python and on my system the executable was placed at: /sw/bin/python Adam From dan@gui.com Fri Feb 15 00:13:55 2002 From: dan@gui.com (Dan Shafer) Date: Thu, 14 Feb 2002 16:13:55 -0800 Subject: [Pythonmac-SIG] Finding MacPython After Fink Install In-Reply-To: <9D5E39CA-21A5-11D6-A553-000502705B79@rmore.net> References: <9D5E39CA-21A5-11D6-A553-000502705B79@rmore.net> Message-ID: At 5:50 PM -0600 2/14/02, Rod Morehead wrote: > >Try /sw/bin/python Yep. There it is. Thanks! >--Rod Morehead > rmore@rmore.net -- Dan Shafer, Personal Creativity Trainer and Consultant Trained Hartman Value Profile Analyst http://www.danshafer.com/valueprofile.html From jwblist@olympus.net Fri Feb 15 06:53:20 2002 From: jwblist@olympus.net (John W Baxter) Date: Thu, 14 Feb 2002 22:53:20 -0800 Subject: [Pythonmac-SIG] Finding MacPython After Fink Install In-Reply-To: References: Message-ID: At 15:39 -0800 2/14/2002, Dan Shafer wrote: >I installed Fink on OS X and downloaded, among other things, Python. >But I have scoured my system to find out where Fink (I guess that >means the Debian installer) put the stupid thing. I find all the >files, but not the executable. Asking find, whereis, or locate to >help produces no results. whereis searches the directories in your path. Clearly, Python didn't get placed there (we know the location from other responses now). echo $PATH will show what has been searched. Locate uses a database which is built by the weekly cron task, so something new won't be reported by it until after that has next run after the new thing arrived. Whether the code which builds the database will look in /sw (which I don't have) I don't know. Ah...locate.updatedb takes in this parameter: ---searchpaths Sets the list of directories to be put in the database. So you need to look in /etc/weekly. On my machine, I find that parameter unused in the call to locate.updatedb YMMV (and perhaps will, since Fink has probably arranged to include /sw). > --John -- John Baxter jwblist@olympus.net Port Ludlow, WA, USA From terabaap@yumpee.org Fri Feb 15 11:37:42 2002 From: terabaap@yumpee.org (Manoj Plakal) Date: Fri, 15 Feb 2002 05:37:42 -0600 Subject: [Pythonmac-SIG] Re: dynload_next patch - still waiting for feedback References: Message-ID: <3C6CF306.5030102@yumpee.org> Marcel Prastawa wrote: > Manoj wrote: >>> Wouldn't it be better to shift the responsibility >>> to the module building phase: a change to >>> distutils which changes the link options between >>> flat or 2-level? Keep it 2-level by default, >>> and only those modules which absolutely need flat >>> can specify an extra distutils option. >> > Jack wrote: >> That's what I thought too, but somehow it doesn't work that way. I >> think that for a plugin the global symbols in the plugin are in the >> "toplevel" namespace, so if you load the plugin into the application >> global namespace all symbols from the plugin will appear in the global >> namespace. >> Symbols that the plugin references from other dynamic libraries >> probably won't (but I didn't try this), but our real problem is the >> plugin initxx( >> ) routine which conflicts with the initxx() routine from a different >> module. > > > To my knowledge, with two-level namespaces, we won't face any problems > with undefined symbols and namespace clashes, even with the initxx() > functions. Unfortunately, porting UNIX applications to OS X with > two-level namespaces can be quite burdensome. So, if possible, I think > that the dynamic loader should have some mechanisms to deal with flat > namespace issues. I agree with Marcel. Based on my little knowledge of OS X linking gleaned from Apple's docs, it seems to me that 2-level namespaces provide the right behavior for Python modules, and this is behavior consistent with other platforms too. The only problem, as Marcel pointed out, is that 2-level namespaces require all external references to be resolved at compile time, which is a burden for some modules like VTK. Flat namespaces don't have this problem but then symbols clash across modules. How about leaving it as 2-level namespace by default, and then telling module authors (or builders) that as a special case on OS X, if their module does not build by default, they should choose the flat namespace option and write a small Python stub that fiddles with dlopenflags before importing the real extension module? This will work for things like VTK, won't it? User program stay unaffected, and this can just be some extra distutils options on OS X. Manoj From steve@spvi.com Fri Feb 15 11:51:20 2002 From: steve@spvi.com (Steve Spicklemire) Date: Fri, 15 Feb 2002 06:51:20 -0500 Subject: [Pythonmac-SIG] Building VPython on MacOSX.. In-Reply-To: Message-ID: <53CA5EEA-220A-11D6-A956-0050E480B13C@spvi.com> Hi Folks, I'm trying to build VPython from CVS (www.vpython.org, cvs at sf.net) using "machopython". I'm guessing the easiest way to do this is to use the fink port and XFree86 etc, gtk+, gtkglarea, and so on. I tried this.... and have actually created a 'cvisualmodule.so' on MacOSX 10.1. However when I try to "import cvisual", I get: [vh10-15:~/Development/cvisual] steve% python -c "import cvisual" Traceback (most recent call last): File "", line 1, in ? ImportError: Failure linking new module Checking the source in Python/dynload_next.c it looks like the problem is happening here: if (errString == NULL) { newModule = NSLinkModule(image, pathname, NSLINKMODULE_OPTION_BINDNOW|NSLINKMODULE_OPTION_RETURN_ON_ERROR); if (!newModule) errString = "Failure linking new module"; } so NSLinkModule is returning NULL. Any thoughts on how to debug this? Can otool generate any clues about what's wrong with the shared lib? I can't run gdb on the module since it never loads! I have also seen rumblings about the new dynload_darwin.c. I don't think that my problem is related to that... but I would love to hear opinions. thanks for any help! take care, -steve From Jack.Jansen@oratrix.com Fri Feb 15 12:00:52 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Fri, 15 Feb 2002 13:00:52 +0100 Subject: [Pythonmac-SIG] Re: dynload_next patch - still waiting for feedback In-Reply-To: <3C6CF306.5030102@yumpee.org> Message-ID: On Friday, February 15, 2002, at 12:37 , Manoj Plakal wrote: >> To my knowledge, with two-level namespaces, we won't face any problems >> with undefined symbols and namespace clashes, even with the initxx() >> functions. Unfortunately, porting UNIX applications to OS X with >> two-level namespaces can be quite burdensome. So, if possible, I think >> that the dynamic loader should have some mechanisms to deal with flat >> namespace issues. > > > I agree with Marcel. Ok, I'll change the Python build process to use two-level namespaces everywhere and see how that goes. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From prastawa@cs.unc.edu Fri Feb 15 15:00:16 2002 From: prastawa@cs.unc.edu (Marcel Prastawa) Date: Fri, 15 Feb 2002 10:00:16 -0500 Subject: [Pythonmac-SIG] Building VPython on MacOSX.. In-Reply-To: <53CA5EEA-220A-11D6-A956-0050E480B13C@spvi.com> Message-ID: On Friday, February 15, 2002, at 06:51 , Steve Spicklemire wrote: > I'm trying to build VPython from CVS (www.vpython.org, cvs at sf.net) > using "machopython". I'm guessing the easiest way to do this is to use > the fink port and XFree86 etc, gtk+, gtkglarea, and so on. I tried > this.... and have actually created a 'cvisualmodule.so' on MacOSX 10.1. > However when I try to "import cvisual", I get: > > [vh10-15:~/Development/cvisual] steve% python -c "import cvisual" > Traceback (most recent call last): > File "", line 1, in ? > ImportError: Failure linking new module One common reason for this error is that your binary has unresolved symbols. Try running 'nm' on your binary and make sure that you don't have any undefined symbols (i.e look for lines such as "U _foo"). Steve Majewski posted a patch that makes the error message more informative. I recommend downloading dynload_darwin.c and use it to replace dynload_next.c. If you do have undefined symbols, the new dynamic loader won't solve your problem. At least you'll be able to figure out what went wrong faster. Marcel From dan@grassi.org Fri Feb 15 20:24:24 2002 From: dan@grassi.org (Dan Grassi) Date: Fri, 15 Feb 2002 15:24:24 -0500 Subject: [Pythonmac-SIG] GUIs and Python In-Reply-To: <77DFE95B-20C5-11D6-9174-003065F6D8BE@ics.uci.edu> Message-ID: <00CCDE19-2252-11D6-B463-00039346A28A@grassi.org> There has been a lot of talk about Mac Python GUIs and one major stumbling block seems to be run loops and the interaction between Python's run loop and the GUI's run loop. It seems to me that this is primarily a coupling issue that has a rather easy solution with added benefits as well and is a cross-platform solution as well. Make the GUI a separate task and reduce the coupling to socket/pipe/SOAP connections between Python and the GUI. This meets not only the lose coupling model but enforces it. It also fits the Model/View/Controller approach used by many GUIs. This could be an option for AnyGUI thus allowing cross-platform operation even between machines. It also fits with the HTML as GUI as well as Java/Cocoa/AppleScript as GUI. With some care one of the current stumbling blocks of AnyGUI, that of a program generated GUI, could also be mitigated and the GUI could be built with virtually any GUI GUI design program -- think Interface builder on Mac OS X, it is a killer app! Comments? Dan From prastawa@cs.unc.edu Fri Feb 15 20:52:37 2002 From: prastawa@cs.unc.edu (Marcel Prastawa) Date: Fri, 15 Feb 2002 15:52:37 -0500 Subject: [Pythonmac-SIG] GUIs and Python In-Reply-To: <00CCDE19-2252-11D6-B463-00039346A28A@grassi.org> Message-ID: On Friday, February 15, 2002, at 03:24 , Dan Grassi wrote: > Make the GUI a separate task and reduce the coupling to socket/pipe/SOAP > connections between Python and the GUI. I am not sure if this is what you have in mind... I am using Pyro (Python Remote Objects) for doing distributed computing and one of the things I did was: execute the GUI loop in one process and the other stuff in different processes (you could run them on different machines). The GUI simply performs method calls on the object's proxy, which looks and feels like an ordinary Python object. Here's the link: http://pyro.sourceforge.net Marcel From dan@grassi.org Fri Feb 15 21:42:57 2002 From: dan@grassi.org (Dan Grassi) Date: Fri, 15 Feb 2002 16:42:57 -0500 Subject: [Pythonmac-SIG] GUIs and Python In-Reply-To: Message-ID: On Friday, February 15, 2002, at 03:52 PM, Marcel Prastawa wrote: > I am using Pyro (Python Remote Objects) for doing distributed computing > and one of the things I did was: execute the GUI loop in one process > and the other stuff in different processes (you could run them on > different machines). The GUI simply performs method calls on the > object's proxy, which looks and feels like an ordinary Python object. > > Here's the link: > http://pyro.sourceforge.net While this is interesting and portions are definitely applicable it does address a different problem. While I did mention cross machine that is just a fortuitous out fall, the main usage I envision is on a single machine. One would create a GUI in some language (ObjC, Java, Applescript, etc.) and write some interface code between the various GUI elements and GUI-IAC glue -- which could be potentially automatically generated by using the XLM generated by Interface Builder on the Mac. This would be a full application GUI server somewhat ala X. Python would import a GUI-IAC module, launch the GUI application, control the GUI and receive requests, responses and exceptions from the GUI. Again the GUI-IAC module could potentially be automatically generated the same as the GUI GUI-IAC glue . This is not that much different from a chat server (python) client(Java) that I worked on but usually on the same machine. Of course the Java would be an application, not an applet. BTW, I have looked a "Patterns," Gamma, et.al. and found little to resemble this because they do not deal with network and ORB patterns which are probably the closest. Does anyone have a pattern reference that is close to this? Dan From fgranger@altern.org Sat Feb 16 13:10:28 2002 From: fgranger@altern.org (Francois Granger) Date: Sat, 16 Feb 2002 14:10:28 +0100 Subject: [Pythonmac-SIG] MacOS9, cvs & ssh (sorry) Message-ID: Sorry to come back with this. I am part of the team wich translate the Python documentation to French. The team leader would prefer that each people commit his own changes. So, for the last two days, I got back to review how to do it from a Mac.... Current conclusion is: Mac CVS 3.2 Mac SSH PPC 2.1fc2 But there is something wrong, I can access the cvs, but I don't get commit permissions. Anyway, there is something logically wrong with this since Mac CVS says ssh 1.11 and Mac SSH says ssh2. I put screen capture of the config of both apps online at http://francois.granger.free.fr/MacPython/. Files are screen 2.gif to screen 5.gif ..... From alexp@strata.com Sat Feb 16 21:50:47 2002 From: alexp@strata.com (Alexandre Parenteau) Date: Sat, 16 Feb 2002 13:50:47 -0800 Subject: [Pythonmac-SIG] MacOS9, cvs & ssh (sorry) In-Reply-To: Message-ID: Francois, I'm using MacCvs without MacSSH tunnel. I.e. You can directly put the sourceforge address into the MacCvs host. MacCvs is using the identity of MacSSH (see the ssh preferences). Try that, but it doesn't explain why you cannot commit. Alex. > > Sorry to come back with this. I am part of the team wich translate > the Python documentation to French. The team leader would prefer that > each people commit his own changes. So, for the last two days, I got > back to review how to do it from a Mac.... > > Current conclusion is: > Mac CVS 3.2 > Mac SSH PPC 2.1fc2 > > But there is something wrong, I can access the cvs, but I don't get > commit permissions. > > Anyway, there is something logically wrong with this since Mac CVS > says ssh 1.11 and Mac SSH says ssh2. > > I put screen capture of the config of both apps online at > http://francois.granger.free.fr/MacPython/. Files are screen 2.gif to > screen 5.gif > > ..... > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From fgranger@altern.org Sat Feb 16 22:28:30 2002 From: fgranger@altern.org (Francois Granger) Date: Sat, 16 Feb 2002 23:28:30 +0100 Subject: [Pythonmac-SIG] MacOS9, cvs & ssh (sorry) In-Reply-To: References: Message-ID: At 13:50 -0800 16/02/02, in message Re: [Pythonmac-SIG] MacOS9, cvs & ssh (sorry), Alexandre Parenteau wrote: >Francois, > >I'm using MacCvs without MacSSH tunnel. I.e. You can directly put the >sourceforge address into the MacCvs host. > >MacCvs is using the identity of MacSSH (see the ssh preferences). > >Try that, but it doesn't explain why you cannot commit. Thanks to answer this SOS ;-) But I still can't do what I want, and I still don't understand. I did tried what you suggest: In Mac cvs, in the windows opened by menu Edit->Preferences, in the field 'Host adress', i put: 'cvs.frpython.sourceforge.net' instead of '127.0.0.1' In the field 'Path:' I keep '/cvsroot/frpython' The console window display the following: NEW CVSROOT: fgranger@cvs.frpython.sourceforge.net:/cvsroot/frpython (ssh authentication) cvs -z9 checkout /translation/fr/src/mac (in directory HD:PyDoc:cvs folder:) cvs server: warning: cannot make directory CVS in /: Permission denied cvs [server aborted]: cannot make directory /translation: No such file or directory *****CVS exited normally with code 1***** "Ca me gonfle" Sorry, this is bad french slang.... And I don't have any 'ssh preferences' inside Mac cvs. So I guess that i am missing something obvious, but what ???? From alexp@strata.com Sat Feb 16 23:03:52 2002 From: alexp@strata.com (Alexandre Parenteau) Date: Sat, 16 Feb 2002 15:03:52 -0800 Subject: [Pythonmac-SIG] MacOS9, cvs & ssh (sorry) In-Reply-To: Message-ID: Francois, > cvs -z9 checkout /translation/fr/src/mac (in directory HD:PyDoc:cvs folder:) You should not use the first '/'. Try to checkout 'translation/fr/src/mac' instead. > "Ca me gonfle" > Sorry, this is bad french slang.... > > And I don't have any 'ssh preferences' inside Mac cvs. Well, if you have MacCvs 3.2b9 or superior (I recommend using the last one, b11 I believe), the settings button in the CVSROOT preferences tab lead to the ssh preferences. That should do it, let me know if it gonfles again. Alex. > > So I guess that i am missing something obvious, but what ???? > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From hummelsean@mac.com Sun Feb 17 09:02:21 2002 From: hummelsean@mac.com (Sean Hummel) Date: Sun, 17 Feb 2002 01:02:21 -0800 Subject: [Pythonmac-SIG] Congrats to Guido! Message-ID: <0D315C6B-2385-11D6-9893-003065428512@mac.com> While I know it's not all his fault, Guido has won the FSF Award for creating Python. Congrats Guido! From fgranger@altern.org Sun Feb 17 10:10:20 2002 From: fgranger@altern.org (Francois Granger) Date: Sun, 17 Feb 2002 11:10:20 +0100 Subject: [Pythonmac-SIG] MacOS9, cvs & ssh (sorry) In-Reply-To: References: Message-ID: At 15:03 -0800 16/02/02, in message Re: [Pythonmac-SIG] MacOS9, cvs & ssh (sorry), Alexandre Parenteau wrote: >Well, if you have MacCvs 3.2b9 or superior (I recommend using the last one, >b11 I believe), the settings button in the CVSROOT preferences tab lead to >the ssh preferences. > >That should do it, let me know if it gonfles again. OK, That was it. I still was confusing too many things together. It works now. The only remaining glitche is that the admin probably forgot to give me write access. Thanks a lot for your help. From Philip.Kalmus@nera.com Sun Feb 17 18:01:47 2002 From: Philip.Kalmus@nera.com (Kalmus, Philip) Date: Sun, 17 Feb 2002 18:01:47 -0000 Subject: [Pythonmac-SIG] GUIs and Python Message-ID: <91453AAFAC2ED211BFB500A0C9DDA56402506247@EXCHANGELN> Hi - I am not sure this has been discussed, but would anyone know how to use Excel as a GUI on Mac OS X, similar to the PythonWin extensions? While as far as I am aware there is no complete OLE mechanism on the Mac, realbasic can control the office suite. Is there a way to do the same from Python? Philip ____________________________ Philip A. Kalmus, PhD National Economic Research Associates www.nera.com From Jack.Jansen@oratrix.com Thu Feb 14 22:02:26 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Thu, 14 Feb 2002 23:02:26 +0100 Subject: [Pythonmac-SIG] Re: dynload_next patch - still waiting for feedback In-Reply-To: Message-ID: <881AA7E9-2196-11D6-B71F-003065517236@oratrix.com> On Thursday, February 14, 2002, at 01:17 AM, Steven Majewski wrote: > My own problems were solved by adding the more specific error > messages. > I was happy, as long as my hands were already dirty, to try to fix the > other reported problems, but I was also happy to let Jack > resolve issues > of "policy" . And it turned out that I could go one of two ways: either use your undocumented method or add support for sys.setdlopenflags(). And while I think setdlopenflags() is a gross hack, it is a hack that is apparently already well-established, so I think I prefer it over the "borrowed" function (which also uses an undocumented API, right? Which means it could stop working at any moment...) -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From gherman@darwin.in-berlin.de Mon Feb 18 08:32:38 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Mon, 18 Feb 2002 09:32:38 +0100 Subject: [Pythonmac-SIG] Compiling PIL References: <20020213155648-r01010800-439f5bf1-0920-010c@10.0.0.23> Message-ID: <3C70BC26.DAFD41F1@darwin.in-berlin.de> Just van Rossum wrote: > > No, the problem is not in the test code (I think, I never > used it ;-), I had a really hard time to get jpeg support > working also. Check the ImConfig.h header in libImaging, > and make sure jpeg support is configured. I don't know what > the proper way to do this is, but it may help to hand edit > that file. PIL is a nightmare to install on OSX :-(. Wish > it would use distutils. Had no time to pursue this any further. I emailed Fredrik, but unfortunately it seems like PIL support is no longer what it used to be... Are you saying you got it compiled? If so, is it reproduce- able? Dinu From just@letterror.com Mon Feb 18 09:40:22 2002 From: just@letterror.com (Just van Rossum) Date: Mon, 18 Feb 2002 10:40:22 +0100 Subject: [Pythonmac-SIG] Compiling PIL In-Reply-To: <3C70BC26.DAFD41F1@darwin.in-berlin.de> Message-ID: <20020218104042-r01010800-b8bbeb81-0920-010c@10.0.0.23> Dinu Gherman wrote: > Are you saying you got it compiled? Yes. > If so, is it reproduceable? What are the problems? Just From gherman@darwin.in-berlin.de Mon Feb 18 09:47:16 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Mon, 18 Feb 2002 10:47:16 +0100 (CET) Subject: [Pythonmac-SIG] Compiling PIL In-Reply-To: <20020218104042-r01010800-b8bbeb81-0920-010c@10.0.0.23> References: <20020218104042-r01010800-b8bbeb81-0920-010c@10.0.0.23> Message-ID: <1014025636.3c70cda4245e4@webmail.in-berlin.de> Just van Rossum : > What are the problems? I was scared-off by your comment "nightmare to compile" and couldn't find a time slot for nightmares... ;-) Dinu From seanh@real.com Mon Feb 18 18:30:25 2002 From: seanh@real.com (Sean Hummel) Date: Mon, 18 Feb 2002 10:30:25 -0800 (PST) Subject: [Pythonmac-SIG] Building modules for the command line Python? Message-ID: Okay, so I am looking at making the OSAm module into a module which is useable from the commandline. However, I am a bit confused on one point, is just making a module Carbon compatible, enough of a conversion? Also I'm not very familiar with the Makefile system, and would like a pointer as to where in the Makefiles I should look for the portion that creates modules. Yes I know this is quite a bit to ask, but I am just delving seriously into MacOSX now that I have the chance to do so. From mmiller@adobe.com Tue Feb 19 00:58:11 2002 From: mmiller@adobe.com (Martin Miller) Date: Mon, 18 Feb 2002 16:58:11 -0800 Subject: [Pythonmac-SIG] os.path.normcase() and normpath() Message-ID: <3C71A323.D0125A7A@adobe.com> On Windows, besides converting characters to lowercase, both the os.path.normcase() and os.path.normpath() functions also replace forward-slashes '/' with back-slashes '\\' in the path strings. By itself this seems a little odd because Windows allows forward-slashes to be used as path separators. Regardless, only the conversion to lowercase occurs on the Mac, which is also a case-insensitive os. (The normpath() function also performs some other operations not relevant to this discussion.) For consistency, it seems to me that on the Mac, forward-slashes '/' ought to be replaced with colons ':' in these functions. The Python code for these os-specific path modules is in .../Lib/macpath.py and ntpath.py. Changing this in macpath.py would allow paths in scripts on either platform to be always be written using Posix-style forward-slashes and the norm* functions could be used to convert them to the proper platform-specific format on either platform. This would be helpful in writing scripts that could be run unchanged on multiple platforms, because it would allow path strings in them to be written in a uniform way. It would be an easy modification to make. However it would not be strictly backwards-compatible because forward-slashes are legal in filenames on classic MacOS (don't know about OS X), so perhaps that is why the functions currently leave forward-slashes in path strings alone on Macintosh. Comments? Since I am still very much a Pythonewbie, excuse me if this is a dumb suggestion or I have missed something obvious. Best, Martin From dp@ulaluma.com Tue Feb 19 03:52:59 2002 From: dp@ulaluma.com (Donovan Preston) Date: Mon, 18 Feb 2002 19:52:59 -0800 Subject: [Pythonmac-SIG] Building modules for the command line Python? In-Reply-To: Message-ID: <2AA1DF04-24EC-11D6-A1A9-00039376B1AE@ulaluma.com> On Monday, February 18, 2002, at 10:30 AM, Sean Hummel wrote: > > Okay, so I am looking at making the OSAm module into a module which is > useable from the commandline. However, I am a bit confused on one > point, > is just making a module Carbon compatible, enough of a conversion? > > Also I'm not very familiar with the Makefile system, and would like a > pointer as to where in the Makefiles I should look for the portion that > creates modules. > > Yes I know this is quite a bit to ask, but I am just delving seriously > into MacOSX now that I have the chance to do so. It's pretty trivial, really -- you just need to write a setup.py that uses distutils to compile OSAm.c and ScriptRunner.c into a module. Here's the one I wrote for OSAm on my machine (save it in setup.py in the same directory as the OSAm source) ---------------- from distutils.core import setup, Extension setup(name="OSAm", version="1.0", ext_modules=[ Extension("OSAm", ["OSAm.c", "ScriptRunner.c"], extra_link_args=["-framework", "Carbon"])]) ----------------- Run it with "python setup.py install". It works great. It's cool being able to send apple events from python in the shell. By the way, I have made some modifications to OSAm which adds a "Raw" mode that returns the raw AppleEvent record to Python wrapped in such a way that you can use aetools.unpack on it to convert (sometimes) straight to Python datatypes. It's messy and leaks memory (I think), but if you're interested I'll send it to you. Also, if anyone else is interested, I have made the changes necessary to use gensuitemodule on Mac OS X with UNIX Python. Donovan From Benjamin.Schollnick@usa.xerox.com Tue Feb 19 12:51:22 2002 From: Benjamin.Schollnick@usa.xerox.com (Schollnick, Benjamin) Date: Tue, 19 Feb 2002 07:51:22 -0500 Subject: [Pythonmac-SIG] os.path.normcase() and normpath() Message-ID: > For consistency, it seems to me that on the Mac, forward-slashes '/' > ought to be replaced with colons ':' in these functions. The Python code > for these os-specific path modules is in .../Lib/macpath.py and > ntpath.py. > Changing this in macpath.py would allow paths in scripts on either > platform to be always be written using Posix-style forward-slashes and > the norm* functions could be used to convert them to the proper > platform-specific format on either platform. This would be helpful in > writing scripts that could be run unchanged on multiple platforms, > because it would allow path strings in them to be written in a uniform > way. For cross platform ease of creation, I certainly think this would be helpful, and definitely supported.... It also makes sense... > It would be an easy modification to make. However it would not be > strictly backwards-compatible because forward-slashes are legal in > filenames on classic MacOS (don't know about OS X), so perhaps that is > why the functions currently leave forward-slashes in path strings alone > on Macintosh. What about adding a "Escape" character, or some form of substitution, to allow for this.... For example, let's take a INVALID character in the Macintosh filename character set, and just do a string.replace to change it into the forward-slash. For add a new parameter to the functions.... ...snip.... def (......, fwd_slash_replace = None): if fwd_slash_replace: path.replace ('\', ':') Which should allow older programs use the functions without any major issues?? By the way, if anyone revises the macpath module.... Could you please add some comments including the invalid characters for use in a filename/pathname? Or a list, array, something? The module, IMHO, should document the assumptions about the system, so that we can tell if it's still valid. A list or array would be better, so that we could also check the filenames, etc, for validity....(Add a function or two to check for filename validity?) - Benjamin From Benjamin.Schollnick@usa.xerox.com Tue Feb 19 12:53:51 2002 From: Benjamin.Schollnick@usa.xerox.com (Schollnick, Benjamin) Date: Tue, 19 Feb 2002 07:53:51 -0500 Subject: [Pythonmac-SIG] [HELP!] PC Line Endings? Batch file replacement Message-ID: Folks, I'm attempting to use TWISTEDMATRIX, at home... But failing, due to line endings... I can't find the setting in Stuffit Expander to automatically fix the line endings anymore, so I'm assuming it's not available in there... So, does anyone have a suggestion, on how to fix several hundred text files, without having to use BBEDIT Lite and manually do it? Suggestions *ARE* welcome... - Benjamin From fgranger@altern.org Tue Feb 19 13:42:35 2002 From: fgranger@altern.org (Francois Granger) Date: Tue, 19 Feb 2002 14:42:35 +0100 Subject: [Pythonmac-SIG] [HELP!] PC Line Endings? Batch file replacement In-Reply-To: Message-ID: on 19/02/02 13:53, Schollnick, Benjamin at Benjamin.Schollnick@usa.xerox.com wrote: > Folks, > > I'm attempting to use TWISTEDMATRIX, at home... But failing, due to > line endings... > > I can't find the setting in Stuffit Expander to automatically fix > the line endings anymore, > so I'm assuming it's not available in there... > > So, does anyone have a suggestion, on how to fix several hundred > text files, without > having to use BBEDIT Lite and manually do it? Do it with Bbedit lite in batch mode. Bottom of the find Window, check multifind check boxe, verify the option on the right. Easy. You can as well try Pepper. Www.hekkelman.com. It will do the same. From Benjamin.Schollnick@usa.xerox.com Tue Feb 19 13:48:55 2002 From: Benjamin.Schollnick@usa.xerox.com (Schollnick, Benjamin) Date: Tue, 19 Feb 2002 08:48:55 -0500 Subject: [Pythonmac-SIG] PC Line Endings? Batch file replacement Message-ID: > Do it with Bbedit lite in batch mode. Bottom of the find Window, check > multifind check boxe, verify the option on the right. > Easy. Thanks... I didn't know that BBEdit Lite could do that.... Impressive. - Benjamin From Jack.Jansen@oratrix.com Tue Feb 19 14:54:45 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Tue, 19 Feb 2002 15:54:45 +0100 Subject: [Pythonmac-SIG] os.path.normcase() and normpath() In-Reply-To: <3C71A323.D0125A7A@adobe.com> Message-ID: <9CD8C454-2548-11D6-A3D2-0030655234CE@oratrix.com> On Tuesday, February 19, 2002, at 01:58 , Martin Miller wrote: > On Windows, besides converting characters to lowercase, both the > os.path.normcase() and os.path.normpath() functions also replace > forward-slashes '/' with back-slashes '\\' in the path strings. By > itself this seems a little odd because Windows allows forward-slashes to > be used as path separators. Regardless, only the conversion to lowercase > occurs on the Mac, which is also a case-insensitive os. (The normpath() > function also performs some other operations not relevant to this > discussion.) > > For consistency, it seems to me that on the Mac, forward-slashes '/' > ought to be replaced with colons ':' in these functions. The Python code > for these os-specific path modules is in .../Lib/macpath.py and > ntpath.py. I think you misunderstand what normpath tries to do. The idea is that if there are 2 distinct paths X and Y that point to the same file (i.e. open(X) and open(Y) will open the same file) normpath() will try to make sure that normpath(X) == normpath(Y). It can't always succeed, but it will do it's best, and at the very least if open(X) != open(Y) then normpath(X) != normpath(Y). As a "/" is a completely legal character in a Mac filename your suggested mod would actually break normpath. If you're trying to convert pathnames that look like URLs (or unix pathnames, to an extent) to local convention you should use urllib.url2pathname(). -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From Jack.Jansen@oratrix.com Tue Feb 19 15:07:40 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Tue, 19 Feb 2002 16:07:40 +0100 Subject: [Pythonmac-SIG] Re: dynload_next patch - still waiting for feedback In-Reply-To: <3C6CF306.5030102@yumpee.org> Message-ID: <6AE32A79-254A-11D6-A3D2-0030655234CE@oratrix.com> On Friday, February 15, 2002, at 12:37 , Manoj Plakal wrote: > Based on my little knowledge of OS X linking gleaned > from Apple's docs, it seems to me that 2-level namespaces > provide the right behavior for Python modules, and > this is behavior consistent with other platforms too. I started on making Python completely 2-level namespace based, but it turns out to be non-trivial. I'm running into two problems, and there doesn't seem to be an easy solution for either. The first problem is that _environ is declared in crt0 which is linked into the main program, not into the Python.framework shared library, and I can't use the -bundle-loader trick to tell that to ld as the main program isn't there yet when we're building the shared library. I haven't tried a non-framework Python yet, I think it may not have this problem. The second problem is that the -bundle-loader option for a non-framework Python should point to two different locations (either the installed Python or the one in the build directory) depending on whether we're running the setup.py in the build directory as a part of the initial install of Python or we're running a different setup.py that is building an extension module for an already installed Python. If anyone has suggestions on how to fix these: please speak up! -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From seanh@real.com Tue Feb 19 18:13:12 2002 From: seanh@real.com (Sean Hummel) Date: Tue, 19 Feb 2002 10:13:12 -0800 (PST) Subject: [Pythonmac-SIG] Building modules for the command line Python? In-Reply-To: <2AA1DF04-24EC-11D6-A1A9-00039376B1AE@ulaluma.com> Message-ID: Great! That sounds simple enough, is that all though, I mean that compiles the module but does it link it to the appropriate libraries, such as it could be used from the command line? On Mon, 18 Feb 2002, Donovan Preston wrote: > > On Monday, February 18, 2002, at 10:30 AM, Sean Hummel wrote: > > > > > Okay, so I am looking at making the OSAm module into a module which is > > useable from the commandline. However, I am a bit confused on one > > point, > > is just making a module Carbon compatible, enough of a conversion? > > > > Also I'm not very familiar with the Makefile system, and would like a > > pointer as to where in the Makefiles I should look for the portion that > > creates modules. > > > > Yes I know this is quite a bit to ask, but I am just delving seriously > > into MacOSX now that I have the chance to do so. > > It's pretty trivial, really -- you just need to write a setup.py that > uses distutils to compile OSAm.c and ScriptRunner.c into a module. > > Here's the one I wrote for OSAm on my machine (save it in setup.py in > the same directory as the OSAm source) > > ---------------- > > from distutils.core import setup, Extension > > setup(name="OSAm", > version="1.0", > ext_modules=[ > Extension("OSAm", ["OSAm.c", "ScriptRunner.c"], > extra_link_args=["-framework", "Carbon"])]) > > ----------------- > > Run it with "python setup.py install". It works great. It's cool being > able to send apple events from python in the shell. > > By the way, I have made some modifications to OSAm which adds a "Raw" > mode that returns the raw AppleEvent record to Python wrapped in such a > way that you can use aetools.unpack on it to convert (sometimes) > straight to Python datatypes. It's messy and leaks memory (I think), but > if you're interested I'll send it to you. > > Also, if anyone else is interested, I have made the changes necessary to > use gensuitemodule on Mac OS X with UNIX Python. > > Donovan > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > > From mmiller@adobe.com Tue Feb 19 19:49:32 2002 From: mmiller@adobe.com (Martin Miller) Date: Tue, 19 Feb 2002 11:49:32 -0800 Subject: [Pythonmac-SIG] Re: [HELP!] PC Line Endings? Batch file replacement References: Message-ID: <3C72AC4C.6D80DBC7@adobe.com> On Tue, 19 Feb 2002 07:53:51 -0500, Benjamin.Schollnick@usa.xerox.com wrote: > Folks, > > I'm attempting to use TWISTEDMATRIX, at home... But failing, due to > line endings... > > I can't find the setting in Stuffit Expander to automatically fix > the line endings anymore, > so I'm assuming it's not available in there... > > So, does anyone have a suggestion, on how to fix several hundred > text files, without > having to use BBEDIT Lite and manually do it? > > Suggestions *ARE* welcome... > > - Benjamin As others have pointed out, you can probably do this with BBEdit's batch processing. To answer you original question about Stuffit Expander (I have v5.1.4), if you lanunch it and pick Perferences from the File menu, there's a Cross Platform icon on the right. Select it, and there's a switch titled "Convert text files to Macintosh format:". The two choices are "When a file is know to contain text" and "Never". Hope this helps (it's worth knowing, anyway). Best, Martin From prastawa@cs.unc.edu Tue Feb 19 20:15:22 2002 From: prastawa@cs.unc.edu (Marcel Prastawa) Date: Tue, 19 Feb 2002 15:15:22 -0500 Subject: [Pythonmac-SIG] Building modules for the command line Python? In-Reply-To: Message-ID: <673D19AE-2575-11D6-AC45-000A27942780@cs.unc.edu> On Tuesday, February 19, 2002, at 01:13 , Sean Hummel wrote: > Great! That sounds simple enough, is that all though, I mean that compiles > the module but does it link it to the appropriate libraries, such as it > could be used from the command line? Donovan's example used the extra_link_args argument to specify the framework flag ("-framework Carbon"). I am not familiar with OSAm, so I don't know if you only need Carbon. If you want to link to a library file (not a framework), you'll need to pass the library location and name to setup(). For example, suppose you have the files libblas.a and liblapack.a in /Users/foo/mylibs, you can do the following: from distutils.core import setup, Extension setup(name="Foo", version="1.0", ext_modules=[ Extension("Foo", ["main.c", "bar.c"], library_dirs=["/Users/foo/mylibs"], libraries=["lapack", "blas"], define_macros=["FOOMACRO", "FORTRAN_USE_SUFFIX_"], extra_compile_args=["-O3", "-funroll-loops"], extra_link_args=["-framework", "Carbon"])]) In the example above, I have also defined some macro symbols and passed additional compilation arguments for gcc. You can do a lot more with distutils, the documentation should be available from the Python web page. Marcel From kp87@lycos.com Wed Feb 20 12:58:44 2002 From: kp87@lycos.com (kevin parks) Date: Wed, 20 Feb 2002 21:58:44 +0900 Subject: [Pythonmac-SIG] Re: Pythonmac-SIG digest, Vol 1 #1006 - 10 msgs Message-ID: >>I can't find the setting in Stuffit Expander to automatically fix the line endings anymore,so I'm assuming it's not available in there... stuffit delux does have it. So, does anyone have a suggestion, on how to fix several hundred text files, without having to use BBEDIT Lite and manually do it? BBedit has textchanger, which i haven't used. I use Odd Jobs 1.5 (?) to change the type, creator codes and the line endings all in one swoop. make a little joblet and drag and drop. I have a little joblet called pythonizer that sits on my desktop. -kevin Check out Cupid School where you will learn from Matchmaker's best and brightest. Good Luck! http://ecard.matchmaker.com/cupid0202/cupid0202.html From Benjamin.Schollnick@usa.xerox.com Wed Feb 20 14:01:32 2002 From: Benjamin.Schollnick@usa.xerox.com (Schollnick, Benjamin) Date: Wed, 20 Feb 2002 09:01:32 -0500 Subject: [Pythonmac-SIG] Lineendings with Stuffit Expander Message-ID: I think BBEDit will do what I want, reasonably well... I've back burnered this porject, since I'm having issues with it on the PC.... But.... Never the less, I'm running Stuffit Expander v6.5.1 at home and do not have the cross platform options... I just checked, v5.5 (at work) does have the cross platform options... So somewhere between v5.5 & v6.51 it seems to have been removed. - Benjamin -----Original Message----- From: kevin parks [mailto:kp87@lycos.com] Sent: Wednesday, February 20, 2002 7:59 AM To: pythonmac-sig@python.org Subject: [Pythonmac-SIG] Re: Pythonmac-SIG digest, Vol 1 #1006 - 10 msgs >>I can't find the setting in Stuffit Expander to automatically fix the line endings anymore,so I'm assuming it's not available in there... stuffit delux does have it. So, does anyone have a suggestion, on how to fix several hundred text files, without having to use BBEDIT Lite and manually do it? BBedit has textchanger, which i haven't used. I use Odd Jobs 1.5 (?) to change the type, creator codes and the line endings all in one swoop. make a little joblet and drag and drop. I have a little joblet called pythonizer that sits on my desktop. -kevin Check out Cupid School where you will learn from Matchmaker's best and brightest. Good Luck! http://ecard.matchmaker.com/cupid0202/cupid0202.html _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig From lizardo@urbi.com.br Wed Feb 20 17:04:10 2002 From: lizardo@urbi.com.br (Lizardo H. C. M. Nunes) Date: Wed, 20 Feb 2002 14:04:10 -0300 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science Message-ID: Hi, That's my first experience with Python. I'm a Doctorate Student in Physics and mainly a Fortran guy, I'm interested about using Python as a research tool, specially for number crushing. I hope you can help me providing pointers. Unix Python vs. MacPython: I've got the source files for "Unix" Python 2.2. It built like a charm and passed all tests after "limit stacksize 2048". Now I want to rebuild it with readline support and whatever modules you think I should use. Also, I'd like to hear from you about the "--enable-framework option", is it a good idea? Should I create a Python.app via "./Mac/OSX" ? I thought I'd never experience that, but "Unix" Python left a better impression. I downloaded and installed the full MacPython 2.2, then I run the "ConfigurePythonCarbon". Once I logged back, I run the "Python IDE" and typed "import test.regrtest ; test.regrtest.main()", but the cursor keeps spinning forever---till "force to Quit". Is it right ? I'm running an iMac 333, OS 10.1.2. Science packages: I've seen a couple of packages that I'm interested about, specially numpy and scipy. I really couldn't understand "What is" and "how to install" numpy. I thought it was some kind of "wrapper" for the Fortran LAPACK and BLAS routines among others, but it is surprisingly lite, only 3.3 MB when uncompressed. I'd be glad if you could point me to documentation explaining functionality details about the project and tell me how to build it linking with my own LAPACK and BLAS. Again, what optional packages I should install? Did somebody in the list installed scipy? Any hint that you could share about dependencies and installations on OSX? Is there a GUI support? Also, I would appreciate if you could suggest other scientific packages and address me to essential documentation that could ease the task of learning a new programming language. Thanks a lot, Lizardo H. C. M. Nunes ...But we preach Christ crucified, to the Jews a stumbling block, and to the Greeks foolishness;(...)but God has chosen the foolish things of the world to confound the wise, and God has chosen the weak things of the world to confound the things which are strong;(I Cor.1:23&27) From paul@fxtech.com Wed Feb 20 18:57:05 2002 From: paul@fxtech.com (Paul Miller) Date: Wed, 20 Feb 2002 12:57:05 -0600 Subject: [Pythonmac-SIG] What happened to PyEval_InitThreads? In-Reply-To: Message-ID: <5.1.0.14.2.20020220125549.01fff420@cedar.he.net> I'm trying to use multiple interpreters in my embedded app, and on Mac these don't seem to be present (WITH_THREADS seems to be undefined in ceval.h). I am guessing the Mac version of Python 2.2 is built without threading / multiple interpreters? Is there a work-around? -- Paul T. Miller | paul@fxtech.com | http://www.fxtech.com From woliver1@bigpond.net.au Thu Feb 21 00:02:25 2002 From: woliver1@bigpond.net.au (William Oliver) Date: Thu, 21 Feb 2002 11:02:25 +1100 Subject: [Pythonmac-SIG] [HELP!] PC Line Endings? Batch file replacement In-Reply-To: Message-ID: <49483FA6-265E-11D6-B730-0050E4201B43@bigpond.net.au> On Tuesday, February 19, 2002, at 11:53 PM, Schollnick, Benjamin wrote: > Folks, > > I'm attempting to use TWISTEDMATRIX, at home... But failing, due to > line endings... > > I can't find the setting in Stuffit Expander to automatically fix > the line endings anymore, > so I'm assuming it's not available in there... > > So, does anyone have a suggestion, on how to fix several hundred > text files, without > having to use BBEDIT Lite and manually do it? > > Suggestions *ARE* welcome... > > - Benjamin > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > > There is also the unix command tr, which translates characters. It is available on OS X and all Unix systems I have used before. Like all these things it is a bit more difficult to use, you would have to write a small script to convert a lot of files, but is very powerful and can serve you well when BBEDIT is not around. I can't remember the exact details but typing 'man tr' at the command prompt will tell you more. -Will From adam@switchedonsoftware.com Thu Feb 21 01:25:06 2002 From: adam@switchedonsoftware.com (Adam Eijdenberg) Date: Thu, 21 Feb 2002 12:25:06 +1100 Subject: [Pythonmac-SIG] [HELP!] PC Line Endings? Batch file replacement In-Reply-To: Message-ID: > Suggestions *ARE* welcome... Ben, A while back I got sick of this problem too, so I wrote a some simple C code to accomplish it. Since it is short I'll place it below: #include /* Takes as stdin any stream of characters with Mac/DOS/Unix linebreaks, * and outputs on stdout the same with Unix line breaks. * This can easily be modified to produce Mac or DOS linebreaks if desired. * In this case, simply modify both putchar statements (to output '\r' for Mac, * and two statements for \r then \n for DOS). */ int main () { int ch; short lastCR = 0; while ((ch = getchar ()) != EOF) { if (ch == '\r') { putchar ('\n'); lastCR = 1; } else if (ch == '\n') { if (!lastCR) { putchar ('\n'); } else { lastCR = 0; } } else { putchar (ch); } } } I'm sure that this could easily be written in Python, but I couldn't be bothered looking up the IO routines at the time. To compile this (if you have the Apple dev tools installed), place that code in a file called "main.c" then run "cc main.c". This will generate an executable named "a.out". Rename if you wish. If you don't have the tools, email me off list and I will send you the executable. To translate one file, type at the terminal (note the < and >'s must actually be typed, they are not to signify the "you must change bit"): ./a.out < filename.py > TEMP.py mv TEMP.py filename.py To translate a heap of files, move a.out to the directory where the files are and type these (make sure each command is entered on a new line): sh for filename in *.py do ./a.out < $filename > TEMP.py mv TEMP.py $filename done exit And you should be done! Just make sure that none of your files have spaces in the file names or anything tricky or that shell script will be dangerous. I don't know enough unix to safe it up. A little knowledge is a dangerous thing. :) Hope that helps. Adam From richard@richardgordon.net Thu Feb 21 03:28:14 2002 From: richard@richardgordon.net (Richard Gordon) Date: Wed, 20 Feb 2002 22:28:14 -0500 Subject: [Pythonmac-SIG] [HELP!] PC Line Endings? Batch file replacement In-Reply-To: References: Message-ID: --============_-1197860393==_ma============ Content-Type: text/plain; charset="us-ascii" ; format="flowed" At 12:25 PM +1100 2/21/02, Adam Eijdenberg wrote: >Ben, > >A while back I got sick of this problem too, so I wrote a some >simple C code to accomplish it. Since it is short I'll place it >below: Maybe I misunderstood the question, but it looks like you guys are working too hard. I haven't had much reason to use it lately, but the stuff below is pretty fast and recursively converts whatever is in a tree from unix or dos to mac (juggle the commented lines if you want to limit it to python files or whatever): ------ #!/usr/bin/env python import sys, os, macfs from time import time start = time() fcount = 0 def strip(f): global fcount infh = open(f, 'rb').read() outfh = open(f, 'wb') if infh.find('\r\n') != -1: outfh.write(infh.replace('\n','')) elif infh.find('\n') != -1: outfh.write(infh.replace('\n','\r')) else: pass outfh.close() fcount = fcount + 1 return def run(d): names = os.listdir(d) for name in names: f = d + ':' + name if os.path.isfile(f): strip(f) ## if os.path.splitext(f)[1]=='.py': ## strip(f) else: run(f) if not sys.argv[1:]: fss, ok = macfs.GetDirectory('Folder to search:') if not ok: sys.exit(0) start = time() run(fss.as_pathname()) else: fss = sys.argv[1:] start = time() for arg in fss: run(arg) stop = time() elapsed = stop-start print "Changed %d files in %d seconds" % (fcount, elapsed) #eof Richard Gordon -------------------- Gordon Design Web Design/Database Development http://www.richardgordon.net --============_-1197860393==_ma============ Content-Type: text/enriched; charset="us-ascii" At 12:25 PM +1100 2/21/02, Adam Eijdenberg wrote: Ben, A while back I got sick of this problem too, so I wrote a some simple C code to accomplish it. Since it is short I'll place it below: Maybe I misunderstood the question, but it looks like you guys are working too hard. I haven't had much reason to use it lately, but the stuff below is pretty fast and recursively converts whatever is in a tree from unix or dos to mac (juggle the commented lines if you want to limit it to python files or whatever): ------ Monaco#!/usr/bin/env python import sys, os, macfs from time import time start = time() fcount = 0 def strip(f): global fcount infh = open(f, 'rb').read() outfh = open(f, 'wb') if infh.find('\r\n') != -1: outfh.write(infh.replace('\n','')) elif infh.find('\n') != -1: outfh.write(infh.replace('\n','\r')) else: pass outfh.close() fcount = fcount + 1 return def run(d): names = os.listdir(d) for name in names: f = d + ':' + name if os.path.isfile(f): strip(f) ## if os.path.splitext(f)[1]=='.py': ## strip(f) else: run(f) if not sys.argv[1:]: fss, ok = macfs.GetDirectory('Folder to search:') if not ok: sys.exit(0) start = time() run(fss.as_pathname()) else: fss = sys.argv[1:] start = time() for arg in fss: run(arg) stop = time() elapsed = stop-start print "Changed %d files in %d seconds" % (fcount, elapsed) #eof Richard Gordon -------------------- Gordon Design Web Design/Database Development http://www.richardgordon.net --============_-1197860393==_ma============-- From johann@surfbest.net Thu Feb 21 06:16:04 2002 From: johann@surfbest.net (Johann Hibschman) Date: Wed, 20 Feb 2002 22:16:04 -0800 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science In-Reply-To: Message-ID: <7C77FB39-2692-11D6-9BB1-003065B5C6B6@surfbest.net> On Wednesday, February 20, 2002, at 09:04 AM, Lizardo H. C. M. Nunes wrote: > > That's my first experience with Python. I'm a Doctorate Student in > Physics and mainly a Fortran guy, I'm interested about using Python as > a research tool, specially for number crushing. I hope you can help me > providing pointers. Good luck. I used Unix python as a cornerstone of a computational project. > I've got the source files for "Unix" Python 2.2. It built like a charm > and passed all tests after "limit stacksize 2048". Now I want to > rebuild it with readline support and whatever modules you think I > should use. Also, I'd like to hear from you about the > "--enable-framework option", is it a good idea? Should I create a > Python.app via "./Mac/OSX" ? Readline is pretty good. I wouldn't use the --enable-framework option. I've not been able to get it to work. I end up with a framework containing some binaries that I can't get to execute from the command line, due to path issues. (Perhaps the ObjC [bundle pathForResource: ofType:] methods could be used to make the binaries smarter? I've done something like that for a Lua Framework. But that's a digression.) If I were you, I'd stick with Unix python. It's just easier, if you already have unix experience. (I was migrating code between a Solaris machine and my Mac, so it was a natural fit for me.) > Science packages: > > I've seen a couple of packages that I'm interested about, specially > numpy and scipy. > > I really couldn't understand "What is" and "how to install" numpy. I > thought it was some kind of "wrapper" for the Fortran LAPACK and BLAS > routines among others, but it is surprisingly lite, only 3.3 MB when > uncompressed. Check out numpy.sourceforge.net (I think). They give some data on it. Basically, all numpy does at the core is provide a dense numeric array type which implements basic operations. They take up less memory than python lists would, run faster, have clever slicing behavior, and let you do elementwise operations quickly. Think Matlab or IDL arrays. By default, there's not much support for LAPACK. I'm sure someone has it somewhere. I actually didn't do that much matrix math, just lots of elementwise, so I don't have much experience with that. There is some way to use the native BLAS functions with Numpy. It's a configuration option, which assumes that you have your own native-optimized BLAS routines already installed. If not, it gives just generic support. The generic support was good enough for me, so I didn't look into native BLAS. I don't know about scipy. I've used a few of Konrad Hinsen's scientific modules, mostly the array IO ones. I hope that's enough to point you in the right direction. I had a lot of fun using Python to drive C++ computational codes, but I'm not a real Fortran guru. --Johann From johann@surfbest.net Thu Feb 21 06:05:06 2002 From: johann@surfbest.net (Johann Hibschman) Date: Wed, 20 Feb 2002 22:05:06 -0800 Subject: [Pythonmac-SIG] [HELP!] PC Line Endings? Batch file replacement In-Reply-To: Message-ID: On Wednesday, February 20, 2002, at 05:25 PM, Adam Eijdenberg wrote: >> Suggestions *ARE* welcome... > > A while back I got sick of this problem too, so I wrote a some simple C > code to accomplish it. Since it is short I'll place it below: Also, if you're not afraid of the command line, and you don't think it's heresy, you can just use perl. This is the sort of one-liner thing that I use perl for: perl -i.bak -pe 's/\n/\r/g;' filename1 filename2 ... i.e. "in place, but creating a backup, print each line after substituting \r for \n globally in filename1 filename2 ..." --Johann From steve@spvi.com Thu Feb 21 11:56:47 2002 From: steve@spvi.com (Steve Spicklemire) Date: Thu, 21 Feb 2002 06:56:47 -0500 Subject: [Pythonmac-SIG] Building VPython on MacOSX.. In-Reply-To: Message-ID: <1505FB14-26C2-11D6-A648-0050E480B13C@spvi.com> Thanks Marcel! Good suggestion ;-). I rebuilt python2.2 with Steve's dynload_darwin.c and now I get the following on import: [vh10-15:~/Development/cvisual] steve% python.exe Python 2.2 (#3, Feb 21 2002, 06:48:50) [GCC 2.95.2 19991024 (release)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cvisual Traceback (most recent call last): File "", line 1, in ? ImportError: Failure linking new module. dyld: python.exe Undefined symbols: __._10ostrstream ___10ostrstreami ___ls__7ostreamPCc ___ls__7ostreamPFRB0_RB0 ___ls__7ostreamd _assign__t18string_char_traits1ZcRcRCc _compare__t18string_char_traits1ZcPCcn1Ul _copy__t18string_char_traits1ZcPcPCcUl _ends__FR7ostream _eos__t18string_char_traits1Zc _eq__t18string_char_traits1ZcRCcn1 _length__t18string_char_traits1ZcPC Er.... any idea how I find out what library needs to be added? thanks, -steve On Friday, February 15, 2002, at 10:00 AM, Marcel Prastawa wrote: > > On Friday, February 15, 2002, at 06:51 , Steve Spicklemire wrote: > >> I'm trying to build VPython from CVS (www.vpython.org, cvs at sf.net) >> using "machopython". I'm guessing the easiest way to do this is to use >> the fink port and XFree86 etc, gtk+, gtkglarea, and so on. I tried >> this.... and have actually created a 'cvisualmodule.so' on MacOSX >> 10.1. However when I try to "import cvisual", I get: >> >> [vh10-15:~/Development/cvisual] steve% python -c "import cvisual" >> Traceback (most recent call last): >> File "", line 1, in ? >> ImportError: Failure linking new module > > One common reason for this error is that your binary has unresolved > symbols. Try running 'nm' on your binary and make sure that you don't > have any undefined symbols (i.e look for lines such as > "U _foo"). > > Steve Majewski posted a patch that makes the error message more > informative. I recommend downloading dynload_darwin.c and use it to > replace dynload_next.c. > > If you do have undefined symbols, the new dynamic loader won't solve > your problem. At least you'll be able to figure out what went wrong > faster. > > Marcel From Jack.Jansen@oratrix.nl Thu Feb 21 13:17:34 2002 From: Jack.Jansen@oratrix.nl (Jack Jansen) Date: Thu, 21 Feb 2002 14:17:34 +0100 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science In-Reply-To: <7C77FB39-2692-11D6-9BB1-003065B5C6B6@surfbest.net> Message-ID: <5E4590AA-26CD-11D6-ABF3-003065517236@oratrix.nl> >> I've got the source files for "Unix" Python 2.2. It built like >> a charm and passed all tests after "limit stacksize 2048". Now >> I want to rebuild it with readline support and whatever >> modules you think I should use. Also, I'd like to hear from >> you about the "--enable-framework option", is it a good idea? >> Should I create a Python.app via "./Mac/OSX" ? > > Readline is pretty good. I wouldn't use the --enable-framework > option. I've not been able to get it to work. I end up with a > framework containing some binaries that I can't get to execute > from the command line, due to path issues. Wild guess: maybe you used "make install" to install in stead of "make frameworkinstall"? I know that *I* still do that accidentally from time to time (so it'll be fixed in the next release:-). > (Perhaps the ObjC [bundle pathForResource: ofType:] methods > could be used to make the binaries smarter? I've done > something like that for a Lua Framework. But that's a > digression.) > > If I were you, I'd stick with Unix python. It's just easier, > if you already have unix experience. (I was migrating code > between a Solaris machine and my Mac, so it was a natural fit > for me.) Also, unix Python is the wave of the future. And most, if not all, MacPython functionality will be migrated to it. >> I've seen a couple of packages that I'm interested about, >> specially numpy and scipy. One of the reasons to use MacPython might then be that NumPy is bundled with it, so no need to install or build anything to use it. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From paul@fxtech.com Thu Feb 21 14:20:09 2002 From: paul@fxtech.com (Paul Miller) Date: Thu, 21 Feb 2002 08:20:09 -0600 Subject: [Pythonmac-SIG] PyEval_InitThreads in MacPython 2.2 - maybe I should rephrase my question In-Reply-To: <5.1.0.14.2.20020220125549.01fff420@cedar.he.net> References: Message-ID: <5.1.0.14.2.20020221081602.05f10580@cedar.he.net> I desperately need to get PyEval_InitThreads, AcquireThread, ReleaseThread, etc, working, in order to make use of multiple interpreters. I am using the various functions from ceval.h on Windows but with MacPython 2.2 they are disabled because WITH_THREADS seemed to be undefined. Is this intentional, am I using the configuration wrong, or something else? I want to use the PythonCoreCarbon that comes with the 2.2 installer, so I am hoping there is something simple I am missing. Any ideas? -- Paul T. Miller | paul@fxtech.com | http://www.fxtech.com From jadams@climax.co.uk Thu Feb 21 14:27:50 2002 From: jadams@climax.co.uk (Julian Adams) Date: Thu, 21 Feb 2002 14:27:50 -0000 Subject: universal newlines [was RE: [Pythonmac-SIG] was: Re:Tkinter suppo rt for Carbon - I give up.] Message-ID: <28A7C352840AD511AC9400508BE70AC20465A4@FRUITMACHINE.brighton.climax.co.uk> what's happening with the universal newlines patch - it strikes me as a very useful addition ? > > There's a PEP and a patch in sourceforge for this (it's called > Universal Newlines). Up to now I've had only very little > feedback on it, it would be very welcome if people could check > it out! > -- > - Jack Jansen > http://www.cwi.nl/~jack - > - If I can't dance I don't want to be part of your revolution -- > Emma Goldman - > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > From jadams@climax.co.uk Thu Feb 21 14:30:02 2002 From: jadams@climax.co.uk (Julian Adams) Date: Thu, 21 Feb 2002 14:30:02 -0000 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython a nd Science Message-ID: <28A7C352840AD511AC9400508BE70AC20465A5@FRUITMACHINE.brighton.climax.co.uk> > > If I were you, I'd stick with Unix python. It's just easier, > > if you already have unix experience. (I was migrating code > > between a Solaris machine and my Mac, so it was a natural fit > > for me.) > > Also, unix Python is the wave of the future. And most, if not > all, MacPython functionality will be migrated to it. > I'm rather new to the list - is there any roadmap for where Mac Python and Unix Python on the Mac are going. I have a rather OS X based interest :) Julian From prastawa@cs.unc.edu Thu Feb 21 16:05:27 2002 From: prastawa@cs.unc.edu (Marcel Prastawa) Date: Thu, 21 Feb 2002 11:05:27 -0500 Subject: [Pythonmac-SIG] Building VPython on MacOSX.. In-Reply-To: <1505FB14-26C2-11D6-A648-0050E480B13C@spvi.com> Message-ID: On Thursday, February 21, 2002, at 06:56 , Steve Spicklemire wrote: > Er.... any idea how I find out what library needs to be added? I think that they are C++ library functions. If you are using gcc to compile the extension, you may need to add libstdc++ ("-lstdc++"). It seems that for some reason gcc didn't do this automatically, could be due to your file extension. Marcel From prastawa@cs.unc.edu Thu Feb 21 16:31:52 2002 From: prastawa@cs.unc.edu (Marcel Prastawa) Date: Thu, 21 Feb 2002 11:31:52 -0500 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science In-Reply-To: Message-ID: <82FCCCB5-26E8-11D6-B6F7-000A27942780@cs.unc.edu> On Wednesday, February 20, 2002, at 12:04 , Lizardo H. C. M. Nunes wrote: > I'm interested about using Python as a research tool, specially for > number crushing. I hope you can help me providing pointers. I am also using Python for some number crunching and scientific visualization. I am using UNIX Python, as I am more familiar with UNIX programming. > I really couldn't understand "What is" and "how to install" numpy. I > thought it was some kind of "wrapper" for the Fortran LAPACK and BLAS > routines among others, but it is surprisingly lite, only 3.3 MB when > uncompressed. NumPy is an extension that provides facilities for doing array manipulation. It does act as a wrapper for a small number of LAPACK and BLAS routines, but you normally would write your own extension on top of NumPy to access other routines. More at http://www.pfdubois.com/numpy > I'd be glad if you could point me to documentation explaining > functionality details about the project and tell me how to build it > linking with my own LAPACK and BLAS. Again, what optional packages I > should install? Linking with your own LAPACK and BLAS is rather simple. You need to edit setup.py and comment about 3 lines and tell it where the libraries are. The NumPy documentation could tell you more. I could send you my setup.py file if you want it. > Also, I would appreciate if you could suggest other scientific packages > and address me to essential documentation that could ease the task of > learning a new programming language. Search google for "Konrad Hinsen" and "Travis Oliphant". They have written some other scientific extensions and documentations/tutorials as well. If you want to do some visualization, VTK has a nice Python interface. The library is a bit bulky though. http://public.kitware.com/VTK Marcel From ryanwilcox@mac.com Thu Feb 21 17:24:38 2002 From: ryanwilcox@mac.com (Ryan Wilcox) Date: Thu, 21 Feb 2002 12:24:38 -0500 Subject: [Pythonmac-SIG] [HELP!] PC Line Endings? Batch file replacement In-Reply-To: Message-ID: <20020221122441-r01010800-5c0386e3-0920-010c@129.21.139.65> On Wednesday, February 20, 2002, at 10:28 PM, richard@richardgordon.net (Richard Gordon) wrote: >At 12:25 PM +1100 2/21/02, Adam Eijdenberg wrote: >>Ben, >> >>A while back I got sick of this problem too, so I wrote a some >>simple C code to accomplish it. Since it is short I'll place it >>below: > >Maybe I misunderstood the question, but it looks like you guys are >working too hard.... [snip Richard's python script] As a firm believer of giving back to the community, here are my modifications to Richard's script. #1) Allows user to specify what type (pc, mac, unix) of lineendings they want #2) Got it to work under MacPython and UnixPython #3) More detailed output to user #4) Removed time logging stuff... couldn't get it to work under my UnixPython for some reason :-( #5) Handles .DS_Store files better (by skipping them) Hope this helps someone, -Ryan Wilcox -------- #!/usr/bin/env python #created by Richard Gordon #posted to PythonMac-SIG Feb 20, 2002 #modified by WD-rpw Feb 20, 2002 #call it by [name] lineendingtype folder #eg: switchendings pc ~/Desktop/temp/ import sys, os fcount = 0 def strip(f, tp): global fcount infh = open(f, 'rb').read() outfh = open(f, 'wb') if infh.find('\r\n') != -1: if (tp == "mac"): outfh.write(infh.replace('\n','')) print " translated from pc to mac" else: if (tp == "unix"): outfh.write(infh.replace('\r','')) print " translated from pc to unix" elif infh.find('\n') != -1: if (tp == "mac"): outfh.write(infh.replace('\n','\r')) print " translated from unix to mac" elif (tp == "pc"): outfh.write(infh.replace('\n','\r\n')) print " translated from unix to pc" elif infh.find('\r') != -1: if (tp == "unix"): outfh.write(infh.replace('\r','\n')) print " translated from mac to unix" elif (tp == "pc"): outfh.write(infh.replace('\r','\r\n')) print " translated from mac to pc" else: pass outfh.close() fcount = fcount + 1 return def run(d,tp): names = os.listdir(d) for name in names: f = d + name if os.path.isfile(f): if os.path.splitext(f)[1]!='.DS_Store': print "processing: " + name strip(f, tp) else: run(f, tp) if not sys.argv[1:]: #we're on a mac now, baby import macfs, EasyDialogs from time import time fss, ok = macfs.GetDirectory('Folder to search:') if not ok: sys.exit(0) targetplatform = EasyDialogs.AskString\ ("convert line endings to: pc, mac, unix", "pc") run(fss.as_pathname(), targetplatform) else: targetplatform = sys.argv[1] fss = sys.argv[2:] for arg in fss: run(arg, targetplatform) print "Changed %d files" % (fcount) print "done" From Chris.Barker@noaa.gov Thu Feb 21 16:36:42 2002 From: Chris.Barker@noaa.gov (Chris Barker) Date: Thu, 21 Feb 2002 08:36:42 -0800 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science References: Message-ID: <3C75221A.ACBAB019@noaa.gov> "Lizardo H. C. M. Nunes" wrote: > I'm interested about using Python as a > research tool, specially for number crushing. I hope you can help me > providing pointers. Good choice. It's an excellent tool for that kind of thing. > I thought I'd never experience that, but "Unix" Python left a better > impression. Don't be surprised. Python is a programming language, and *nix has always been a fabulous development environment. The Mac was designed to counter exactly that: with the PC revolution, most users were NOT developers, so the Mac was designed to provide a comfortable environment for everyday use by foolks that do not program. IT has always been an uncomfortable environment for programming. To Use it effectively, and entire programming enviroment has to be provide, e.g. MPW and CodeWarrior. MacPython provides the IDE, but it really isn't quite feature complete. I am far more productive with emacs and the Linux command line than I am with MacPython. > I've seen a couple of packages that I'm interested about, specially > numpy NumPy is critical for this kind of work, and is a fabulaous package. >and scipy. SciPy has some nice stuf, and is getting better and more complete. It aims ot have everythong MATLAB has and more, but really isn't there yet. However, it seems a great deal of the scientific programming with Python community is contributing to it, so I would certainly look there first for anythong you might need. Also, please contribute anything you might wroite yourself that would be of general interest. > Did somebody in the list installed scipy? Any hint that you could share > about dependencies and installations on OSX? Is there a GUI support? SciPy is using wxPython for it's native GUI stuff, but wxPython is not yet running on OS-X. It is being worked on, and I expect it will be available in the next few months. Another good place to contribute, by the way. In the meantime, SciPy uses PyGnuplot, and I'm not sure if gnuplot os available on OS-X, but it is on MacOS, so I expect it is either there or coming. > Also, I would appreciate if you could suggest other scientific packages > and address me to essential documentation that could ease the task of > learning a new programming language. "Learning Python" is a very nice book (O'Reilly"for getting started, and of course the NumPy documentation. Also check out "Dive into Python" on the web. If you are familiar with another array-oriented language (MATLAB, IDL, maybe even Fortran 95) you will be able to pick it up quickly. Johann Hibschman wrote: > Readline is pretty good. Readline is not just good, it's critical. Command line Python is painful and almost useless without it, and fun and powerful with it. > By default, there's not much support for LAPACK. I'm sure someone has > it somewhere. I actually didn't do that much matrix math, just lots of > elementwise, so I don't have much experience with that. The LinearAlgebra package is a wrapper aroound some of LAPACK. It is possible to compile it to use a native BLAS if you have it, but I can't tell you how, I've never had the need. By the way, if you figure it out, and you are using a re-distributable LaPack, it would be great to make your custom compiled version available. NumPy is so much more that a wrappe around LaPack, because it provides N-dimensional arrays, not just Matrixes. > of fun using Python to drive C++ computational codes, but I'm not a real > Fortran guru. I don't remember if the OP mentioned Fortran, but if you do want to interface with Fortran codes, check out f2Py for ways to make it easy to interface Fortran and Python. Jack Jansen wrote: > One of the reasons to use MacPython might then be that NumPy is > bundled with it, so no need to install or build anything to use > it. I have never had any problems building o installing NumPy on Linux. Hopefully, with disutils, it's just as easy on OS-X. Also, if you want it linked with a Native BLAS, you'll be re-compiling, and that will probably be much easier with Unix Python. Good luck, I think you'll like it. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From johann@surfbest.net Thu Feb 21 18:17:30 2002 From: johann@surfbest.net (Johann Hibschman) Date: Thu, 21 Feb 2002 10:17:30 -0800 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science In-Reply-To: <5E4590AA-26CD-11D6-ABF3-003065517236@oratrix.nl> Message-ID: <44CE89CD-26F7-11D6-9BB1-003065B5C6B6@surfbest.net> On Thursday, February 21, 2002, at 05:17 AM, Jack Jansen wrote: > Wild guess: maybe you used "make install" to install in stead of "make > frameworkinstall"? I know that *I* still do that accidentally from time > to time (so it'll be fixed in the next release:-). Of course, that's it. Now I feel silly. Thanks, Jack. I've only been paying spotty attention to this list, but the ideal solution (IMHO) would be that "make install" puts a fully-operational Unix python version in /usr/local/bin, while "make frameworkinstall" actually creates the /Library/Frameworks/Python.framework. The frameworkinstall should certainly install python binaries in /usr/local/bin that use the framework, so I don't have to waste extra space in /usr/local/lib for duplicate libraries. You probably already do this, and I should probably just shut up, install it correctly, and see what happens. :-) Rambling, --Johann From paulm@profoundeffects.com Thu Feb 21 19:19:27 2002 From: paulm@profoundeffects.com (Paul Miller) Date: Thu, 21 Feb 2002 13:19:27 -0600 Subject: [Pythonmac-SIG] another way to do multiple interpreters? Message-ID: <5.1.0.14.2.20020221131821.01d6bdc0@mars.he.net> Can someone give me an example of doing multiple interpreters without using the PyEval_ thread functions? Can this be done with just the functions in pystate.h? I can't find examples anywhere on the proper way of doing this. -- Paul T. Miller | VP of Engineering, Profound Effects, Inc. | http://www.profoundeffects.com From prastawa@cs.unc.edu Thu Feb 21 19:30:46 2002 From: prastawa@cs.unc.edu (Marcel Prastawa) Date: Thu, 21 Feb 2002 14:30:46 -0500 Subject: [Pythonmac-SIG] PyEval_InitThreads in MacPython 2.2 - maybe I should rephrase my question In-Reply-To: <5.1.0.14.2.20020221081602.05f10580@cedar.he.net> Message-ID: <80C733C2-2701-11D6-B6F7-000A27942780@cs.unc.edu> On Thursday, February 21, 2002, at 09:20 , Paul Miller wrote: > I desperately need to get PyEval_InitThreads, AcquireThread, > ReleaseThread, etc, working, in order to make use of multiple > interpreters. I am using the various functions from ceval.h on Windows > but with MacPython 2.2 they are disabled because WITH_THREADS seemed to > be undefined. Is this intentional, am I using the configuration wrong, or > something else? I want to use the PythonCoreCarbon that comes with the 2. > 2 installer, so I am hoping there is something simple I am missing. This is probably not the kind of answer you want... The functions you listed are available in UNIX/Mach-O Python. I guess that this is a configuration issue. If it's really urgent, you could probably try switching to UNIX Python temporarily or rebuilding MacPython. Marcel From paul@fxtech.com Thu Feb 21 19:42:41 2002 From: paul@fxtech.com (Paul Miller) Date: Thu, 21 Feb 2002 13:42:41 -0600 Subject: [Pythonmac-SIG] PyEval_InitThreads in MacPython 2.2 - maybe I should rephrase my question In-Reply-To: <80C733C2-2701-11D6-B6F7-000A27942780@cs.unc.edu> References: <5.1.0.14.2.20020221081602.05f10580@cedar.he.net> Message-ID: <5.1.0.14.2.20020221134157.01ed8170@cedar.he.net> >The functions you listed are available in UNIX/Mach-O Python. I guess that >this is a configuration issue. If it's really urgent, you could probably >try switching to UNIX Python temporarily or rebuilding MacPython. I finally gave up and tried something else. I think I can simply use PyThreadState_Swap instead. Seems to be working... -- Paul T. Miller | paul@fxtech.com | http://www.fxtech.com From steve@spvi.com Thu Feb 21 20:05:33 2002 From: steve@spvi.com (Steve Spicklemire) Date: Thu, 21 Feb 2002 15:05:33 -0500 Subject: [Pythonmac-SIG] Building VPython on MacOSX.. In-Reply-To: Message-ID: <5D20C0D0-2706-11D6-BA8E-0050E480B13C@spvi.com> Great! That was it.. I have cvisualmodule.so importing correctly now.. I just need to figure our what else to check out from CVS and hopefully I can get this to fly! thanks, -steve On Thursday, February 21, 2002, at 11:05 AM, Marcel Prastawa wrote: > > On Thursday, February 21, 2002, at 06:56 , Steve Spicklemire wrote: >> Er.... any idea how I find out what library needs to be added? > > I think that they are C++ library functions. If you are using gcc to > compile the extension, you may need to add libstdc++ ("-lstdc++"). It > seems that for some reason gcc didn't do this automatically, could be > due to your file extension. > > Marcel From steve@spvi.com Thu Feb 21 20:13:15 2002 From: steve@spvi.com (Steve Spicklemire) Date: Thu, 21 Feb 2002 15:13:15 -0500 Subject: [Pythonmac-SIG] Building VPython on MacOSX.. In-Reply-To: <5D20C0D0-2706-11D6-BA8E-0050E480B13C@spvi.com> Message-ID: <706F1DF8-2707-11D6-BA8E-0050E480B13C@spvi.com> Whee! It works. ;-) Now I just need to figure out how to package this up so folks can get it... suggestions? I guess I need to learn how to build fink packages. thanks, -steve On Thursday, February 21, 2002, at 03:05 PM, Steve Spicklemire wrote: > > Great! That was it.. I have cvisualmodule.so importing correctly now.. > I just need to figure our what else to check out from CVS and hopefully > I can get this to fly! > > thanks, > -steve > > On Thursday, February 21, 2002, at 11:05 AM, Marcel Prastawa wrote: > >> >> On Thursday, February 21, 2002, at 06:56 , Steve Spicklemire wrote: >>> Er.... any idea how I find out what library needs to be added? >> >> I think that they are C++ library functions. If you are using gcc to >> compile the extension, you may need to add libstdc++ ("-lstdc++"). It >> seems that for some reason gcc didn't do this automatically, could be >> due to your file extension. >> >> Marcel > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From smithsm@samuelsmith.org Thu Feb 21 20:14:35 2002 From: smithsm@samuelsmith.org (Samuel Smith) Date: Thu, 21 Feb 2002 13:14:35 -0700 Subject: [Pythonmac-SIG] Confused at the state of Python for OSX Message-ID: I religiously read the macpython sig and it is impressive how much activity there has been the last few weeks. So much so that I am now officially confused. I have been preparing to make the jump to OSX as my day to day OS from OS9 and am just about there. But I can't figure out which version of Python I should use. There are posts referring to what I believe are 3 versions of python on the Mac for OSX?. Regular Unix python, MachO Python, and Carbon MacPython. To complicate things there is the fink installation of MachO? versus the cvs source installation. I used to use Unix on a daily basis a few years ago so I am not afraid of the Unix version but I am confused vis a vis MachO python. It sounds like they can coexist. There are so many reports of problems that I am not sure which one will be most productive for me. Would someon who has a clear picture of the current state of python for OSX care to elaborate or at least point me to a readme that is up to date? (I know its been discussed before but things are changing so fast) -- ********************************************** Samuel M. Smith Ph.D. 360 W. 920 N. Orem, Utah 84057 801-226-7607 x112 (voice) 801-226-7608 (fax) http://www.samuelsmith.org (web) ********************************************* From sdm7g@virginia.edu Thu Feb 21 20:56:44 2002 From: sdm7g@virginia.edu (Steven Majewski) Date: Thu, 21 Feb 2002 15:56:44 -0500 (EST) Subject: [Pythonmac-SIG] Confused at the state of Python for OSX In-Reply-To: Message-ID: mach-o python and unix python refer to the same thing. The gcc compiler and linker output object files in 'mach-o' format - so if you build with those tools you get a mach-o python -- and right now the only version that's been build is the unix version. ( If you build any programs with apples Project Builder, you're using the unix gcc compiler ( and ld and gdb, etc. ) underneath, so those all output mach-o. mach-o python just uses configure and the Makefiles like all of the other unix builds, so Project Builder is not required. ) The other mac Python is typically built using Metrowerks CodeWarrior. The current version of CW supports mach-o output and OSX to some extent -- I hear better support will be in the next version -- but usually, it's being used to produce CFM (Code Fragment Manager) or PEF (I think that's "Preferred Execution Format" -- not sure) output. ( Older 68K code used a pre CFM format. ) You can also build MacPython for either CarbonLib ( which means it can run on either OS9 or OSX or OS8.6 if you install CarbonLib yourself) ) or you can build a "classic" version, which runs in OS 7.x and up (I believe) and will run on OSX only in the Classic (emulation) Environment. Jack has merged all of the MacPython stuff into the main sourceforge cvs tree, so now you build both versions from the same sources. But some of the stuff is conditional on various macro definitions, so how it gets build will vary with the compiler and macro definitions. ( And in 2.2, it builds most of the Carbon Mac toolbox modules for the unix mach-o python. ) For example, Mac Python has code to emulate some of the posix lib interfaces -- both for the os module and for things like sockets ( which use GUSI ). But OSX has all of those built in, so the mach-o unix build doesn't use those emulation libs. ( It should be possible to remove those from the Carbon MacPython and build against the unix libs, but then it wouldn't work on OS9. There's probably a way to make it conditional but that may not be worth the trouble. ) On OSX there's also the issue of whether it's build and packaged into a OSX bundle|framework or as a typical unix app. A lot of these choices are independent and orthogonal to each other, so you can probably construct quite a variety of different Python's, but so far, we're usually talking about three varieties: Classic and Carbon MacPython and unix or mach-o Python. Right now, MacPython is more mature for doing "Mac-like stuff" and unix python is better for doing "unix-like stuff", but eventually, the unix (mach-o) python will have full support for all of the Carbon, Cocoa, Carbonized Tkinter, etc. capabilities. ( In fact, you can probably do most of it right now, but it doesn't yet come that way "out of the box" ! ) Some of those mix & match orthogonal choices are: Object Format: CFM/PEF | mach-o Libraries linked against: GUSI | POSIX Carbon | Classic Compiler: gcc | CodeWarrior ( or MPW or other mac compilers ) Source Code: same code base but different macro definitions ( some defined by the compiler -- right now mostly controlled by choice of compiler, but that should change. ) Support for various modules: Mac Toolbox (Carbon or "Classic") Cocoa (pyobjc) Tkinter ("Classic", X11 libs or Carbonized Tk) OSX Scripting Component ( which also supports Cocoa scripting ) -- Steve Majewski From sburr@mac.com Thu Feb 21 21:43:59 2002 From: sburr@mac.com (Steven Burr) Date: Thu, 21 Feb 2002 14:43:59 -0700 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science In-Reply-To: <3C75221A.ACBAB019@noaa.gov> Message-ID: <1D24DB64-2714-11D6-AFA2-00039362D50A@mac.com> --Apple-Mail-8--486582419 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed "Lizardo H. C. M. Nunes" wrote: > I'm interested about using Python as a > research tool, specially for number crushing. I hope you can help me > providing pointers. You should check out fink: http://fink.sourceforge.net/ It automates downloading, patching, compiling and installing over 700 Unix packages, including python, numeric ("numpy") and scientificpython ("scipy"). There's also a numeric-atlas package, which "links against optimized atlas BLAS/LAPACK." I have no idea what that means, but Johann Hibschman's post seemed to indicate it could be helpful. Fink gives you a choice between two python "packages": "python," which links against the X11 tcl/tk libraries and therefore supports Tkinter, and "python-nox," which doesn't include Tkinter support. Both packages include readline support. One caveat: The fink installation of python does not use the --enable-frameworks option, so it doesn't include support for the Mac Toolbox modules. -- third from the bottom http://www.adeq.state.az.us/lead/staff.html --Apple-Mail-8--486582419 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII 0000,0000,0000"Lizardo H. C. M. Nunes" wrote: I'm interested about using Python as a research tool, specially for number crushing. I hope you can help me providing pointers. You should check out fink: http://fink.sourceforge.net/ It automates downloading, patching, compiling and installing over 700 Unix packages, including python, numeric ("numpy") and scientificpython ("scipy"). There's also a numeric-atlas package, which "links against optimized atlas BLAS/LAPACK." I have no idea what that means, but Johann Hibschman's post seemed to indicate it could be helpful. Fink gives you a choice between two python "packages": "python," which links against the X11 tcl/tk libraries and therefore supports Tkinter, and "python-nox," which doesn't include Tkinter support. Both packages include readline support. One caveat: The fink installation of python does not use the --enable-frameworks option, so it doesn't include support for the Mac Toolbox modules. -- third from the bottom http://www.adeq.state.az.us/lead/staff.html --Apple-Mail-8--486582419-- From bobsavage@mac.com Thu Feb 21 23:34:56 2002 From: bobsavage@mac.com (Bob Savage) Date: Thu, 21 Feb 2002 17:34:56 -0600 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science In-Reply-To: <3C75221A.ACBAB019@noaa.gov> Message-ID: on 2/21/02 10:36 AM, Chris Barker wrote: > In the meantime, SciPy uses PyGnuplot, and I'm not sure if > gnuplot os available on OS-X, but it is on MacOS, so I expect it is > either there or coming. > Yes we have it. Take a look at for an adapter to do the graphics natively. It works fine for GnuPlot, Per, the project lead, just added support for PGPlot, and we have been discussing making it a "back-end" for Piddle, or simply providing a Python module that would enable you to send drawing commands directly from Python. Right now I just open a pipe to GnuPlot and issue my graphing commands to GnuPlot, which relays them to Aquaterm via Cocoa's distributed object mechanism. cheers, Bob From Chris.Barker@noaa.gov Thu Feb 21 22:59:45 2002 From: Chris.Barker@noaa.gov (Chris Barker) Date: Thu, 21 Feb 2002 14:59:45 -0800 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPythonand Science References: Message-ID: <3C757BD7.6333AEB1@noaa.gov> Bob Savage wrote: > > In the meantime, SciPy uses PyGnuplot, and I'm not sure if > > gnuplot os available on OS-X, but it is on MacOS, so I expect it is > Yes we have it. Take a look at for an > adapter to do the graphics natively. It works fine for GnuPlot, Per, the > Right now I > just open a pipe to GnuPlot and issue my graphing commands to GnuPlot, which > relays them to Aquaterm via Cocoa's distributed object mechanism. what about gnuplot.py? http://www-heller.harvard.edu/~mhagger/Gnuplot/Gnuplot.html -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov From aparente@adobe.com Fri Feb 22 00:04:09 2002 From: aparente@adobe.com (Alexandre Parenteau) Date: Thu, 21 Feb 2002 16:04:09 -0800 Subject: [Pythonmac-SIG] Confused at the state of Python for OSX In-Reply-To: Message-ID: > Some of those mix & match orthogonal choices are: > > Object Format: > CFM/PEF | mach-o > > Libraries linked against: > GUSI | POSIX > Carbon | Classic > > Compiler: > gcc | CodeWarrior ( or MPW or other mac compilers ) > > Source Code: > same code base but different macro definitions > ( some defined by the compiler -- right now mostly > controlled by choice of compiler, but that should change. ) > > Support for various modules: > Mac Toolbox (Carbon or "Classic") > Cocoa (pyobjc) > Tkinter ("Classic", X11 libs or Carbonized Tk) > OSX Scripting Component ( which also supports Cocoa scripting ) I'm not fully qualified to speak for the MacPython project, but from my perspective using MacPython CFM on MacOSX is not an option on a long term. We discussed online or offline this issue with Matthias Neeracher and Jack Jansen, and we decided the GUSI port to Carbon for OSX was only transitional and should not be used on a long basis. Think about it : MacPython CFM is using GUSI, which emulates BSD on top of Carbon, which is talking to BSD anyway. All my benchmark indicate that it is a complete lost. And GUSI is already an obsolete thing for Matthias I think. If you use MacOSX only, and this is my IMHO again, use the Mach-O port. It will have everything that has the CFM version (including the MacOS specific), only it will work much better with threads and sockets. Now there are 2 kinds of problems by using Mach-O at the time we speak. Not all the sub-components of Python are fully functional (like Tk-Inter) and there is a legacy problem of people who are using either CodeWarrior or existing CFM/Carbon libraries. For the first problem, I believe it is only transitory. As for the second, the CodeWarrior Mach-O support is already great, I had the chance to test it (even though I cannot seem to be able to add additional framework than the one inside /Systems/Library/Frameworks, which is painful). I noted also you cannot debug a Mach-O binary which forks, but the bug is the same in /usr/bin/gdb. About the legacy of code now, I was thinking it would be easy to provide a CFM glue code which loads and talk to the Mach-O binaries. The only problem I foresee is about FILE from . Some Python functions use the FILE accessor and I don't think it is technically possible to share a FILE object between CFM and Mach-O. Alex. -- Alexandre Parenteau Computer Scientist Core Technologies, AGM Adobe Systems, Inc. 408-536-6166 From sdm7g@Virginia.EDU Fri Feb 22 00:24:08 2002 From: sdm7g@Virginia.EDU (Steven Majewski) Date: Thu, 21 Feb 2002 19:24:08 -0500 (EST) Subject: [Pythonmac-SIG] Confused at the state of Python for OSX In-Reply-To: Message-ID: On Thu, 21 Feb 2002, Alexandre Parenteau wrote: > I'm not fully qualified to speak for the MacPython project, but from my > perspective using MacPython CFM on MacOSX is not an option on a long term. ... Definitely. I hope that was at least implied by my comments about the future of mach-o python. > If you use MacOSX only, and this is my IMHO again, use the Mach-O port. It > will have everything that has the CFM version (including the MacOS > specific), only it will work much better with threads and sockets. But "will have" is the significant phrase above! > Now there are 2 kinds of problems by using Mach-O at the time we speak. Not > all the sub-components of Python are fully functional (like Tk-Inter) and > there is a legacy problem of people who are using either CodeWarrior or > existing CFM/Carbon libraries. Is there really that much legacy code out there that won't port to mach-o? I'll admit that I have some, but it all uses non-Carbon aspects of the classic macos -- device manager calls mostly -- so I'm going to have to rewrite the whole thing. All of the other extensions I use are all originated on unix and were ported to the mac -- maintaining them should be easier on osx. -- Steve Majewski From aparente@adobe.com Fri Feb 22 01:09:40 2002 From: aparente@adobe.com (Alexandre Parenteau) Date: Thu, 21 Feb 2002 17:09:40 -0800 Subject: [Pythonmac-SIG] Confused at the state of Python for OSX In-Reply-To: Message-ID: > Is there really that much legacy code out there that won't port to mach-o? > I'll admit that I have some, but it all uses non-Carbon aspects of the > classic macos -- device manager calls mostly -- so I'm going to have to > rewrite the whole thing. All of the other extensions I use are all > originated on unix and were ported to the mac -- maintaining > them should be easier on osx. Agree, the comfort is obvious. Most of the components of Python originated on Unix. All these components pretty much compile in a snap on OSX using the GNU/Apple tools. Strangely all you have to do to port it to Mach-O is to throw away all the specific code you added for Classic ! I wanted to point that even for components specific to Mac (which are not GNU/Unix based), it is more and more easy to port to Mach-O as the tools get better. I hope I made that clear in my mail. Alex. -- Alexandre Parenteau Computer Scientist Core Technologies, AGM Adobe Systems, Inc. 408-536-6166 From smithsm@samuelsmith.org Fri Feb 22 01:37:06 2002 From: smithsm@samuelsmith.org (Samuel Smith) Date: Thu, 21 Feb 2002 18:37:06 -0700 Subject: [Pythonmac-SIG] Confused at the state of Python for OSX In-Reply-To: References: Message-ID: > >Agree, the comfort is obvious. Most of the components of Python originated >on Unix. All these components pretty much compile in a snap on OSX using the >GNU/Apple tools. Strangely all you have to do to port it to Mach-O is to >throw away all the specific code you added for Classic ! > >I wanted to point that even for components specific to Mac (which are not >GNU/Unix based), it is more and more easy to port to Mach-O as the tools get >better. I hope I made that clear in my mail. Thanks for the clarification. It seems then there is no point on a new project to even look at CFM MacPython on OSX. At 18:21 -0500 2/21/02, Dan Grassi wrote: >There is no reason to build from source. > >Mac carbon version: >1) http://www.cwi.nl/ftp/jack/python/mac/MacPython22full.bin > >MachO/unix version: >2) http://people.ucsc.edu/~jacobkm/tkinter_osx_howto.html >or >DO NOT USE STUFFIT TO UNTAR THIS PACKAGE! IT WILL NOT WORK >3) http://redivi.com/~bob/pygame-1.3.4-osx-kitchensink.pkg.tar > >I use 1 and 3 on OS X. It seems there are lots of little fixes people keep writing about moreover if I want to work with a gui such as wxpython on xfree86 don't I need to build from source? -- ********************************************** Samuel M. Smith Ph.D. 360 W. 920 N. Orem, Utah 84057 801-226-7607 x112 (voice) 801-226-7608 (fax) http://www.samuelsmith.org (web) ********************************************* From bobsavage@mac.com Fri Feb 22 03:35:46 2002 From: bobsavage@mac.com (Bob Savage) Date: Thu, 21 Feb 2002 21:35:46 -0600 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPythonand Science In-Reply-To: <3C757BD7.6333AEB1@noaa.gov> Message-ID: >> Right now I >> just open a pipe to GnuPlot and issue my graphing commands to GnuPlot, which >> relays them to Aquaterm via Cocoa's distributed object mechanism. > > what about gnuplot.py? > > http://www-heller.harvard.edu/~mhagger/Gnuplot/Gnuplot.html > Yeah, I'm just massively lazy so I never downloaded it :P. GnuPlot.py should work fine for sending the commands from Python to GnuPlot it does the same thing "under the hood" if I'm not mistaken, but it adds support for the NumPy matrices, IIRC. Aquaterm and GnuPlot would still communicate the same way. Bob From dan@grassi.org Fri Feb 22 03:44:05 2002 From: dan@grassi.org (Dan Grassi) Date: Thu, 21 Feb 2002 22:44:05 -0500 Subject: [Pythonmac-SIG] Confused at the state of Python for OSX In-Reply-To: Message-ID: <6B38D38F-2746-11D6-8DA5-00039346A28A@grassi.org> I'm wondering why CodeWarrior is being considered for Mach-O? We ported all our CodeWarrior projects to Project Builder, I even ported PowerPlant to Project Builder in about one day. Sooner or later Project Builder the where things will be, it's free and available to everyone. Dan On Thursday, February 21, 2002, at 07:04 PM, Alexandre Parenteau wrote: > As for the second, the CodeWarrior Mach-O support is already great, I > had > the chance to test it (even though I cannot seem to be able to add > additional framework than the one inside /Systems/Library/Frameworks, > which > is painful) From lizardo@urbi.com.br Fri Feb 22 03:53:55 2002 From: lizardo@urbi.com.br (Lizardo H. C. M. Nunes) Date: Fri, 22 Feb 2002 00:53:55 -0300 Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science In-Reply-To: Message-ID: Thank you all. I've just built Python with readline module. After "make test" what I got was: (...) 163 tests OK. 23 tests skipped: test_al test_cd test_cl test_curses test_dl test_gdbm test_gl test_imgfile test_largefile test_linuxaudiodev test_locale test_minidom test_nis test_ntpath test_poll test_pyexpat test_sax test_socket_ssl test_socketserver test_sunaudiodev test_unicode_file test_winreg test_winsound 3 skips unexpected on darwin: test_sax test_locale test_pyexpat --- If there's something wrong, please give me a reply. For the moment I'll avoid the "--enable-framework", since I wish to test Python on my local area first. I can't say much about GUI interface, but I think there's a native Tcl/Tk implementation that might be useful. About number crunching and modules I've seen that http://www.vex.net/parnassus/ has a vast amount of information. I really appreciate all your help, Lizardo H. C. M. Nunes ...But we preach Christ crucified, to the Jews a stumbling block, and to the Greeks foolishness;(...)but God has chosen the foolish things of the world to confound the wise, and God has chosen the weak things of the world to confound the things which are strong;(I Cor.1:23&27) From csmith@blakeschool.org Fri Feb 22 04:44:27 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Thu, 21 Feb 2002 22:44:27 -0600 Subject: [Pythonmac-SIG] Re: PC Line Endings? Batch file replacement In-Reply-To: References: Message-ID: pythonmac-sig@python.org writes: >From: Ryan Wilcox >Subject: Re: [Pythonmac-SIG] [HELP!] PC Line Endings? Batch file >replacement You might want to modify a line of run() as indicated below to correctly handle directories that are encountered: def run(d,tp): names = os.listdir(d) for name in names: f = d + name if os.path.isfile(f): if os.path.splitext(f)[1]!='.DS_Store': print "processing: " + name strip(f, tp) else: run(f, tp) *change last line to this* else: run(f+os.sep, tp) /c From Jack.Jansen@oratrix.com Fri Feb 22 09:43:28 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Fri, 22 Feb 2002 10:43:28 +0100 Subject: [Pythonmac-SIG] Fwd: Apple Design Awards Update: Open Source Category Message-ID: Folks, Apple have just added a category "best open source product" to their yearly design awards. How about giving it a go and trying to win that award with Python? We have until April 5 to enter, which gives us almost 6 weeks. The question is: what would we need (that we don't have yet) to win, and can we do that in 6 weeks? Here's my list of things we definitely need: - The IDE (no idea how far along that is) - The OSA component (no idea how easy this would be to integrate. Actually, I have for the second time forgotten who did this! Sorry, please speak up!) - universal newline support (should be trivial to drop in) - Bells and whistles, such as BuildApplet, EditPythonPrefs and BuildApplication (but these should probably be built in to the IDE, not as separate apps) - A nice installer that also installs the /usr/local/bin symlinks for unix to use, etc. - Packaged documentation, preferably in a form that Apple Help can read (plus hooks in the IDE to get at the docs). - Consensus on how we're going to split the dual G4 we're going to win:-) I think what would make this a potential winner is that it covers three programming areas (unix scripts and CGI, Applescripting, standalone Mac development) and that it is the only tool that does all three. All competing languages cover only one or at most 2 of these areas (Perl: 1, Applescript: 23, Tcl/Tk: 13, Java: 13). Begin forwarded message: > From: Apple Developer Connection > Date: Thu Feb 21, 2002 09:51:06 Europe/Amsterdam > To: undisclosed-recipients: ; > Subject: Apple Design Awards Update: Open Source Category > Reply-To: Apple Developer Connection > > > Dear Developer, > > We have great news! In response to the popularity of Mac OS X with > the open source community, Apple is pleased to announce an > additional category for the Seventh Annual Apple Design Awards: Best > Mac OS X Open Source Port. In addition, we are now accepting both > individual and collaborative entries. > > We invite you to take a look at the updated rules and prize > information and submit your product for consideration. The winners > will be announced at a special Apple Design Awards ceremony during > Apple's Worldwide Developers Conference in San Jose, California > during the week of May 6-10, 2002. > > If you have already submitted a product for consideration in the > Seventh Annual Apple Design Awards, you will be contacted separately > with information on updating your submission. > > ================================== > COMPANY/INDIVIDUAL DEVELOPERS > ================================== > A company or individual developer may submit a product to be > considered for the following categories: > > * Best New Mac OS X Product > * Most Innovative Mac OS X Product > * Best Mac OS X User Experience > * Best Mac OS X Technology Adoption > * Best Mac OS X Open Source Port > > Individual developers may also submit a product collaboratively > (please see entry form for specific requirements and award > guidelines related to joint entries). > > Winners in each of the above categories receive an "Ultimate" Power > Mac G4 system with an Apple Cinema Display (22" flat panel). > > Please note that all company/individual developer entries are due by > Friday, April 5, 2002. You may submit your entry form today at > . > > ================================== > STUDENT DEVELOPERS > ================================== > Student developers may submit a product developed either > individually or collaboratively for the category of: > > * Best Mac OS X Student Product > > The winner of the Best Mac OS X Student Product award will receive > an "Ultimate" PowerBook system and a paid trip to Apple's Worldwide > Developers Conference (WWDC), which will be held May 6-10 in San > Jose, California. (Please see entry form for specific requirements > and award guidelines related to joint entries.) > > Please note that all Student Developer entries are due by Friday, > March 1, 2002. You may submit your entry form today at > . > > ================================== > DETAILS > ================================== > Don't miss this chance to show off your Mac OS X product and win > some great hardware. Visit > for official contest > rules and entry forms. If you have additional questions not > answered by the official contest rules, please contact us via email > at . > > > Best regards, > > > Apple Developer Connection > -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From Jack.Jansen@oratrix.com Fri Feb 22 09:48:43 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Fri, 22 Feb 2002 10:48:43 +0100 Subject: [Pythonmac-SIG] PyEval_InitThreads in MacPython 2.2 - maybe I should rephrase my question In-Reply-To: <5.1.0.14.2.20020221081602.05f10580@cedar.he.net> Message-ID: <5BDB090E-2779-11D6-BAAA-0030655234CE@oratrix.com> On Thursday, February 21, 2002, at 03:20 , Paul Miller wrote: > I desperately need to get PyEval_InitThreads, AcquireThread, > ReleaseThread, etc, working, in order to make use of multiple > interpreters. I am using the various functions from ceval.h on Windows > but with MacPython 2.2 they are disabled because WITH_THREADS seemed to > be undefined. Is this intentional, am I using the configuration wrong, > or something else? I want to use the PythonCoreCarbon that comes with > the 2.2 installer, so I am hoping there is something simple I am > missing. You must set the right MetroWerks header file (in the C/C++ panel) which in your case is probably mwerks_carbonplugin_config.h. This defines WITH_THREAD (without the "S", incidentally) and various other essential defines. If you build through distutils this is done for you automatically (unless you've overridden it). -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From gherman@darwin.in-berlin.de Fri Feb 22 10:12:33 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Fri, 22 Feb 2002 11:12:33 +0100 (CET) Subject: [Pythonmac-SIG] Fwd: Apple Design Awards Update: Open Source Category In-Reply-To: References: Message-ID: <1014372753.3c76199178bed@webmail.in-berlin.de> Jack Jansen : > How about giving it a go and trying to win that award with Python? Great idea! > Here's my list of things we definitely need: > - The IDE (no idea how far along that is) > - The OSA component (no idea how easy this would be to integrate. > Actually, I have for the second time forgotten who did this! Sorry, > please speak up!) > - universal newline support (should be trivial to drop in) > - Bells and whistles, such as BuildApplet, EditPythonPrefs and > BuildApplication (but these should probably be built in to the IDE, not > as separate apps) > - A nice installer that also installs the /usr/local/bin symlinks for > unix to use, etc. > - Packaged documentation, preferably in a form that Apple Help can read Given that the whole competition is about OS X I'd be most happy with something that I guess Stephen is working on: further integration of Python with Cocoa. If there is no serious attempt at an (Cocoa) IDE yet, I could spend some limited time on that, as I'm planning to do some- thing similar (a Cocoa front-end), anyway. Regards, Dinu From Jack.Jansen@oratrix.com Fri Feb 22 10:22:17 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Fri, 22 Feb 2002 11:22:17 +0100 Subject: [Pythonmac-SIG] Fwd: Apple Design Awards Update: Open Source Category In-Reply-To: <1014372753.3c76199178bed@webmail.in-berlin.de> Message-ID: <0C13CED4-277E-11D6-BAAA-0030655234CE@oratrix.com> On Friday, February 22, 2002, at 11:12 , Dinu Gherman wrote: > > Given that the whole competition is about OS X I'd be most > happy with something that I guess Stephen is working on: > further integration of Python with Cocoa. I left Cocoa out of my list because I think the other items are essential for a complete package that fullfills the design goals (the "3 programming arena" idea I made up as I typed along). Cocoa is essential in the long run, but I don't think doing Cocoa and then leaving one of the other items in my list out is a good idea. But: that shouldn't stop you from working on Cocoa, of course! -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From paul@fxtech.com Fri Feb 22 14:43:52 2002 From: paul@fxtech.com (Paul Miller) Date: Fri, 22 Feb 2002 08:43:52 -0600 Subject: [Pythonmac-SIG] PyEval_InitThreads in MacPython 2.2 - maybe I should rephrase my question In-Reply-To: <5BDB090E-2779-11D6-BAAA-0030655234CE@oratrix.com> References: <5.1.0.14.2.20020221081602.05f10580@cedar.he.net> Message-ID: <5.1.0.14.2.20020222084130.05f912f8@cedar.he.net> >You must set the right MetroWerks header file (in the C/C++ panel) which >in your case is probably mwerks_carbonplugin_config.h. This defines >WITH_THREAD (without the "S", incidentally) and various other essential >defines. If you build through distutils this is done for you automatically >(unless you've overridden it). Hi Jack - this sounds like what needs to be done when building python. I want to use the Python that comes re-built. I enabled WITH_THREADS manually when compiling my own code, but it still wouldn't link, because those functions don't see to be built into PythonCoreCarbon. No matter though - I'm not REALLY working with threads - I just want to use multiple interpreters, and I can do that with NewInterpreter, EndInterpreter, and SwapState. Cheers, -Paul -- Paul T. Miller | paul@fxtech.com | http://www.fxtech.com From gherman@darwin.in-berlin.de Fri Feb 22 14:57:46 2002 From: gherman@darwin.in-berlin.de (Dinu Gherman) Date: Fri, 22 Feb 2002 15:57:46 +0100 (CET) Subject: [Pythonmac-SIG] Python/ObjC integration? Message-ID: <1014389866.3c765c6a0f4e8@webmail.in-berlin.de> Hi, Maybe this is mainly for Steve Majewski who, ASAIK, is working on pyobjc which I assume would allow a cloeser integration of Python with the Objective-C runtime system and, hence, also the Cocoa FoundationKit and AppKit, right? My questions are these: how far are we (or you) on that road? Is there anything one could play with, is there a page descri- bing all this? Unfortunately, I can't see any Python stuff on your homepage or any entry on the Starship Python. Thanks, Dinu From sdm7g@Virginia.EDU Fri Feb 22 17:24:55 2002 From: sdm7g@Virginia.EDU (Steven Majewski) Date: Fri, 22 Feb 2002 12:24:55 -0500 (EST) Subject: [Pythonmac-SIG] Confused at the state of Python for OSX In-Reply-To: <6B38D38F-2746-11D6-8DA5-00039346A28A@grassi.org> Message-ID: On Thu, 21 Feb 2002, Dan Grassi wrote: > I'm wondering why CodeWarrior is being considered for Mach-O? We ported > all our CodeWarrior projects to Project Builder, I even ported > PowerPlant to Project Builder in about one day. Sooner or later Project > Builder the where things will be, it's free and available to everyone. I haven't done any tests myself (I don't have the latest CW) but I've heard that gcc's code generator for PPC is not that good and CW has a real performance advantage. The math libs for darwin are reportedly very poorly optimized. But those are things I would expect either Apple or Darwin Open Source hackers to tackle eventually. But yeah -- it's hard to compete with FREE! -- Steve From sdm7g@Virginia.EDU Fri Feb 22 17:33:12 2002 From: sdm7g@Virginia.EDU (Steven Majewski) Date: Fri, 22 Feb 2002 12:33:12 -0500 (EST) Subject: [Pythonmac-SIG] First Experience, Unix Python vs. MacPython and Science In-Reply-To: Message-ID: On Fri, 22 Feb 2002, Lizardo H. C. M. Nunes wrote: > Thank you all. > > I've just built Python with readline module. > > After "make test" what I got was: > (...) > 163 tests OK. > 23 tests skipped: > test_al test_cd test_cl test_curses test_dl test_gdbm test_gl > test_imgfile test_largefile test_linuxaudiodev test_locale > test_minidom test_nis test_ntpath test_poll test_pyexpat test_sax > test_socket_ssl test_socketserver test_sunaudiodev > test_unicode_file test_winreg test_winsound > 3 skips unexpected on darwin: > test_sax test_locale test_pyexpat > > --- If there's something wrong, please give me a reply. > If you build and install expat (you can get if from SourceForge and maybe Fink) two of those will go away: sax and pyexpat. If you don't need to do any XML parsing, you can do without it, but I expect that there are some higher level tools (xmlrpc?) that depend on it. I'm not sure what the problem with locale is. -- Steve Majewski From sdm7g@Virginia.EDU Fri Feb 22 18:15:02 2002 From: sdm7g@Virginia.EDU (Steven Majewski) Date: Fri, 22 Feb 2002 13:15:02 -0500 (EST) Subject: [Pythonmac-SIG] Python/ObjC integration? In-Reply-To: <1014389866.3c765c6a0f4e8@webmail.in-berlin.de> Message-ID: Re: Apple design awards: I agree with Jack -- It would be great if Cocoa with pyobjc could be added, but all of the other stuff, as well as documentation and better install, is probably more vital. If pyobjc isn't ready for primetime by the deadline, we can integrate Donovan's scripting component stuff into the package to show some Cocoa support. On Fri, 22 Feb 2002, Dinu Gherman wrote: > Maybe this is mainly for Steve Majewski who, ASAIK, is working > on pyobjc which I assume would allow a cloeser integration of > Python with the Objective-C runtime system and, hence, also > the Cocoa FoundationKit and AppKit, right? > > My questions are these: how far are we (or you) on that road? > Is there anything one could play with, is there a page descri- > bing all this? > > Unfortunately, I can't see any Python stuff on your homepage > or any entry on the Starship Python. This has unfortunately been an on and off project for me. I did a bit or work just before Python-10 to get out a new point release to clean up a couple of things. ( Please download it from and give it a try! ) ( I happen to be taking a day from work-work today so I'm going to try to get back into it this weekend. ) There was a problem building against 2.2 because of a bug in 2.2. If you build against the python cvs release or one of the later snapshots, it should be OK. If you have any problems or need the patch for 2.2, let me know. There is a HelloWorld.py in the demo directory, as well as a new Cocoa package ( you can do 'from Cocoa.Foundation import *' for example. ) What doesn't work is delegates and notification -- mainly because there seems to be a bug with going in the opposite direction -- objc --> python: both of those classes are getting events posted which are supposed to eventually call python methods. (Some of the work before Python-10 was identifying that as the problem. This is *one* bug, but it's taken me a while to figure out what the problem is, and I haven't quite got the solution yet! ) What's missing that should be there is some code to handle loading NIBs and connecting to them. That's something I'm going to take a look at now, as just before Py-10, I posted that I was able to load and bring to the screen an 'unanimated' NIB. That may be very close unless the above bug interferes. What would be nice to have would be a totally new version that works with 2.2's new class/type system so that pyobjc classes can be directly subclassed in Python. I wouldn't expect that I'ld have time for the totally new version before the deadline, but it would be reasonable that I could figure out that one 'showstopper' bug and be able to provide some better demo's. It might be nice to also demo it using some other (non-apple) objective-c classes. I've used the neo class inspector framework from python. I should probably package up some instructions on how to do this. ( Look at LoadBundle() in the Cocoa/AppKit.py file for now. ) Anybody have any suggestions for a third party lib that would make a good example ? ( I was following the thread about gnuplot + aquaterm -- I downloaded them last night -- maybe acquterm might make a good example. ) I should have time to work on it this weekend, so I'll post an update if I see any progress! Please, if you're at all interested in pyobjc, give it a try -- another developer would be great, but even bug reports and suggestions would be helpful! (Donovan Preston and I got to talk a bit at Python-10, so I have a couple of suggestions from him to try out! ) -- Steve From aparente@adobe.com Fri Feb 22 19:02:46 2002 From: aparente@adobe.com (Alexandre Parenteau) Date: Fri, 22 Feb 2002 11:02:46 -0800 Subject: [Pythonmac-SIG] [Ann] MacCvs and MacPython users Message-ID: Hi, I'm delighted to introduce MacCvs for Mach-O. This is true POSIX implementation which is using a native cvs command spawn from MacCvs (using fork !) and native ssh (no more MacSSH, it gets the ssh keys directly from ~/.ssh). http://sourceforge.net/project/showfiles.php?group_id=10072&release_id=76353 Here are the 2 programs you want to know about : - MaccvsX : The PowerPlant-Mach-O front-end to cvs - cvsgui : the unix command line replacement for cvs which extends cvs with the MacCvs/MacCvsPro extensions (HQX, MacBinary and ISO8859) and is using the cvsgui protocol. Plus it has some other extensions to cvs, like the ability to access a pserver repository thru a http proxy. If you want to check-out MacPython using MaccvsX , please make sure you set-up ISO8859 to point to 'MacCvsPro' in the MacCvsX prefs. If you use the 'cvsgui' command line from the shell, define 'setenv ISO8859 2' in your .tcshrc. (Using ISO8859 is very important when checking out MacPython because some critical .py files are encoded that way on the cvs server). Note 1 : MacCvs, MacCvsPro and MacCvsX-Mach-O are somehow compatible each other. But because of line termination and other things, it is recommended to not mix the clients together. However MacCvsX-Mach-O and the cvsgui command line are fully compatible each other. Note 2 : MacPython integration inside MacCvsX is not functional yet. I'm having trouble to load the MacPython framework at the moment (MacCvs is using MacPython for Macros). Alex. -- Alexandre Parenteau Computer Scientist Core Technologies, AGM Adobe Systems, Inc. 408-536-6166 From pydan@danshafer.com Sat Feb 23 08:31:48 2002 From: pydan@danshafer.com (Dan Shafer) Date: Sat, 23 Feb 2002 00:31:48 -0800 Subject: [Pythonmac-SIG] wxPython/GTK Under OS X? References: Message-ID: <3C775374.7090404@danshafer.com> I've tried to follow some of the discussion here about using (I think) macho-python under OS X kernel but I'm not entirely sure I followed them well. I do have MacPython installed under OS X so it runs from the terminal just fine. But I want to begin to explore and work with wxPython on OS X as I have been doing on my Least Favorite OS of late. I'm led to believe by folks who seem to know tha I need to get GTK installed, then wxPython on top of that. Or that I may well have to wait for GTK2 to be available before I can expect this to work. Can anyone give me some straighit-forward advice and isntructinon? I'd really appreciate it. From ntiffin@earthlink.net Sat Feb 23 15:00:47 2002 From: ntiffin@earthlink.net (Neil Tiffin) Date: Sat, 23 Feb 2002 10:00:47 -0500 Subject: [Pythonmac-SIG] wxPython/GTK Under OS X? In-Reply-To: <3C775374.7090404@danshafer.com> References: <3C775374.7090404@danshafer.com> Message-ID: I have it installed and working. I used fink. It is in the unstable directory and it installed and worked just fine. You can download fink at: http://sourceforge.net/project/showfiles.php?group_id=17203 I think the doc files are at: http://fink.sourceforge.net/doc/bundled/usage.php However the site is down from me right now. To install you Move the files from unstable to stable (see docs for which files) then type: fink install wxgtk wxpython-wxgtk Then wait an hour or so and its done. No other configuration needed. hope this helps. Mine installed version i wxgtk 2.3.2-3 Cross-platform (unix,windows,mac) GUI API -... i wxpython-wxgtk 2.3.2.1-1 Cross platform GUI toolkit for Python - uni... At 12:31 AM -0800 2/23/02, Dan Shafer wrote: >I've tried to follow some of the discussion here about using (I >think) macho-python under OS X kernel but I'm not entirely sure I >followed them well. I do have MacPython installed under OS X so it >runs from the terminal just fine. But I want to begin to explore and >work with wxPython on OS X as I have been doing on my Least Favorite >OS of late. > >I'm led to believe by folks who seem to know tha I need to get GTK >installed, then wxPython on top of that. Or that I may well have to >wait for GTK2 to be available before I can expect this to work. > >Can anyone give me some straighit-forward advice and isntructinon? > >I'd really appreciate it. > > >_______________________________________________ >Pythonmac-SIG maillist - Pythonmac-SIG@python.org >http://mail.python.org/mailman/listinfo/pythonmac-sig From csmith@blakeschool.org Sat Feb 23 17:47:40 2002 From: csmith@blakeschool.org (Christopher Smith) Date: Sat, 23 Feb 2002 11:47:40 -0600 Subject: [Pythonmac-SIG] Re: why the recompile? Message-ID: Christopher Smith writes: >Hello, > >I am trying to get an installation distributed on a set of iBooks for a >course. I ran compileall on my own installation, copied that to the >master server disk and from there it gets copied onto the individual >iBooks. The hope was to avoid having to recompile every time a new >session is started. (Even though the recompile is done, the installation >is restored to the original set during shutdown of the computer.) > >Here's the problem: when the IDE starts up it recompiles a bunch of >files. For example, codeop.py (created July 18,2001 and modified Aug >19,2001) is recompiled even though the existing codeop.pyc in that >directory has the creation and modification dates of Feb 7, 2002. There >are 68 files in all that are recompiled, located in lib; mac/Lib; >Mac/Tools/IDE; and mac/lib/carbon. > >Why is this recompiling and what can I do to avoid this? The .pyc's date >is more recent than the .py's. In answer to my own question I learned that if one of the libraries in the lib_dynload folder is newer than the .pyc files this will cause the .pyc files to be rebuilt. If you install new library files you will have to recompile all .py files. /c From pydan@danshafer.com Sun Feb 24 05:21:03 2002 From: pydan@danshafer.com (Dan Shafer) Date: Sat, 23 Feb 2002 21:21:03 -0800 Subject: [Pythonmac-SIG] wxPython/GTK Under OS X? References: <3C775374.7090404@danshafer.com> Message-ID: <3C78783F.8010605@danshafer.com> When I tried this after getting fink to recognize the unstable packages as OK to download, I kept getting prompts asking me to resolve virtual dependencies about which I know nothing. I guessed on the first one, bailed at the second. Is this as "clean" as this process gets right now? I'm really new to this Darwin/FreeBSD stuff and I just don't want to muck with stuff that could ultimately destabilize my day-to-day working environment. Neil Tiffin wrote: > I have it installed and working. I used fink. It is in the unstable > directory and it installed and worked just fine. > > You can download fink at: > http://sourceforge.net/project/showfiles.php?group_id=17203 > > I think the doc files are at: > http://fink.sourceforge.net/doc/bundled/usage.php > > However the site is down from me right now. > > To install you > Move the files from unstable to stable (see docs for which files) then > type: > fink install wxgtk wxpython-wxgtk > > Then wait an hour or so and its done. > > No other configuration needed. > > hope this helps. Mine installed version > i wxgtk 2.3.2-3 Cross-platform (unix,windows,mac) GUI > API -... > i wxpython-wxgtk 2.3.2.1-1 Cross platform GUI toolkit for Python > - uni... > > > > > > At 12:31 AM -0800 2/23/02, Dan Shafer wrote: > >> I've tried to follow some of the discussion here about using (I >> think) macho-python under OS X kernel but I'm not entirely sure I >> followed them well. I do have MacPython installed under OS X so it >> runs from the terminal just fine. But I want to begin to explore and >> work with wxPython on OS X as I have been doing on my Least Favorite >> OS of late. >> >> I'm led to believe by folks who seem to know tha I need to get GTK >> installed, then wxPython on top of that. Or that I may well have to >> wait for GTK2 to be available before I can expect this to work. >> >> Can anyone give me some straighit-forward advice and isntructinon? >> >> I'd really appreciate it. >> >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG@python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > > > > From ntiffin@earthlink.net Sun Feb 24 14:09:07 2002 From: ntiffin@earthlink.net (Neil Tiffin) Date: Sun, 24 Feb 2002 09:09:07 -0500 Subject: [Pythonmac-SIG] wxPython/GTK Under OS X? In-Reply-To: <3C78783F.8010605@danshafer.com> References: <3C775374.7090404@danshafer.com> <3C78783F.8010605@danshafer.com> Message-ID: You probably should sign up and direct this question to the fink mail list. I'll bet you have installed xWindows without using fink. I have not done this recently as fink takes care if it better. So I would suggest referring to the fink mail list and the FAQ. The documentation is generally good. There are some items in the fink system that take care of the non-fink installs of x. I think it is system-xfree86 virtual package. Docs are at: http://fink.sourceforge.net/pdb/package.php/system-xfree86 Anything that is available from fink should be installed by fink. Not because it has to. But I have been using fink for year now and I learned that it is simply easier. I would remove xWindows and install it from fink using "fink install xfree86-rootless". This also allows you to have xWindows and Aqua windows side by side. Hope this helps. If you still have questions, please post the actual messages to the fink mail list. They are generally very helpful. Neil At 9:21 PM -0800 2/23/02, Dan Shafer wrote: >When I tried this after getting fink to recognize the unstable >packages as OK to download, I kept getting prompts asking me to >resolve virtual dependencies about which I know nothing. > >I guessed on the first one, bailed at the second. Is this as "clean" >as this process gets right now? I'm really new to this >Darwin/FreeBSD stuff and I just don't want to muck with stuff that >could ultimately destabilize my day-to-day working environment. > >Neil Tiffin wrote: > >>I have it installed and working. I used fink. It is in the >>unstable directory and it installed and worked just fine. >> >>You can download fink at: >>http://sourceforge.net/project/showfiles.php?group_id=17203 >> >>I think the doc files are at: >>http://fink.sourceforge.net/doc/bundled/usage.php >> >>However the site is down from me right now. >> >>To install you >>Move the files from unstable to stable (see docs for which files) then type: >>fink install wxgtk wxpython-wxgtk >> >>Then wait an hour or so and its done. >> >>No other configuration needed. >> >>hope this helps. Mine installed version >> i wxgtk 2.3.2-3 Cross-platform (unix,windows,mac) >>GUI API -... >> i wxpython-wxgtk 2.3.2.1-1 Cross platform GUI toolkit for >>Python - uni... >> >> >> >> >> >>At 12:31 AM -0800 2/23/02, Dan Shafer wrote: >> >>>I've tried to follow some of the discussion here about using (I >>>think) macho-python under OS X kernel but I'm not entirely sure I >>>followed them well. I do have MacPython installed under OS X so it >>>runs from the terminal just fine. But I want to begin to explore >>>and work with wxPython on OS X as I have been doing on my Least >>>Favorite OS of late. >>> >>>I'm led to believe by folks who seem to know tha I need to get GTK >>>installed, then wxPython on top of that. Or that I may well have >>>to wait for GTK2 to be available before I can expect this to work. >>> >>>Can anyone give me some straighit-forward advice and isntructinon? >>> >>>I'd really appreciate it. >>> >>> >>>_______________________________________________ >>>Pythonmac-SIG maillist - Pythonmac-SIG@python.org >>>http://mail.python.org/mailman/listinfo/pythonmac-sig >> >> >> >> > > > >_______________________________________________ >Pythonmac-SIG maillist - Pythonmac-SIG@python.org >http://mail.python.org/mailman/listinfo/pythonmac-sig From steve@spvi.com Sun Feb 24 14:35:39 2002 From: steve@spvi.com (Steve Spicklemire) Date: Sun, 24 Feb 2002 09:35:39 -0500 Subject: [Pythonmac-SIG] CXX/Numeric problem on MacOSX (was building vpython on MacOSX) Message-ID: Hi MacPython Folks (and Paul Dubois), Sorry for bothering you all again, but I'm getting closer to sorting this out, but I think I need another hint. I've got vpython to build on MacOSX, and it runs.. mostly. VPython makes heavy use of the Numeric module, and also uses Paul Dubois' CXX extension class system for creating python objects with c++. I'm an expert on neither, though I have used the Numeric a fair amount. Below is a simple program that shows the problem. "visual" is the module that contains all the vpython stuff, and it does "from Numeric import *" so that all the Numeric code is also in the visual module. It also imports the cvisualmodule, built on Paul's CXX extension system. There is magic in visual.py that calls the correct constructor from cvisualmodule when certain functions in the visual namespace are called (e.g., curve()). If I run this program with no command line arguments, "band" is a simple instance of the dummy class "foo". If I run with a command line argument, "band" is an instance of a "curve" object from the cvisualmodule extension. The program dies no matter what binary operation I perform on two arrays, subtraction, addition, etc. Multiplication by a constant doesn't show this problem however, so it's something in the use of two arrays. If band is a simple instance.... this program runs forever (well.. for a really long time). If band is an instance of a curve object, this program fails after an indeterminate number of iterations (from tens to thousands, with no clear cause). I get e.g., [vh10-15:~/Development/vpython/cvisual] steve% python test_wave2.py 1 Visual-2001-12-30 2 band is a curve iter 1 iter 2 iter 3 iter 4 iter 5 iter 6 iter 7 iter 8 iter 9 iter 10 iter 11 iter 12 iter 13 iter 14 iter 15 iter 16 iter 17 iter 18 iter 19 iter 20 iter 21 iter 22 iter 23 iter 24 iter 25 iter 26 iter 27 iter 28 iter 29 iter 30 iter 31 iter 32 iter 33 iter 34 iter 35 iter 36 iter 37 iter 38 iter 39 iter 40 iter 41 iter 42 iter 43 iter 44 iter 45 iter 46 iter 47 iter 48 iter 49 iter 50 iter 51 iter 52 iter 53 iter 54 iter 55 iter 56 iter 57 iter 58 iter 59 iter 60 iter 61 iter 62 iter 63 iter 64 iter 65 iter 66 iter 67 iter 68 iter 69 iter 70 iter 71 iter 72 iter 73 iter 74 iter 75 iter 76 iter 77 iter 78 iter 79 iter 80 iter 81 iter 82 iter 83 iter 84 iter 85 iter 86 iter 87 iter 88 iter 89 iter 90 iter 91 iter 92 iter 93 iter 94 iter 95 iter 96 iter 97 iter 98 iter 99 iter 100 iter 101 iter 102 iter 103 iter 104 iter 105 iter 106 iter 107 iter 108 iter 109 iter 110 iter 111 iter 112 iter 113 iter 114 iter 115 iter 116 iter 117 iter 118 iter 119 iter 120 iter 121 iter 122 iter 123 iter 124 iter 125 iter 126 iter 127 iter 128 iter 129 iter 130 iter 131 iter 132 iter 133 iter 134 iter 135 iter 136 iter 137 iter 138 iter 139 iter 140 iter 141 iter 142 iter 143 iter 144 iter 145 iter 146 iter 147 iter 148 iter 149 iter 150 iter 151 iter 152 iter 153 iter 154 iter 155 iter 156 iter 157 iter 158 iter 159 iter 160 iter 161 iter 162 iter 163 iter 164 iter 165 iter 166 iter 167 iter 168 iter 169 Traceback (most recent call last): File "test_wave2.py", line 26, in ? bleah = band.foo2 - band.foo1 ValueError: unexpected math error Diggin around I find that this error is generated in the "ufuncmodule" of Numeric. If I try to debug this I get to. The message comes from the math_error() function if ufuncobject, where I set a breakpoint. Breakpoint 2, math_error () at Src/ufuncobject.c:407 (gdb) print errno $1 = most unhelpful! static void math_error() { => if (errno == EDOM) PyErr_SetString(PyExc_ValueError, "math domain error"); else if (errno == ERANGE) PyErr_SetString(PyExc_OverflowError, "math range error"); else PyErr_SetString(PyExc_ValueError, "unexpected math error"); } I'm sure this is some strangeness in the way the CXX stuff builds on MacOSX (this code works on Win/Linux/MacOS9). Does anybody have any suggestions? (BTW I changed my makefile to use "c++" rather than "cc with -lstdc++" and while it "works", the same problem persists. Anyway.. thanks for any thoughts. ;-) -steve import visual import sys print len(sys.argv) class foo: pass if len(sys.argv)<2: band = foo() print "band is a simple class" else: print "band is a curve" band = visual.curve() band.foo1 = visual.array(10*[1],visual.Float) band.foo2 = visual.array(10*[2],visual.Float) i=0 while 1: i += 1 print "iter",i, bleah = band.foo2 - band.foo1 if visual.sum(bleah*bleah) != 10.0: print "Hmm. the math is wrong" sys.stdout.flush() From steve@spvi.com Sun Feb 24 17:34:13 2002 From: steve@spvi.com (Steve Spicklemire) Date: Sun, 24 Feb 2002 12:34:13 -0500 Subject: [Pythonmac-SIG] CXX/Numeric problem on MacOSX (was building vpython on MacOSX) In-Reply-To: Message-ID: Hi (again), OK.. I found out that the error I'm getting is (reproducibly) actually "error 35" described in /usr/include/sys/errno.h as: #define EAGAIN 35 /* Resource temporarily unavailable */ #ifndef _POSIX_SOURCE #define EWOULDBLOCK EAGAIN /* Operation would block */ so.. it's saying that this operation would block or is temporarily unavailable. Why? Any idea? thanks, -steve On Sunday, February 24, 2002, at 09:35 AM, Steve Spicklemire wrote: > Diggin around I find that this error is generated in the "ufuncmodule" > of Numeric. If I try to debug this I get to. > > The message comes from the math_error() function if ufuncobject, where > I set a breakpoint. > > Breakpoint 2, math_error () at Src/ufuncobject.c:407 > (gdb) print errno > $1 = > > most unhelpful! > From steve@spvi.com Sun Feb 24 17:41:42 2002 From: steve@spvi.com (Steve Spicklemire) Date: Sun, 24 Feb 2002 12:41:42 -0500 Subject: [Pythonmac-SIG] CXX/Numeric problem on MacOSX (was building vpython on MacOSX) In-Reply-To: Message-ID: Hi (again), OK.. I found out that the error I'm getting is (reproducibly) actually "error 35" described in /usr/include/sys/errno.h as: #define EAGAIN 35 /* Resource temporarily unavailable */ #ifndef _POSIX_SOURCE #define EWOULDBLOCK EAGAIN /* Operation would block */ so.. it's saying that this operation would block or is temporarily unavailable. Why? Any idea? thanks, -steve On Sunday, February 24, 2002, at 09:35 AM, Steve Spicklemire wrote: > Diggin around I find that this error is generated in the "ufuncmodule" > of Numeric. If I try to debug this I get to. > > The message comes from the math_error() function if ufuncobject, where > I set a breakpoint. > > Breakpoint 2, math_error () at Src/ufuncobject.c:407 > (gdb) print errno > $1 = > > most unhelpful! > From pydan@danshafer.com Sun Feb 24 18:39:16 2002 From: pydan@danshafer.com (Dan Shafer) Date: Sun, 24 Feb 2002 10:39:16 -0800 Subject: [Pythonmac-SIG] wxPython/GTK Under OS X? References: <3C775374.7090404@danshafer.com> <3C78783F.8010605@danshafer.com> Message-ID: <3C793354.4060808@danshafer.com> OK, Neil. Thanks. I'll go bother the Fink people for a while! :-) Neil Tiffin wrote: > You probably should sign up and direct this question to the fink mail > list. > > I'll bet you have installed xWindows without using fink. I have not > done this recently as fink takes care if it better. So I would > suggest referring to the fink mail list and the FAQ. The > documentation is generally good. There are some items in the fink > system that take care of the non-fink installs of x. I think it is > system-xfree86 virtual package. Docs are at: > > http://fink.sourceforge.net/pdb/package.php/system-xfree86 > > Anything that is available from fink should be installed by fink. Not > because it has to. But I have been using fink for year now and I > learned that it is simply easier. I would remove xWindows and install > it from fink using "fink install xfree86-rootless". This also allows > you to have xWindows and Aqua windows side by side. > > Hope this helps. If you still have questions, please post the actual > messages to the fink mail list. They are generally very helpful. > > Neil > > At 9:21 PM -0800 2/23/02, Dan Shafer wrote: > >> When I tried this after getting fink to recognize the unstable >> packages as OK to download, I kept getting prompts asking me to >> resolve virtual dependencies about which I know nothing. >> >> I guessed on the first one, bailed at the second. Is this as "clean" >> as this process gets right now? I'm really new to this Darwin/FreeBSD >> stuff and I just don't want to muck with stuff that could ultimately >> destabilize my day-to-day working environment. >> >> Neil Tiffin wrote: >> >>> I have it installed and working. I used fink. It is in the >>> unstable directory and it installed and worked just fine. >>> >>> You can download fink at: >>> http://sourceforge.net/project/showfiles.php?group_id=17203 >>> >>> I think the doc files are at: >>> http://fink.sourceforge.net/doc/bundled/usage.php >>> >>> However the site is down from me right now. >>> >>> To install you >>> Move the files from unstable to stable (see docs for which files) >>> then type: >>> fink install wxgtk wxpython-wxgtk >>> >>> Then wait an hour or so and its done. >>> >>> No other configuration needed. >>> >>> hope this helps. Mine installed version >>> i wxgtk 2.3.2-3 Cross-platform (unix,windows,mac) >>> GUI API -... >>> i wxpython-wxgtk 2.3.2.1-1 Cross platform GUI toolkit for >>> Python - uni... >>> >>> >>> >>> >>> >>> At 12:31 AM -0800 2/23/02, Dan Shafer wrote: >>> >>>> I've tried to follow some of the discussion here about using (I >>>> think) macho-python under OS X kernel but I'm not entirely sure I >>>> followed them well. I do have MacPython installed under OS X so it >>>> runs from the terminal just fine. But I want to begin to explore >>>> and work with wxPython on OS X as I have been doing on my Least >>>> Favorite OS of late. >>>> >>>> I'm led to believe by folks who seem to know tha I need to get GTK >>>> installed, then wxPython on top of that. Or that I may well have to >>>> wait for GTK2 to be available before I can expect this to work. >>>> >>>> Can anyone give me some straighit-forward advice and isntructinon? >>>> >>>> I'd really appreciate it. >>>> >>>> >>>> _______________________________________________ >>>> Pythonmac-SIG maillist - Pythonmac-SIG@python.org >>>> http://mail.python.org/mailman/listinfo/pythonmac-sig >>> >>> >>> >>> >>> >> >> >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG@python.org >> http://mail.python.org/mailman/listinfo/pythonmac-sig > > > From Jack.Jansen@oratrix.com Sun Feb 24 22:29:24 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Sun, 24 Feb 2002 23:29:24 +0100 Subject: [Pythonmac-SIG] Re: why the recompile? In-Reply-To: Message-ID: On Saturday, February 23, 2002, at 06:47 PM, Christopher Smith wrote: > In answer to my own question I learned that if one of the > libraries in the > lib_dynload folder is newer than the .pyc files this will cause > the .pyc > files to be rebuilt. I doubt that this is really the problem, at least, I can't imagine why it would be so. I more suspect a problem with modtimes not being preserved and/or different timezones (combined with the way GUSI attempts to convert MacOS's localtime-based timestamps to unix's GMT-based timezones). But if it indeed has to do with a newer file that is totally unrelated to the module being imported then there's a bug in the Mac import code somewhere. Could you try running with "trace import" and "also show failed attempts"? Not sure whether this'll give more information but it's worth a try. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From Jack.Jansen@oratrix.com Sun Feb 24 22:34:12 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Sun, 24 Feb 2002 23:34:12 +0100 Subject: [Pythonmac-SIG] CXX/Numeric problem on MacOSX (was building vpython on MacOSX) In-Reply-To: Message-ID: On Sunday, February 24, 2002, at 03:35 PM, Steve Spicklemire wrote: > > static void math_error() { > => if (errno == EDOM) > PyErr_SetString(PyExc_ValueError, "math domain error"); > else if (errno == ERANGE) > PyErr_SetString(PyExc_OverflowError, "math range error"); > else > PyErr_SetString(PyExc_ValueError, "unexpected math error"); > } Try changing the last else so that it shows you the errno number (or preferrably string, through strerror()). Paul: this might be a useful fix in general, it might be a nuisance if the error identity gets lost. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From steve@spvi.com Sun Feb 24 20:15:34 2002 From: steve@spvi.com (Steve Spicklemire) Date: Sun, 24 Feb 2002 15:15:34 -0500 Subject: [Pythonmac-SIG] CXX/Numeric problem on MacOSX (was building vpython on MacOSX) In-Reply-To: Message-ID: <423226AC-2963-11D6-BC2C-0050E480B13C@spvi.com> Hi Folks, OK.. I think I'm narrowing this down... is it possible for one thread to have a problem.. thereby setting errno.. then another thread *checks* errno and assumes it's a problem with something it's done, where it was really another thread entirely? thanks, -steve On Sunday, February 24, 2002, at 12:41 PM, Steve Spicklemire wrote: > Hi (again), > > OK.. I found out that the error I'm getting is (reproducibly) actually > "error 35" described in /usr/include/sys/errno.h as: > > #define EAGAIN 35 /* Resource temporarily > unavailable */ > #ifndef _POSIX_SOURCE > #define EWOULDBLOCK EAGAIN /* Operation would block */ > > so.. it's saying that this operation would block or is temporarily > unavailable. Why? Any idea? > > thanks, > -steve > > On Sunday, February 24, 2002, at 09:35 AM, Steve Spicklemire wrote: > >> Diggin around I find that this error is generated in the "ufuncmodule" >> of Numeric. If I try to debug this I get to. >> >> The message comes from the math_error() function if ufuncobject, where >> I set a breakpoint. >> >> Breakpoint 2, math_error () at Src/ufuncobject.c:407 >> (gdb) print errno >> $1 = >> >> most unhelpful! >> > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig From Jack.Jansen@oratrix.com Mon Feb 25 09:32:31 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Mon, 25 Feb 2002 10:32:31 +0100 Subject: [Pythonmac-SIG] CXX/Numeric problem on MacOSX (was building vpython on MacOSX) In-Reply-To: <423226AC-2963-11D6-BC2C-0050E480B13C@spvi.com> Message-ID: <97A0FBE4-29D2-11D6-8301-0030655234CE@oratrix.com> On Sunday, February 24, 2002, at 09:15 , Steve Spicklemire wrote: > Hi Folks, > > OK.. I think I'm narrowing this down... is it possible for one thread > to have a problem.. thereby setting errno.. then another thread > *checks* errno and assumes it's a problem with something it's done, > where it was really another thread entirely? I think errno is per-thread on OSX. But it could well be that you have to compile Numeric with WITH_THREAD to make evertyhing work correctly from the Python side. Distutils should have taken care of this, but you may want to check to make sure. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From steve@spvi.com Mon Feb 25 20:47:54 2002 From: steve@spvi.com (Steve Spicklemire) Date: Mon, 25 Feb 2002 15:47:54 -0500 Subject: [Pythonmac-SIG] CXX/Numeric problem on MacOSX (was building vpython on MacOSX) In-Reply-To: <97A0FBE4-29D2-11D6-8301-0030655234CE@oratrix.com> Message-ID: OK.. it's almost certainly a problem with Numeric and threads. I modified NumPy's ufuncobject.c like this: [spicklemire:~/Packages] steve% diff -c Numeric-20.3-orig/Src/ufuncobject.c Numeric-20.3/Src/ufuncobject.c *** Numeric-20.3-orig/Src/ufuncobject.c Tue Aug 14 11:18:24 2001 --- Numeric-20.3/Src/ufuncobject.c Mon Feb 25 15:42:08 2002 *************** *** 470,477 **** if (self->check_return) check_array(mps[i]); } ! if (self->check_return && errno != 0) {math_error(); return -1;} ! return 0; } --- 470,488 ---- if (self->check_return) check_array(mps[i]); } ! if (self->check_return && (errno != 0)) ! { ! if ((errno == EDOM) || (errno == ERANGE)) ! { ! math_error(); return -1; ! } ! else ! { ! fprintf(stderr, "Hmm.. error encountered -> %i\n", errno); ! perror("error in ufunc generic function:"); ! } ! } ! return 0; } Now when I try to run the NumTut demo I see: [spicklemire:~/Packages/Numeric-20.3/Demo] steve% python -c "import NumTut;NumTut.test()" >>> view(greece) >>> view(1.0-greece) Hmm.. error encountered -> 35 error in ufunc generic function:: Resource temporarily unavailable >>> view(greeceBW) >>> view(greece*xgrade) >>> view(greece*ygrade) >>> negative = 1.0 - greece >>> view(greece*xgrade + negative*ygrade) >>> view(red) >>> view(green) >>> view(blue) >>> sine = sin(xgrade*6*pi) >>> view(green*sine + red*(1.0-sine)) >>> view(green + red[::-1]) >>> view(transpose(greece, (1,0,2))) [spicklemire:~/Packages/Numeric-20.3/Demo] steve% python -c "import NumTut;NumTut.test()" >>> view(greece) >>> view(1.0-greece) >>> view(greeceBW) >>> view(greece*xgrade) >>> view(greece*ygrade) >>> negative = 1.0 - greece >>> view(greece*xgrade + negative*ygrade) >>> view(red) >>> view(green) >>> view(blue) >>> sine = sin(xgrade*6*pi) >>> view(green*sine + red*(1.0-sine)) >>> view(green + red[::-1]) >>> view(transpose(greece, (1,0,2))) [spicklemire:~/Packages/Numeric-20.3/Demo] steve% python -c "import NumTut;NumTut.test()" >>> view(greece) >>> view(1.0-greece) Hmm.. error encountered -> 35 error in ufunc generic function:: Resource temporarily unavailable >>> view(greeceBW) >>> view(greece*xgrade) >>> view(greece*ygrade) >>> negative = 1.0 - greece >>> view(greece*xgrade + negative*ygrade) >>> view(red) >>> view(green) >>> view(blue) >>> sine = sin(xgrade*6*pi) >>> view(green*sine + red*(1.0-sine)) >>> view(green + red[::-1]) >>> view(transpose(greece, (1,0,2))) So... ufuncs just multiply, divide and suchlike! What "resources" are not available? It's fairly clear that it's thread related, since all the Numeric tests pass every time in a non-threaded example, as well as my own non-threaded testing to attempt to reproduce what I thought originally was a linking problem. So... how can I track down where errno is actually getting set? Does the fact that it happens "randomly" mean that it's not due to some numerical computation, but more likely about timing between threads? thanks, -steve On Monday, February 25, 2002, at 04:32 AM, Jack Jansen wrote: > > On Sunday, February 24, 2002, at 09:15 , Steve Spicklemire wrote: > >> Hi Folks, >> >> OK.. I think I'm narrowing this down... is it possible for one thread >> to have a problem.. thereby setting errno.. then another thread >> *checks* errno and assumes it's a problem with something it's done, >> where it was really another thread entirely? > > I think errno is per-thread on OSX. But it could well be that you have > to compile Numeric with WITH_THREAD to make evertyhing work correctly > from the Python side. Distutils should have taken care of this, but you > may want to check to make sure. > -- > - Jack Jansen > http://www.cwi.nl/~jack - > - If I can't dance I don't want to be part of your revolution -- Emma > Goldman - From logical_j@yahoo.com Tue Feb 26 20:00:24 2002 From: logical_j@yahoo.com (Jinfeng Liu) Date: Tue, 26 Feb 2002 12:00:24 -0800 (PST) Subject: [Pythonmac-SIG] PIL problem: conflict between _imagingtk & _tkinter Message-ID: <20020226200024.13038.qmail@web10704.mail.yahoo.com> Hi everyone. I'm a new comer. I'm using PIL and need the ImageTk interface. Due to some kind of name space conflict, python crashes: dyld: python multiple definitions of symbol _TclAccess /usr/local/lib/python2.2/lib-dynload/_tkinter.so definition of _TclAccess /usr/local/lib/python2.2/site-packages/PIL/_imagingtk.so definition of _TclAccess I got this problem previously using python2.2b1. Now I'm using python2.2. The problem is still there but python interpretor doesn't crash. Instead it always refuses to load the 2nd module: >>> import _tkinter >>> import _imagingtk Traceback (most recent call last): File "", line 1, in ? ImportError: Failure linking new module I'm using python2.2 Tcl/Tk 8.4a3, PIL 1.1.2, GCC2.95.2 on OS X 10.1. The same problem also appeared with python2.1. Does anyone have ideas how to fix it? Thanks. __________________________________________________ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com From sdupree@computational-astronomer.com Wed Feb 27 04:27:26 2002 From: sdupree@computational-astronomer.com (Samuel H. Dupree, Jr.) Date: Tue, 26 Feb 2002 23:27:26 -0500 Subject: [Pythonmac-SIG] Installing Pyfort into MacPython Message-ID: <3C7C602B.2B91589@speakeasy.net> --------------C91B68F9CF4FA9CE0B052526 Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353" Content-Transfer-Encoding: 7bit Greetings, I'm interested in installing the Pyfort interface tool into MacPython. Being new to Python, it wasn't clear to me just how one either installs of updates a package in MacPython version 2.2. If spomeone would point me to the documentation or to someone who has installed Pyfort into MacPython, I'd appreciate it. Looking forward to hearing from you. Sam Dupree. P.S. - BTW I'm running Absoft's Pro Fortran version 7.0 under Mac OS 9.1 on a PowerComputing PowerTower Pro 225, and as I've said before, I'm new to MacPython. -- ============================================================================ Samuel H. Dupree, Jr. sdupree@speakeasy.net 600 West Harvey St., Apt A-703 Philadelphia, PA 19144, USA http://www.speakeasy.net/~sdupree/ HOME: (215) 842-3663 WORK: (610) 531-7994 FAX: (610) 531-3145 "What does it take to travel in space? The will to do it." - Dr. Wernher von Braun ============================================================================ --------------C91B68F9CF4FA9CE0B052526 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit  

Greetings,
 

I'm interested in installing the Pyfort interface tool into MacPython.
Being new to Python, it wasn't clear to me just how one either installs
of updates a package in MacPython version 2.2. If spomeone would point me
to the documentation or to someone who has installed Pyfort into MacPython,
I'd appreciate it.

Looking forward to hearing from you.

Sam Dupree.
 

P.S. - BTW I'm running Absoft's Pro Fortran version 7.0 under Mac OS 9.1
       on a PowerComputing PowerTower Pro 225, and as I've said before,
       I'm new to MacPython.

--
============================================================================
  Samuel H. Dupree, Jr.                         sdupree@speakeasy.net
  600 West Harvey St., Apt A-703
  Philadelphia, PA 19144, USA           http://www.speakeasy.net/~sdupree/

  HOME: (215) 842-3663      WORK: (610) 531-7994       FAX: (610) 531-3145

        "What does it take to travel in space? The will to do it."
                                          - Dr. Wernher von Braun
============================================================================
  --------------C91B68F9CF4FA9CE0B052526-- From english@spiritone.com Wed Feb 27 17:24:59 2002 From: english@spiritone.com (Josh English) Date: 27 Feb 2002 09:24:59 -0800 Subject: [Pythonmac-SIG] Question about old software Message-ID: <3C7D166C.2AE41714@spiritone.com> I have one of those annoying "I'm stuck in history and need help questions." I am working on a website for my church that already uses cgi and I want to spice it up a bit and make the cgi a larger part of the site to make inquiries about an event database on several pages. The host provider has Python 1.5 avaialable for cgi scripts. I have inquired about their upgrading but I am not optimistic on this point. I think it would be an easy thing to do on their side, but I don't think they will. Anyway, I back to python 1.5.2 working out the scripts and I would like to test them using Apple's Personal Web Server on OS9.1. There is an html file in the 1.5 distribution that makes reference to mkapplet, which I can't find in the distribution. Does someone have an old copy they could forward me or tell me where to find it? A few web searches have prooved fruitless. Thanks for any help, Josh English english@spiritone.com http://www.spiritone.com/~english From Jack.Jansen@oratrix.com Wed Feb 27 22:19:40 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Wed, 27 Feb 2002 23:19:40 +0100 Subject: [Pythonmac-SIG] Question about old software In-Reply-To: <3C7D166C.2AE41714@spiritone.com> Message-ID: <17AC5300-2BD0-11D6-8309-003065517236@oratrix.com> On woensdag, februari 27, 2002, at 06:24 , Josh English wrote: > Anyway, I back to python 1.5.2 working out the scripts and I would like > to test them using Apple's Personal Web Server on OS9.1. There is an > html file in the 1.5 distribution that makes reference to mkapplet, > which I can't find in the distribution. Does someone have an old copy > they could forward me or tell me where to find it? A few web searches > have prooved fruitless. 1.5.2 should have it. But it could well be that it was already called BuildApplet but that the docs incorrectly referred to it as mkapplet (the old name). 1.5.2 should also have the CGI examples, I think, either in :Mac:Tools or :Mac:Contrib. These are definitely worth checking out, if 1.5.2 doesn't have them get them from the next distribution, there's a 2.0 (which I think calls itself 2.0c1 inadvertently) in http://www.cwi.nl/ftp/jack/python/mac/old. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From daniel_t@gorilla.com Thu Feb 28 15:30:12 2002 From: daniel_t@gorilla.com (Daniel T.) Date: Thu, 28 Feb 2002 10:30:12 -0500 Subject: [Pythonmac-SIG] Newbie question GetIndString Message-ID: I cant figure out what I need to import in order to use GetIndString. Is there a module that already has the StringUtils stuff in it? -- From Jack.Jansen@oratrix.com Thu Feb 28 21:14:35 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Thu, 28 Feb 2002 22:14:35 +0100 Subject: [Pythonmac-SIG] 2.2.1 and Waste Message-ID: <2A951B2F-2C90-11D6-8B25-003065517236@oratrix.com> Folks, I'm about 90% done for 2.2.1, there's one issue left that I want your feedback on. I've included the new versions of most toolbox modules, since they appear fully backward compatible (i.e. I count on you all to download the 2.2.1 alfa or FC or whatever it's going to be called) and there's exciting new stuff in there (Carbon scrap manager, finally, and unicde support for CFStrings, to name two) and the current version of the IDE uses the new stuff and looks a lot better on OSX. One thing that I'm not sure about, however, is Waste. If I could use the current waste this would mean that enabling waste on OSX MachoPython would allow you to play with the IDE in MachoPython. It sort-of runs. But, as Waste is an external package, this may compromise backward compatibility, and micro-releases are supposed to be 100% backward compatible. The new waste is compatible with IDE, so there's really no reason to believe there will be any problems here, but still: if you use waste either tell me not to update it, or please make sure to download the 2.2.1 alfa and test your application. And if you're going to tell me not to update please do it soon or you'll be too late:-) -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - From macnerd@dontspam.realmspace.com Thu Feb 28 22:09:16 2002 From: macnerd@dontspam.realmspace.com (macnerd) Date: Thu, 28 Feb 2002 14:09:16 -0800 Subject: [Pythonmac-SIG] Introduction In-Reply-To: <2A951B2F-2C90-11D6-8B25-003065517236@oratrix.com> Message-ID: <000a01c1c0a4$909c0c80$bdc8a8c0@jmenchacant> Hello. I work as Whitebox Server QA engineer for mail and wireless technologies. My hobby is web-technologies and also the MacOS (and MacOS X), so naturally all of these interest collide in this area of scripting langauges. At work, I am toying with OLE Automation using Perl. I managed to crash the Outlook 2K OLE Server and not know how. :-( I am interested in programming on the Macintosh and I am also interested in technologies like XML, SVG, XSLT, and CGI. The Zope project has caught my attention. I am exploring Python to see what I can do with it. I am interested in getting it to work for both Mac OS X and Classic Mac OS. The WASTE issues seems to be a big problem. I briefly researched it. If WASTE is not supported, and replaced with something like MLTE, then System 7 and System 8 is not longer supported any longer. This would seem like a big waste. :'-( WASTE seems cool, but I rather that there was a open source totally freeware, as opposed to shareware applications. :-\ - Joaquin From Jack.Jansen@oratrix.com Thu Feb 28 22:24:56 2002 From: Jack.Jansen@oratrix.com (Jack Jansen) Date: Thu, 28 Feb 2002 23:24:56 +0100 Subject: [Pythonmac-SIG] Introduction In-Reply-To: <000a01c1c0a4$909c0c80$bdc8a8c0@jmenchacant> Message-ID: On donderdag, februari 28, 2002, at 11:09 , macnerd wrote: > The WASTE issues seems to be a big problem. I > briefly researched it. If WASTE is not supported, > and replaced with something like MLTE, then > System 7 and System 8 is not longer supported any > longer. This would seem like a big waste. :'-( Don't worry: waste is now supported in MachoPython (which is the term we use here for the Mach-O based unix Python running on OSX, to distinguish it from MacPython, which refers to the CFM-based PythonInterpreter that runs both on OS9 and OSX). If you build from the CVS repository you can get the IDE limping along in MachoPython. And I hope this functionality can be smuggled into 2.2.1, which is due soon. -- - Jack Jansen http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman -