ImportError: No module named _ssl

I recently ran into two issues when developing a Google Glass Application using the Twitter API. The first was my application kept throwing an exception “ImportError: No module named _ssl.” So when I ran my application I would see something like this in my logs:

"Traceback (most recent call last):

  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 239, in Handle

    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())

  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 298, in _LoadHandler

    handler, path, err = LoadObject(self._handler)

  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 84, in LoadObject

    obj = __import__(path[0])

  File "/base/data/home/apps/s~goatdar/1.376771216666973013/main.py", line 28, in <module>

    from main_handler import MAIN_ROUTES

  File "/base/data/home/apps/s~goatdar/1.376771216666973013/main_handler.py", line 27, in <module>

    import goatcollector

  File "/base/data/home/apps/s~goatdar/1.376771216666973013/goatcollector.py", line 4, in <module>

    import twitter

  File "/base/data/home/apps/s~goatdar/1.376771216666973013/twitter/__init__.py", line 16, in <module>

    from .stream import TwitterStream

  File "/base/data/home/apps/s~goatdar/1.376771216666973013/twitter/stream.py", line 11, in <module>

    from ssl import SSLError

  File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/ssl.py", line 67, in <module>

    import _ssl             # if we can't import it, let the error propagate

ImportError: No module named _ssl"

 

This actually seems to be a known bug (Issue 9246) in Google App Engine and was appearing on both my local environment and the Google Cloud. The work around was simple enough and is described in part here although all I had to do was add the value “_ssl” to the dictionary _WHITE_LIST_C_MODULES in /path-to-gae-sdk/google/appengine/tools/devappserver2/python/sandbox.py. Your results may vary.

I then ran into another issue where my Glass Application start throwing a 401 or “

About ordo tacitus

ordo tacitus
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s