PDA

View Full Version : Python in Xcode


Oskar
2006-02-03, 09:37
I understand that OSX comes with Python preinstalled. However, does Xcode play nice with it? When I start a blank file, can I just start typing python and it will recognize it and color the code accordingly? I figure it is more complicated than that, so chime in if you can.

PS. I'm aware of PyObjC. I don't know if I need that in order to use python - please let me know if I do.

Thanks!

scratt
2006-02-03, 10:06
Is this any good..

http://ulaluma.com/pyx/archives/2004/02/running_python.html

'Google is your friend' TM

EDIT : This is kind of interesting too..

http://www.codecomments.com/archive243-2004-3-153273.html

Barto
2006-02-03, 10:20
If you're writing python applications, I'd recommend a text editor like SubEthaEdit, TextMate or BBEdit over the (pretty bloated) IDE that is Xcode.

That said, when you save a file as "blahblahblah.py" then Xcode should automatically recognise it as such and use python highlighting and indenting. A new, unsaved document won't have highlighting/indenting because Xcode won't know what the hell it is.

PyObjC isn't necessary to make console python applications but it is required to make Mac OS X happy-fun-GUI applications.

Oskar
2006-02-03, 11:20
Is this any good..

http://ulaluma.com/pyx/archives/2004/02/running_python.html
I did what they said and chose "Run executable" but it brings me to a command line. What's up with that?

'Google is your friend' TM
In my defense, I already tried google but didn't find much ;)

EDIT : This is kind of interesting too..

http://www.codecomments.com/archive243-2004-3-153273.html

One guy says: I don't think you'll get debugging support no matter what you do.

Aww, I guess I'll try another editor like Barto suggests. It doesn't look like I can get the level of integration I want with Xcode :(

Edit: If anyone has a mac python editor to suggest, please tell me. I'll look at the ones Barto suggested too. I don't care if it is free or open source - in fact, I might prefer a pay-for editor as it probably is higher quality.

scratt
2006-02-03, 11:25
SubEthEdit is great, as Barto says. Although I have to say that when you just load a source file into Xcode it seems to load a lot quicker than Xcode proper, so I don't have a problem using Xcode most of the time as a lot of my files default to that now..

I tend to use Xcode for all C++ source etc, and SubEthaEdit to work on data files, XML, HTML, CSS etc..

I used to use BBedit, but to be honest SubEthEdit is free and better, so I don't know how BBEdit gets away with it...

(P.S. Thanx to Brad originally for pointing me the way of SEE).

Barto
2006-02-03, 11:29
SubEthaEdit and BBEdit are apples and oranges. It's like comparing iPhoto with Photoshop. Of course, most people only need iPhoto and likewise most people only need SubEthaEdit.

I've heard good things about TextMate but I haven't used it and it costs money.

autodata
2006-02-03, 11:37
I'm not sure that there is a good cocoa IDE for python. Some time ago (early last year) when I was using python a bit I looked around for one and only found PyOXIDE, which was buggy and clumsy, but it was certainly on the right track. I certainly didn't find anything along the lines of PythonWin. There's also macpython (http://homepages.cwi.nl/~jack/macpython/), but last I checked it was carbon and kind of sucked (IMO, of course. YMMV). I just went back to using command line tools. Supposedly you should be able to use eclipse (http://www-128.ibm.com/developerworks/opensource/library/os-ecant/), but for some reason that I don't remember I didn't like it.

If anyone has any more info it would be much appreciated.

Anyway, pythonmac.org (http://pythonmac.org/) has some resources.

Oskar
2006-02-04, 16:23
Thanks for the recommendations - I think I'll try SubEthaEdit first. The UI and collaborative coding both are looking great.

Anyone else interested in python IDEs for mac might consult the following...
http://ask.slashdot.org/article.pl?sid=05/12/29/0137252