PyObjC -- does it, or doesn't it?

I've got a couple small projects I'm eagerly looking forward to implementing, to get my feet wet in Mac development. Unfortunately, every turn I take brings me to another roadblock.

My background is very heavy in scripting (DCL, Perl, PHP, etc). While I do have some exposure to HLL dev, it's been years since I've done anything from scratch (I have done some maintenance on C++ code within the past year, but not much), and the learning curve on the OO stuff has made me decide to hold off on that approach for now. (That and trying to figure out whether to program in C++, Objective C, or something else.)

So I took a look at the scripting options. Automator was quickly ruled out as way less than what I needed.

AppleScript is more wordy and obtuse than COBOL. Seriously. Someone thought this was a good approach to take 50 years after Grace Hopper's invention? But I digress...

That was when I discovered that there was a Python environment within XCode. Sounds great! Except...

The tutorials seem to be hopelessly out of date. NibClassBuilder doesn't exist on my system (10.6.2 w/ XCode 3.0). The only reference to PyObjC I can find is in the documentation directory -- the tree structure that Apple says is supposed to exist (/Developer/Python/PyObjC/) doesn't exist. Then I find that with XCode 3.2, PyObjC is no longer included. But I'm running 3.0. So in desperation, I go to the PyObjC SF page and follow the instructions there to do an easy_install. It fails, puking on a lack of gcc. Seriously? I need another compiler to get scripting to work? Then I read on their Home page in a post from 11/24 that you shouldn't do an easy_install anyways (you know, right above the instructions that say to do an easy_install). And where the Apple docu shows separate downloads for a wide variety of versions of PyObjC, the download page on SF looks nothing like that, and only allows you to d/l either 2.0 (out of date) or 2.2b1 (a beta?) So I go back to my system to do an *easy_install PyObjC*, and it says I'm already running 2.2. So why doesn't it exist? Why don't any of the templates show up in XCode?

I tell you all this not to try and find a solution for any one piece of the above puzzles, but to give you an idea as to my level of frustration.

So, my questions are, is Apple deprecating the use of the Python environment in XCode? Is it reasonable to expect to be able to code in Python with PyObjC anymore? Is there any documentation anyplace that reflects the current state of the environment? If not Python, what path should I take for a couple small projects to get my feet wet?

I just wanted to write a couple programs, and I am pulling my hair out. "Get my feet wet"? I feel like I fell in and am drowning...

MacBook, 2.4GHz black, Mac OS X (10.6.2)

Posted on Jan 10, 2010 2:11 PM

Reply
3 replies

Jan 10, 2010 3:42 PM in response to Alphaman.

Python 2.6/2.5/2.3, and Ruby 1.8 frameworks are in the system, Apple just pulled the Xcode project templates because apparently there was an issue with keeping them up to date. I don't know about up to date examples, but like AppleScript Studio (which is deprecated), you can copy Leopard's project templates into Snow Leopard. If you have the Developer Tools (Xcode) installed, you also already have gcc.

I've copied the Cocoa-Python templates from Leopard's */Developer/Library/Xcode/Project Templates/Application/* folder into my Snow Leopard user's *~/Library/Application Support/Developer/Shared/Xcode/Project Templates/Python Applications/* folder and they seem to build OK. I'm still playing with AppleScriptObjC though, so haven't gotten around to looking at Python yet.

If you don't have access to a Leopard install, there is a thread at stackoverflow with instructions on building some templates from source.

Jan 10, 2010 4:34 PM in response to Alphaman.

PyObjC was not written by Apple, so they are under no obligation to support it. They are however unlikely to take an active hand in its demise since they do ship a couple of system components which rely on it.

You should not expect to get out of learning Objective-C just because a Python bridge exists, either. You still have to know what you're doing, you just get to do it in a different syntax without all the obnoxious square brackets, and without the help of the debugger.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

PyObjC -- does it, or doesn't it?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.