iron-io/iron_core_python

App Engine: ImportError: No module named pwd

Opened this issue · 6 comments

Error when running on App Engine Python 1.7

File "/base/data/home/apps/s~-tools-hrd/2.360644688465653543/iron_mq.py", line 22, in init
version=IronMQ.VERSION, product="iron_mq", **kwargs)
File "/base/data/home/apps/s~-tools-hrd/2.360644688465653543/iron_core.py", line 63, in init
os.path.expanduser("~/.iron.json"), product)
File "/base/python27_runtime/python27_dist/lib/python2.7/posixpath.py", line 259, in expanduser
import pwd
ImportError: No module named pwd

pwd module is not available on App Engine VM.

It works just fine on the local App Engine dev env. I guess it is a App Engine problem, but maybe you can solve this so other developers do not have to bother.

Ah, darn. I'll look into figuring out how to fix this.

Here is a temporary fix. You can comment out the following lines:

https://github.com/iron-io/iron_core_python/blob/master/iron_core.py#L122-L123

Wow...didn't realize how old this issue was...

Interesting. Can you use env vars on app engine? If so, we don't need to load the iron.json at all.

You can - but as is you can store the iron.json file in the project root. This is uploaded to google app engine (GAE) but is only accessible to the server. The issue is that the os module is being used. GAE uses a modified version of python that removes a certain functions within some of the modules (e.g. os, sys).

I would suggest using a try except block there ...

This is addressed in #26