2
votes

I'm new to the world of Google App Engine so bear with me here.

In trying to setup a hello-world Python project for GAE locally, I get a bunch of errors about how GAE doesn't support python 2.7.

How do I configure the GAE locally to make it to point to my custom python 2.5 installation, which is located at /usr/local/python-2.5 instead of the default system? (2.7 with Lion)

My system configuration:

OS: Mac OS 10.7
GoogleAppEngineLauncher: 1.5.2

The errors I'm seeing in my console when I try to run the app:

*** Running dev_appserver with the following flags:
    --admin_console_server= --port=8080
Python command: /usr/bin/python2.6
Warning: You are using a Python runtime (2.6) that is more recent than the production runtime environment (2.5). Your application may use features that are not available in the production environment and may not work correctly when deployed to production.
WARNING  2011-08-02 23:53:51,987 datastore_file_stub.py:511] Could not read datastore data from /var/folders/08/jlb1tb7s3hq1jhh9qzxfpqbw0000gn/T/dev_appserver.datastore
INFO     2011-08-02 23:53:51,989 rdbms_sqlite.py:58] Connecting to SQLite database '' with file '/var/folders/08/jlb1tb7s3hq1jhh9qzxfpqbw0000gn/T/dev_appserver.rdbms'
WARNING  2011-08-02 23:53:51,995 dev_appserver.py:4749] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO     2011-08-02 23:53:52,052 dev_appserver_multiprocess.py:637] Running application helloworld on port 8080: http://localhost:8080
INFO     2011-08-02 23:54:15,229 dev_appserver_main.py:667] Server interrupted by user, terminating
2
Why do you need a custom Python 2.5? Apple also includes a Python 2.5 for Lion: /usr/bin/python2.5Ned Deily
I have had absolutely no problem with GAE and Python 2.7, and they are going to officially support it "soon". Are you sure it doesn't work despite the warnings, so long as you only use Python 2.5 features?agf
Well I guess I thought that seeing the errors in the console is a bad thing and I was trying to stick to the same python version that GAE uses in the wild.Dan Holman

2 Answers

2
votes

The easiest way I found to use GAE SDK and python 2.7 is to install Mac port ( http://www.macports.org/ ) and from there install python 2.7.

Once macport installed:

$ sudo port install python27  # To install python 2.7

Then from Googleappenginelauncher menu, open Preferences and put /opt/local/bin/python2.7 in the Python path field.

To install PIL or lxml for example just type these commands in a shell:

# For PIL
$ sudo port install py27-pil

# For Lxml
$ sudo port install py27-lxml
1
votes

In the launcher, click on GoogleAppEngineLauncher -> Preferences, and fill in the path to your Python binary in the field labelled 'Python Path'.