dcwatson / django-pgcrypto

Python and Django utilities for encrypted fields using pgcrypto.
BSD 2-Clause "Simplified" License
67 stars 22 forks source link

ValueError: level must be >= 0 #10

Closed mpwoodward closed 9 years ago

mpwoodward commented 9 years ago

I'm new to pgcrypto so forgive me if this isn't an issue per se (it's entirely possible and highly likely I'm missing a piece of the configuration puzzle), but I didn't see another appropriate place to discuss what I'm running into.

I'm using python 3.4 and postgres 9.3.5 on Ubuntu and on the postgres side anyway everything seems to be functioning, meaning CREATE EXTENSION worked and I can verify version 1.0 is installed, and manual queries in psql doing some crypt stuff work fine.

When I try to do anything from Django I get the following error: File "/vagrant/foo/security/models.py", line 9, in Bar bar = pgcrypto.EncryptedTextField() File "/usr/local/lib/python3.4/dist-packages/pgcrypto.py", line 168, in init mod = import('Crypto.Cipher', globals(), locals(), [cipher_name], -1) ValueError: level must be >= 0

I've tried both using models as well as just going into a shell and creating instances of the encrypted field types and always get that same last two lines in the error message.

Any guidance would be greatly appreciated. Thanks.

dcwatson commented 9 years ago

This has been fixed since ea7098fd279791ffd6baff2ec2776a62f405192c - which version of pgcrypto are you using? Can you try the latest master? I'll push out 1.2.1 in the near future.