Tuesday, October 13, 2009

Google App Engine File Permission Oddity

I'm posting this in the hope that it may help any poor souls who are struggling with a Python Google App Engine application at the moment. Google App Engine is a web application framework created by Google that allows developers to write Java or Python web based apps and host them on Google infrastructure. I'm working on a project using GAE and ran in to the situation that my application worked perfectly in my local development environment, but running hosted would return a blank page with no error message. Unfortunately there was also nothing in the logs, nor did any of the postings that turned up in my searches seem to help. At any rate, the problem breaks down to two issues:

1. Python scripts must be executable

That is the UNIX executable permission bit needs to be set for the Python script to run. I can't find anywhere in the docs that states this, but it seems to be the case. So Linux or Mac users, make sure you chmod +x your scripts before deploying.

2. Deploying a script with different permissions doesn't change the on server permissions

I ended up having to rename my script file because the permission change wasn't taking effect on the server. Changing the app version made no difference.

Other than the head-meets-desk struggle that the problem described above induced, learning to use Google App Engine has been a thoroughly pleasurable experience, and I look forward to using GAE in ongoing and future projects.


Amey said...

What about us poor Windows users?

Tal said...

I'm not entirely sure if this issue would even happen in a Windows development environment as the permissions structure is quite different.

Are you having this particular problem?

Amey said...

Yep, I was. And a weird solution worked. I renamed to script from site.py to site2.py, and changed the url handler accordingly, and it worked. So I guess it's probably some bug somewhere