0

Hey, I'm having a bit of trouble importing m2crypto to google app engine. I think I know the problem but don't know how to fix it. Anyway, here's my directory structure.

mysite/
    app.yaml
    main.py
    urls.py
    ...
    M2Crypto/
        __init.py__ (I think the problem is here)
        EVP.py
        ...
    SWIG/
        (there is no __init.py___ file here)
        _m2crypto.i
        ...

When I do this from M2Crypto import EVP, I get an error message that says <type 'exceptions.ImportError'>: No module named __m2crypto. This error is in the __init.py__ file where it attempts to import __m2crypto on line 22. But there is no __m2crypto file in the M2Crypto directory.

I'm using version 0.21.1 of M2Crypto and only copied M2Crypto and SWIG to my application. I've also tried copying every file in the M2Crypto-0.21.1.tar.gz to my application but that didn't work either. Thanks in advance.

mrmo123
  • 725
  • 1
  • 8
  • 23
  • Have you compiled the source code? It looks like it requires a shared library that must be compiled aside from the python wrapper. – jcollado Jan 12 '12 at 17:11
  • I don't think so, just unzipped M2Crypto-0.21.1.tar.gz and took out the M2Crypto and SWIG directories. I've done this with another package (gdata) and that worked fine. – mrmo123 Jan 12 '12 at 17:16
  • someone just told me in my other question (http://stackoverflow.com/questions/8776385/rsa-encryption-routines-for-google-app-engine-python/8799470#comment11036794_8799470) that m2crypto contains C code and won't work on GAE. thanks for your help though – mrmo123 Jan 12 '12 at 17:21

1 Answers1

3

It appears as though m2crypto has several requirements that aren't going to work well on App Engine. Your application is sandboxed, all of the libraries used must be pure Python.

You don't state what you're actually trying to do, but note that PyCrypto is included with App Engine. You may also want to look into using the URLFetch service.

Robert Kluin
  • 8,282
  • 25
  • 21
  • Thanks for your response. I'm trying to get google app engine to make signed urls for amazon cloudfront. So far, I only know of one tutorial (http://stackoverflow.com/questions/6549787/getting-started-with-secure-aws-cloudfront-streaming-with-python) which does it though M2Crypto. – mrmo123 Jan 12 '12 at 17:39