Module import error on GAE - No module named pwd

I've played a bit with Google App Engine lately and I must say that the service is really nice.

Anyway, today I ran into a problem that I couldn't pinpoint straight away. I had done some changes to my toy application http://x-libris.appspot.com/ and deployed it as usual as everything worked just fine locally. But in production environment some pages just crashed with Server Error 500.

Error: Server Error
The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this 
error message and the query that caused it.  

Confused about this I first checked the planned downtime but no maintenance work was planned for the day. Checking the application log I found the following error:

<type 'exceptions.ImportError'>: No module named pwd.

I was a bit startled about this first as it worked just fine locally. I tried an earlier deployed version than the current erronenous one and that worked as expected. Checking for newly made changes in the code I soon suspected that the error must arise due to a module that I've made, saved as user.py. This module was imported in all the application scripts that threw the 500 server error in my face. By renaming the module to a less error prone name, in my case userhandlers.py, the application started working again. The most annoying thing is that the script was working locally but not on the GAE.

Lesson learned, don't name your files user.py and import them as user.

// John

Comments

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><pre>
  • Lines and paragraphs break automatically.

More information about formatting options

To combat spam, please enter the code in the image.