Update: If you are receiving an error when attempting to point PyDev to the OS X 10.5 install of Python 2.5 and are looking for the proper path to fix the error, then feel free to skip my rant by jumping down to here.
During the weekend I decided to begin playing with the Google App Engine and see what all the hubbub was about. Like most developers I couldn’t get into the preview (yet) but I could download and run the SDK. The SDK is all Python, a language I knew a little about but never delved into. Actually, the only thing I knew about it was that whitespace matters and having a good IDE is critical. Knowing this I looked up IDE options and found a plugin called PyDev for my favorite IDE, Eclipse.
After taking a brief look at the feature set I saw the important ones; code completion, debugging, refactoring and I was sold. I downloaded the plugin into Eclipse 3.3.2 and fired it up. The
fist first thing I tried to do was create a new project, when I tried that I got a message informing me that I had to define the Python interpreter settings before I could create a project. Okay, makes sense to me.
I looked up the help docs and it said to open Eclipse > preferences > PyDev > Interpreter – Python, choose new… from the Interpreters section and point to my Python install directory. I knew that OS X Leopard has Python built in so I look into the usual locations such as ~/Library/, /Library/ and /System/. Nothing obvious jumped out so I did a quick search on the web and find the default install location is:
Awesome, so I point the Interpreter to the Python exec yet it won’t let me choose it. Well, it is a symlink so maybe I need to go to the actual exec. I know that OS X has 2.5 installed so I navigate down to:
and try to choose the Python exec located there. It accepts this location and then when I select it I get the “Error getting info on interpreter” dialog. What the hell does that mean? It has some notes in the dialog that says that common errors include specifying an invalid interpreter and/or spaces in the Eclipse path. Oops. I have have a space in my Eclipse path, I fix it then try again. Same error. Hmmmm….
There is also a bug documentation URL referenced in dialog so I do some searching and it tells me that if you get this error you are pointing to an invalid interpreter. Well duh, the dialog told me that much. What frustrates me is that the bug URL has the people responding back with “Hey, I fixed it.” with no statement on how, just that they fixed it! Okay, that’s not helping… time to do some testing.
I try using 2.3 to see if that works. Nope, same error. Okay, what other paths are there? I do some more digging and find out there is actually an APP file located at:
I try both the Python.app and Python Launcher.app. This time a get a different error:
Check your error log for more details.
More info can also be found at the bug report:
java.io.IOException: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app: cannot execute
WTF!?!? I do more digging and people are having the same issue but NO WHERE IS IT DOCUMENTED ON HOW TO FIX IT!?!?! Okay, deep breaths… I want to use this plugin and people have it working in OS X and swear by it, I must prevail!
I do some more searching and stumble upon a forum that talks about getting PyDev running with Maya.
Update: Gabriel Lamounier provided the direct path to Python for Leopard in the comments section for my original post. He points out that the correct path is:
I verified it and PyDev does like this path. Thanks Gabriel, I swore I tried this path during my testing but I must not have, after multiple hours of digging it’s sometimes easy to miss the semi-obvious. So, the easy answer is… use this path when setting up your Python interpreter. For grins, read the rest of the post to find out the “hack” way I came upon.
It seems that you cannot point to the APP but you have to point to the contents in the APP which contains the Python interpreter. sigh Seriously, who would have thunk it? So, the path for the Python interpreter in OS X 10.5 is:
Remember, an OS X APP is really just a fancy Directory. But wait, there’s more! You can’t actually navigate to the contents of an APP file from your standard OS X open dialog. Well thank god for kessaris who posted the Maya solution because he mentions that when you are in the open dialog you can press
SHIT-CMD-G SHIFT-CMD-G to open a URL dialog that allows you to paste a path in. In most cases you have to Right click (CMD-Click) > Paste… to get the path in, but once you do you will see the Python interpreter in the MacOS folder. Select it and it works! You are now off to the Python races.
I want to give a big shout out to kessaris, whoever you are, for posting this incredibly helpful reply. Also, I hope this post helps someone install PyDev, because it really, really is a great IDE. More on PyDev and the Google App Engine coming soon!!