I have recently opened a couple of issues on the Google App Engine tracker: 685 about installing PIL on Mac OS X 10.5, which is harder than GAE's docs make it out to be, and 695 about actually getting it to work with the wonderful GoogleAppEngineLauncher (so you can run locally GAE apps that use the images API), which requires some trick. So I just thought it might be useful to somebody else who uses Mac OS 10.5 and GAE if I summarized the necessary steps and workarounds.
GAE docs claim that "Installing PIL on Mac OS X 10.4 and 10.5 can be completed in a few simple steps", but if you just follow the steps they suggest, on 10.5, the PIL installer will refuse to install -- the installer was written for 10.4 and it does not recognize the "stock" Python that comes with the OS for 10.5. As Matt Kangas has posted, before you run the PIL installer, you need to make a symlink:
cd /Library/Frameworks
sudo ln -s /System/Library/Frameworks/Python.framework/ Python.framework
He also suggests placing in your .bashrc
export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/
The latter environment variable (I placed it in .profile) is indeed sufficient to let you use PIL from a Terminal session, including one in which you run dev_appserver.py from the symlink that GAE installation places (if you allow it to) in /usr/local/bin. However...
Once you've done all of this, the GoogleAppEngineLauncher still won't let you use PIL (and, therefore, it will disable the images API in the GAE apps it runs locally), because it doesn't know about your .bashrc or .profile! You need to find another way to extend Python sys.path's appropriately. The simplest way is to make a file named PIL.pth with a single-line content:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
and place that PIL.pth in any of the directories that all Python processes see; in my case, I used /Library/Python/2.5/site-packages/ -- but that directory is not available in a pristine installation of Mac OS X 10.5 so you may have to use some other directory.
This post is (I hope!) only of temporary usefulness, as it will be superseded when the PIL installer is rebuilt to properly support Mac OS X 10.5 (or, if that installer is never rebuilt, this post can still be made obsolete by the tiniest fix to GAE and its docs to close the issues I've mentioned above!), but, in the meantime, HTH!
4 comments:
Yr content is getting cut off on the right side, btw.
Hmm, not in my favorite browser (Safari on MacOSX) but I did just check and can confirm Firefox does truncate code lines (while Safari wraps them around). I imagine some CSS magic might help but I'm not sure what's best (to get wraparound rather than truncation on as many browsers as feasible) -- suggestions?
So according to http://bytes.com/groups/css/541236-firefox-does-not-word-wrap there is no solution for this issue in Firefox; Safari, Chrome and IE 7 all appear to properly break-and-wrap any code line that is too long to fit on a single display line, but it seems there's no way to make Firefox play ball. Ah well -- suggestions still welcome but I'm not going to hold my breath waiting for them, and until any useful suggestion may come, the blog will stay as-is.
Thanks for the path tip. Solved my issue with GAE. PIL was working well with other python projects when using just shell...
Post a Comment