0

Perhaps this question is so simple, no one needs to ask it, or perhaps I am doing a poor job searching.

I would like to know how to write a simple Hello World program in python using XCode.

I see all over the place info about PyObjC, but I am not yet prepared for that.

Can someone point me to a tutorial or provide the relevant instructions?

I am using XCode 3.2.6 on Mac OS X 10.6.8.

Maybe once I can get Hello World working, I can begin thinking about creating an interface.

5
  • possible duplicate of Pure Python in Xcode? Commented Apr 12, 2012 at 7:21
  • and related: Pure Python in Xcode and Python in Xcode 4 Commented Apr 12, 2012 at 7:22
  • Granted I can just write python in any text editor, I would like to first be able to write simple scripts in XCode as a prelude to writing more complex applications with a GUI. Those other posts dismiss the original question. Can the question not be simply answered without proselytizing for another tool? Commented Apr 12, 2012 at 17:19
  • Read them more closely. The question without the question mark in the title includes a step-by-step walkthrough of their use of Python with XCode, and a link to a tutorial on the subject. Even if they're not helpful, the solution isn't to post a duplicate question -- but to edit (or suggest an edit) to the existing questions, or offer a bounty, to attract more attention. Commented Apr 12, 2012 at 19:06
  • I again read over that second link, and the tutorial it refers, and followed both of them to a tee as best as possible and it still fail. It was that frustration that originally led me to post this question. The problem may be that I can't follow this: From 'Pure Python' I selected 'Python tool', named it main.py then clicked finish. For me, there is no 'Python tool' in my XCode. Commented Apr 14, 2012 at 15:44

1 Answer 1

1

There are a couple options. If you want to write just pure python you can do that in any text editor.

If you want to convert a python script to an app there is py2app. With Xcode 3 there is an app that does this in /Developer/Applications. I don't have Xcode 3 anymore so I can't give the specifics of where exactly this app is but It's somewhere under /Developer :)

If you want to build an mac app with python you'll need to use PyObjC to interact with the necessary NSObjects. Here is an old app I built with PyObjC that you might find useful: RockStar.

Sign up to request clarification or add additional context in comments.

3 Comments

That py2app is quite interesting. I don't see it in my copy of XCode 3. Maybe it is XCode 4? I do see the Build Applet application in /Developer/Applications/Utilities/Python2.6 but it fails to let me select a simple hello_world.py script.
Oh and by the way, that RockStar app is really cool. That's something I would love to be able to do.
I'm on a machine now with Xcode3 and yes /Developer/Applications/Utilities/Python 2.6/Build Applet.app is the app I was talking about. The way I've always used it is by dragging a python script onto the icon, give that a try. RockStar was a fun learning experience, it's a now a native app: itunes.apple.com/us/app/rockstar/id412379768?mt=12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.