Posted by & filed under Tech.

We run the Rogerthat mobile communication platform on top of Google App Engine. Some time ago we upgraded from Python2.5 to Python2.7, which gives us multi-threading and other useful features.

However, an annoying bug makes it hard to run the Google App Engine development server on Linux or Mac OS X. When starting up the server, you get lots of HTTP error 500, and your logs show errors similar to:

WARNING  2012-12-07 13:04:52,994 py_zipimport.py:139] Can't open zipfile
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg:

IOError: [Errno 13] file not accessible:
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg'

This is due to a bug in the Google App Engine SDK. The fix is:

  • Edit the file <local path to app engine>/google/appengine/tools/dev_appserver_import_hook.py
    • On my system the local path to App Engine is /usr/local/google_appengine
  • Search for py27_optional=False and replace it by py27_optional=True (I had 2 matches)

Your problems should be solved. Every time you update your local App Engine SDK, you will need to redo this patch.

To run the development server with Python 2.7, we use the following script which sets up a high replication datastore, has unbuffered Python output, captures everything in a log file and streams to stdout. You should replace the path to dev_appserver.py with the one on your system:

python2.7 -u /usr/local/google_appengine/dev_appserver.py src/ --address 127.0.0.1 --port 8080 --datastore_path=tmp/datastore --history_path=tmp/datastore_history --high_replication --use_sqlite --skip_sdk_update_check 2>&1 | tee -a tmp/appengine.log

Leave a Reply

Your email address will not be published. Required fields are marked *


six + 8 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>