Did you just do your weekly or monthly brew update && brew upgrade commands and now you're getting Python ImportErrors (something like: ImportError: cannot import name MAXREPEAT)?

You're not alone, it's frustrating, and it breaks Vim and pretty much everything that uses Python.

Unfortunately Python 2.7.4 introduced some breaking changes. No worries though, I wasted time looking for the answers on how to fix it, so, let's do this.

UPDATE (5/29/2013):

I can happily say that it is safe to upgrade to 2.7.5. I'd say that YMMV because of the chatter going on over here on the homebrew github issues page, but I've had success with the upgrade thus far. (Weechat and Vim both have behaved as they should).

UPDATE (5/3/2013):

So it turns out that the maintainer of the Python 2.x formulae is on it and has a fix in the pipeline. Will update this post again once an update to this formulae is final and readily available via brew. I've gone ahead and changed the steps below to just apply the patched version of 2.7.4.

First:

brew unlink python
brew remove python
brew unlink vim
brew remove -force vim

Second:

cd `brew --prefix` #should put you in /usr/local
git checkout 70e9252bd1c17a874631e030ad009b510cd72d54 Library/Formula/python.rb
brew install python #it will install a patched version of 2.7.4

Third:

brew install -v -force vim

Forth (for good measure):

brew doctor

That should do the trick. This got everything running again real nice like.

Big up to the following:

Hope this helps others that don't want to waste time troubleshooting this detremental issue.

I have 10+ years of web-focused software development experience spreading the "full-stack" gamut with php, asp.net/c#, and ruby/rails. My passion and expertise lies with front-end development whether it be design work or JavaScript development. I've worked on a wide range of projects, ranging from enterprise level products for the healthcare or document imaging space all the way down to your typical CMS-based website. I enjoy tinkering with the latest and greatest JS framework or CSS architecture. When I'm not coding, I'm making things, or spending time outdoors backpacking, running or hiking. I also have an awesome shepherd mix named Kona (hover over my picture above to witness his super-saiyan level of awesome).