My Macbook has been upgraded through several versions of Mac OS X and the account has migrated over 2 machines. This has led to multiple versions of Python being installed on the system. I never noticed until I tried to use Mercurial and it fell over complaining about the versions of Python things.

Looking in the folder /Library/Python shows that I’ve got 4 different versions installed, 2.3, 2.5, 2.6 and 2.7. Running Python from the command line launches version 2.5. The fix, courtesy of this stack exchange, is to run the following in terminal:-

defaults write Version 2.6

There’s a bit more information in the linked answer if the above doesn’t help. It did the trick for me though, so happy days!