Brian M. Hunt
Brian M. Hunt

Reputation: 83858

import pycrypto in dev_appserver.py on Google App Engine gives IOError

I am trying to test a Google App Engine app with dev_appserver.py, but when I run import Crypto I get the following excerpted from the IOError (i.e. No access) traceback:

...
import Crypto
...
File "/System/Library/Frameworks/Python.framework/Versions
      /2.7/lib/python2.7/zipfile.py", line 867, in read
    return self.open(name, "r", pwd).read()
  File "/System/Library/Frameworks/Python.framework/Versions
        /2.7/lib/python2.7/zipfile.py", line 882, in open
    zef_file = open(self.filename, 'rb')
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
       GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google
       /appengine/tools/dev_appserver_import_hook.py", line 592, in __init__
    raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages
                                    /pycrypto-2.3-py2.7-macosx-10.7-intel.egg'

I am on Mac OS X 10.7, with Google App Engine 1.6.6 using Python 2.7.

Since PyCrypto is supported on Google App Engine, I would expect it to work on the development server.

I am aware that dev_appserver.py prevents loading external files. However, I noted that appengine/tools/dev_appserver_import_hook.py seems to have all the requisite files in the whitelist (e.g._fastmath).

Note, in app.yaml I have

libraries: 
- name: pycrypto
  version: latest

It seems as though I am missing something obvious but crucial. Any thoughts would be appreciated.


EDIT For more details see: https://code.google.com/p/googleappengine/issues/detail?id=12129

Upvotes: 4

Views: 1374

Answers (2)

neaGaze
neaGaze

Reputation: 1461

The best way to get through this is create a virtual environment and install the pycrypto inside that. The reason your libraries inside app.yaml is not detected is most probably because you have multiple versions of python installed in your machine and the version you used to run the program might not be the same version where you installed the libraries

Upvotes: 0

Chris
Chris

Reputation: 1162

Yes, you have to install the third-party library yourself. Google explains exactly which versions the provide on their platform, so this should not be any problem.

Upvotes: 1

Related Questions