A messed-up Python installation on my Mac OSX Leopard system has caused me a fair amount of googling with no solution to be found. For no apparent reason, Python’s environment variable $PYTHONPATH got set to ‘/Applications/Dropbox.app/Contents/Resources’, causing havoc in Terminal and preventing IDLE from launching.
Several posts to the Python forum as well as the Apple Developer 101 discussion board got me no further than “Thank Dropbox’s authors for destroying your system and pray you have a backup.” This was evidently not the issue since Dropbox was working fine alongside Python and IDLE on my MacBook (although the fact that Dropbox.app contains a ‘Python.framework’ folder didn’t make figuring it out any easier). Googling about it came up with a fair amount of forum posts by people asking how to “reset” $PYTHONPATH or the sys.path variable to a default state. Replies were not very helpful, especially for UNIX neophytes like myself. Resintalling XCode, Dropbox, Python 2.6 or MacPython didn’t help either.
Luckily, I found a very simple solution that I thought I’d add to Google’s search engine: simply download and install the Mac OSX Combo Update for your version of Leopard (such as 10.5.5). This seems to fix the references to the default 2.5.1 framework that comes with Leopard, make importing modules functional again and, as a positive side effect, lets IDLE run.