On 10/11/2012 05:54, ke...@kendy.org wrote:
Hello!

I want to encrypt a file, then decrypt it. I prefer to do it without adding any
packages. I found

http://eli.thegreenplace.net/2010/06/25/aes-encryption-of-files-in-python-with-pycrypto/

which seems like a good approach. How can I get the import to work for python 3?

You install pycrypto on Python 3, which contradicts your stated preference.

Here's what I get:

$ uname -a
Linux laptop 3.2.0-32-generic-pae #51-Ubuntu SMP Wed Sep 26 21:54:23 UTC 2012
i686 i686 i386 GNU/Linux
$ python3.2
Python 3.2.3 (default, Sep 10 2012, 18:17:42)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import os, random, struct
from Crypto.Cipher import AES
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ImportError: No module named Crypto.Cipher
dir()
['__builtins__', '__doc__', '__name__', '__package__', 'os', 'random', 'struct']
import Crypto.Cipher
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ImportError: No module named Crypto.Cipher


Has Crypto.Cipher been renamed in Python 3? Is it supported yet? Python2.7 works
fine.

Somebody (you?) has already installed pycrypto on 2.7.


I saw so many "crypto" packages at http://pypi.python.org/pypi/ that I wouldn't
know where to start. I want something simple. Do you have a suggestion?

$ python2.7
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import os, random, struct
from Crypto.Cipher import AES
dir()
['AES', '__builtins__', '__doc__', '__name__', '__package__', 'os', 'random',
'struct']


$ python2.7
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import Crypto.Cipher
dir()
['Crypto', '__builtins__', '__doc__', '__name__', '__package__']


Thanks so much! I learn a lot from you guys!

You haven't seen my bill yet :)


Ken
ke...@kendy.org


--
Cheers.

Mark Lawrence.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to