google-code-export / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

ImportError: No module named Crypto.PublicKey in python27 #575

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Define python script to import RSA like this:
from gdata.Crypto.PublicKey import RSA
2. Run it in Python2.7 environment
3. It shows error like:
Traceback (most recent call last):
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 168, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 206, in _LoadHandler
    handler = __import__(path[0])
  File "/base/data/home/apps/s~example/1.354423270525910662/domain.py", line 20, in <module>
    import sateraito_func
  File "/base/data/home/apps/s~example/1.354423270525910662/sateraito_func.py", line 10, in <module>
    from gdata.Crypto.PublicKey import RSA
  File "/base/data/home/apps/s~example/1.354423270525910662/gdata/Crypto/PublicKey/RSA.py", line 15, in <module>
    from Crypto.PublicKey import pubkey
ImportError: No module named Crypto.PublicKey

What is the expected output? What do you see instead?

RSA module can't import in python27 environment, it should able to be imported 
as in python25 environment.

What version of the product are you using?

Version 2.0.15

Please provide any additional information below.

In my environment I changed the code in gdata/Crypto/PublicKey/RSA.py

from Crypto.PublicKey import pubkey
from Crypto.Util import number

to:

from gdata.Crypto.PublicKey import pubkey
from gdata.Crypto.Util import number

and the code in gdata/Crypto/PublicKey/pubkey.py

from Crypto.Util.number import *

to:

from gdata.Crypto.Util.number import *

It looks OK by this change.

Original issue reported on code.google.com by akitoshi...@gmail.com on 17 Dec 2011 at 2:16

GoogleCodeExporter commented 9 years ago
Thanks for reporting this, can you check please on your 2.7 install:

import Crypto
print Crypto.__file__

I need to see if there is another version of that package somewhere. Thanks.

Original comment by afs...@google.com on 17 Dec 2011 at 4:48

GoogleCodeExporter commented 9 years ago
Oh sorry, it is my mistake!
The environment is Google App Engine for Python 2.7. On GAE/Python27 when 
developer want to use PyCrypt, he must declare in app.yaml like that:

libraries:
- name: pycrypto
  version: latest

I didn't declared above. It is root cause of this error.

On GAE/Python2.5, no such declaration is needed.

- Third-party Python Libraries in Python 2.5(Google App Engine document)
http://code.google.com/intl/en/appengine/docs/python/tools/libraries.html

- Third-party Libraries in Python 2.7(Google App Engine document)
http://code.google.com/intl/en/appengine/docs/python/tools/libraries27.html

Gdata-python-client have no wrong point, this issue should be closed.
Thank you for your kind advice!

Original comment by akitoshi...@gmail.com on 18 Dec 2011 at 1:03

GoogleCodeExporter commented 9 years ago
Thanks for the update. Closing. 

Original comment by afs...@google.com on 18 Dec 2011 at 4:56