(MAC) CoreGraphics module???

David C. Ullrich ullrich at math.okstate.edu
Fri Nov 2 08:19:19 EDT 2007


On Thu, 01 Nov 2007 19:39:20 -0500, Robert Kern
<robert.kern at gmail.com> 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?

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? 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?)

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?

(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? Something somewhere
changed - what, and how do I change it manually?
"defaults write what.what.what what what"?
Or what? I'd be much happier understanding what
happened here before making any changes...

Evidently you've read this far - thanks. Long
posts are irritating. Of course so are posts
that don't describe the problem - oh well.


************************

David C. Ullrich



More information about the Python-list mailing list