title: How does Xcode pick which Python to run?
body: <p>Using the Python templates for Xcode, I have a simple project running on one machine and failing on two others, for different reasons.  The failure I solved is that even though main.m has:</p>
  
  <pre><code>Py_SetProgramName("/usr/bin/python");
  </code></pre>
  
  <p>The actual running Python as seen from main.py with this:</p>
  
  <pre><code>import sys
  print sys.version
  </code></pre>
  
  <p>is different.  And the problem was that this other Python didn't have objc installed.  So the question is:  short of cleaning up my machine, how can I direct Xcode to use the system Python?</p>
  
  <p>Edit:</p>
  
  <p>This is a problem that seems like it is trivial, but it isn't.  It seems so because when I specify Mac OS X 10.5 as the Base SDK, Xcode links against that Python.framework, as I can see by double-clicking the icon in Linked Frameworks in the Xcode project.  </p>
  
  <p>Each Version in Python.framework has a key/value pair in its Info.plist:  CFBundleExecutableName/Python.  Luckily (for the forensics) this Python in the Version 2.5 framework launches 2.6.1!  Yet by printing sys.version (from main.py) or by snooping on the loader (by doing export DYLD_PRINT_LIBRARIES=1), I can see that the PyObjC App actually launches Python 2.5.4.</p>
  
  <p>The line above with Py_SetProgramName.. is irrelevant---it can be commented out and everything works fine.</p>
  
  <p>So what it looks like is that Python.framework controls which Python is launched, it doesn't do this in the way I expected, and it might be controlled through an initialization routine that is opaque, since it's controlled by Apple.  It seems the best way to "control" the situation is to change the Base SDK.</p>