Python and OS X Lion

Just a few quick tips that I’ve had to run through and discover today while upgrading to Lion.

Start by installing Xcode 4, which is available via the App Store (for free now). This will fix your missing distutils package (which probably fixes a majority of your issues). You’ll also need to reinstall all global site-packages, such as pip or virtualenvwrapper.

The last one, which was luckily solved for me already, was hitting [Errno 32] Broken pipe on various things. One example was this:

  File "/Users/dcramer/.virtualenvs/disqus/lib/python2.6/site-packages/compress/utils.py", line 145, in filter_js
    return filter_common(js, verbosity, filters=settings.COMPRESS_JS_FILTERS, attr='filter_js', separator='', signal=js_filtered)
  File "/Users/dcramer/.virtualenvs/disqus/lib/python2.6/site-packages/compress/utils.py", line 136, in filter_common
    output = getattr(get_class(f)(verbose=(verbosity >= 2)), attr)(output)
  File "/Users/dcramer/.virtualenvs/disqus/lib/python2.6/site-packages/compress/filters/yui/__init__.py", line 41, in filter_js
    return self.filter_common(js, 'js', JS_ARGUMENTS)
  File "/Users/dcramer/.virtualenvs/disqus/lib/python2.6/site-packages/compress/filters/yui/__init__.py", line 20, in filter_common
    p.stdin.write(content)
TemplateSyntaxError: Caught IOError while rendering: [Errno 32] Broken pipe

It turns out that with Xcode 4 there were some changes to the way (something that I dont care about) is handled. To solve this, add the following to your .profile:

export ARCHFLAGS='-arch i386 -arch x86_64'

If you rely on sshuttle be warned, it doesn’t work currently on OS X Lion.

I’ll update this post if I hit any more issues, but so far everything else seems to be running smoothly.

Read full article at “David Cramer’s Blog”

Leave a comment