David C. Ullrich wrote: > On Thu, 01 Nov 2007 19:39:20 -0500, Robert Kern > <[EMAIL PROTECTED]> wrote: > >> David C. Ullrich wrote: >>> [why doesn't CoreGraphics work?] >> That's different than the one that is referenced. The one those articles >> reference is only available in the Python that came with the system in >> /System/Library/Frameworks/Python.framework, not one that you might have >> installed from www.python.org into /Library/Frameworks/Python.framework. The >> module was made by Apple, and they have not released the source code, so it >> cannot be made to work with the www.python.org distribution. > > usenet is amazing - your reply appears to have been > posted a half hour before my question! Thanks. > > So CoreGraphics is a builtin in Apple-Python, > explaining why I didn't find the relevant > CoreGraphics.py anywhere on the hard drive, eh?
Okay, which version of OS X do you have? In 10.3 and 10.4 it used to be here: /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-mac/CoreGraphics.py I notice that in 10.5, it no longer exists, though. > Fine. Now what? Please feel free to bear in mind > that I have very little experience with the Mac > and with Unix - I'm certain that if I knew what > I was doing there I wouldn't need to ask the > questions below, sorry. And sorry about the length > of this post - there's a second issue that maybe > you could explain, that I'd really love to have > an explanation for before modifying things. Anyway: > > Since I didn't do anything special to remove it > when I installed the Python-Python, the Apple-Python > should still be there, yes? Yes, in the location I mentioned. > I'd appreciate any > advice on how to get things set up the way I'd > like. Below when I refer to the MacPython stuff > I mean ApplicationLauncher (or however it's spelled, > the Mac's at the office and I'm at home) and Idle; > the stuff that gives convenient access to Python > scripts in the GUI. > > Note that I don't have any particular reason to > want to use the latest version of Python - I was > actually getting along fine with 1.5 until very > recently. I'd be perfectly happy to set things > up so everything used the Apple-Python. (i) If I > just uninstalled the Python-Python (how?) would > everything (Terminal, the MacPython stuff) > automagically find the Apple-Python instead? > (ii) If not, what would I have to do to make > things use the Apple-Python instead? (And if > I have to do something to make that happen, > would doing that still work if I just left > the Python-Python sitting there?) Python-Python installed a couple of symlinks into /usr/local/bin and then put /usr/local/bin in the front of your $PATH environment variable so it gets picked up first on the terminal. For my Python-Python 2.5, I have python python2.5 pythonw pythonw2.5 python-config python2.5-config Remove these and then when you type "python" at the terminal, you will get /usr/bin/python, which points to the Apple-Python. > OR: Is there something special I could do with > CoreGraphics scripts and/or how I invoke them > so that _they_ would use the Apple-Python while > other scripts would just use the Python-Python > as now? For scripts executed from the terminal, you could start them with a hash-bang line: #!/usr/bin/python Use "chmod u+x" on the script, and then you can execute it like any other program from the terminal. > (A last choice would be a setup where most > scripts work as they do now and I somehow > make CoreGraphics work from Terminal but > not in Finder...) > > (Hmm, a wild guess: something somewhere is an > alias to Python-Python, and I just change that > (how?) to an alias to Apple-Python?) > > I'm a little nervous about making any changes, > because something very mysterious happened when > I was setting things up the way they are now - > since I have no idea what I did to make things > work the way they are now I don't know that > I could set things up the way they are now > again if I had to. If you can explain the > following that will be something (I've been > meaning to ask about the following sometime, > hasn't been important til now when I'm > contemplating changing the setup): > > The history: I get a Mac. I discover that it > includes Python, can't figure out how to > execute .py files in Finder. I hear about > MacPython. > > I install the "small" MacPython download, that's > supposed to just add ApplicationLauncher(?), > Idle, etc on top of the existing Python. > Works fine _except_ that when I double-click > a .py file in Finder it executes with the > cwd equal to the root directory instead of > the directory where the script is located. > > Trying to fix that I install the "full" > MacPython, including Python itself. Doesn't > help, scripts still execute in "/". > > A few weeks later I decide to try to fix that. > The plan is to edit whatever.py, the script > that's supposed to run before everything else > allowing customizations (always takes me a > while to find the magic name in the docs - > probably you know the name I mean). The plan > is to extract the directory I want from > sys.argv and then chdir. > > And here's the mysterious part: The day I > plan on modifying whatever.py I find the > problem has fixed itself! When I double- > click .py files they execute in the right > directory. > > If you asked what I was smoking I wouldn't blame > you. (Not that I really think that's it, but > the _only_ thing I can imagine I did that > could have led to the change was that perhaps > I hadn't yet tried out Idle when things were > executing in the wrong directory, and somehow > the first time I ran Idle it fixed something > for me.) > > Anyway. You have any idea what was going on there, > and/or any idea about what to do to fix that > problem if it appears again? I'm afraid I don't. I don't use ApplicationLauncher. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list