Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine 'No module named pwd'

I was able to run my Google App Engine project (I am using Python Flask for developing a web app) well but when I upgraded my system from Ubuntu 12.04 to 14.04. The App Engine Project Became unresponsive on the local system whereas it is working well on the production environment. I also keep my project updated put my source code on github, so I deleted everything and again cloned a new repository of that from my github account. But When I am running the project it is giving me the following error, if anyone encountered this error before please help me out.

I use this command to run my project

$ dev_appserver.py src/

and get this error as output on the terminal

WARNING  2015-02-23 06:13:02,341 simple_search_stub.py:1115] Could not read search indexes from /tmp/appengine.practical-now-720.chitrank/search_indexes
INFO     2015-02-23 06:13:02,347 api_server.py:172] Starting API server at: http://localhost:60268
INFO     2015-02-23 06:13:02,368 dispatcher.py:186] Starting module "default" running at: http://localhost:8080
INFO     2015-02-23 06:13:02,369 admin_server.py:118] Starting admin server at: http://localhost:8000
ERROR    2015-02-23 06:13:05,655 wsgi.py:263] 
Traceback (most recent call last):
  File "/home/chitrank/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/home/chitrank/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/home/chitrank/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/run.py", line 5, in <module>
    import application
  File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/application/__init__.py", line 47, in <module>
    import urls
  File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/application/urls.py", line 10, in <module>
    from application import views
  File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/application/views.py", line 49, in <module>
    import requests
  File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/lib/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/lib/requests/utils.py", line 19, in <module>
    from netrc import netrc, NetrcParseError
  File "/usr/lib/python2.7/netrc.py", line 7, in <module>
    import pwd
  File "/home/chitrank/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 898, in load_module
    raise ImportError('No module named %s' % fullname)
ImportError: No module named pwd
INFO     2015-02-23 06:13:05,710 module.py:718] default: "GET /_ah/warmup HTTP/1.1" 500 -

If anyone resolved this issue please help me out with removing the following problem.

like image 808
Chitrank Dixit Avatar asked Feb 23 '15 06:02

Chitrank Dixit


1 Answers

In google_appengine/google/appengine/tools/devappserver2/python/sandbox.py there is _WHITE_LIST_C_MODULES list, and adding 'pwd' to it worked for me.

Google is actually running things in sandbox. As there is no issues in production environment, older GAE SDK's will support pwd import, but they are about to remove it.

like image 181
Joseph Thomas Avatar answered Oct 23 '22 10:10

Joseph Thomas