Hello there,
when trying to add a user in the empty user table via appadmin, I get this
error: *'module' object has no attribute 'pbkdf2_hmac'*
Seems to be related to password encryption?
Function argument list
(data='!xb2qwtze', salt='b2dfc4f426ee1bbd', iterations=1000, keylen=20,
hashfunc=<built-in function openssl_sha512>)
Code listing
2781.
2782.
2783.
2784.
2785.
2786.
2787.
2788.
2789.
2790.
return v
def pbkdf2_hex(data, salt, iterations=1000, keylen=24, hashfunc=None):
hashfunc = hashfunc or sha1
hmac = hashlib.pbkdf2_hmac(hashfunc().name, to_bytes(data),
to_bytes(salt), iterations, keylen)
return binascii.hexlify(hmac)
Variables
global hmac <module 'hmac' from '/usr/lib/python2.7/hmac.pyc'>
salt 'b2dfc4f426ee1bbd'
data '!xb2qwtze'
hashlib.pbkdf2_hmac undefined
).name undefined
global hashlib <module 'hashlib' from '/usr/lib/python2.7/hashlib.pyc'>
iterations 1000
global to_bytes <function to_bytes>
hashfunc <built-in function openssl_sha512>
keylen 20
<type 'exceptions.AttributeError'> 'module' object has no attribute
'pbkdf2_hmac'Version
web2py™ Version 2.18.4-stable+timestamp.2019.03.13.05.27.54
Python Python 2.7.6: /usr/local/bin/uwsgi (prefix: /usr)Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
Traceback (most recent call last):
File "/home/rexwuff/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/home/rexwuff/web2py/applications/babsi/controllers/appadmin.py"
<https://rexwuff.pythonanywhere.com/admin/edit/babsi/controllers/appadmin.py>,
line 674, in <module>
File "/home/rexwuff/web2py/gluon/globals.py", line 421, in <lambda>
self._caller = lambda f: f()
File "/home/rexwuff/web2py/applications/babsi/controllers/appadmin.py"
<https://rexwuff.pythonanywhere.com/admin/edit/babsi/controllers/appadmin.py>,
line 154, in insert
if form.accepts(request.vars, session):
File "/home/rexwuff/web2py/gluon/sqlhtml.py", line 1962, in accepts
self.vars.id = self.table.insert(**fields)
File "/home/rexwuff/web2py/gluon/packages/dal/pydal/objects.py", line 754, in
insert
ret = self._db._adapter.insert(self, row.op_values())
File "/home/rexwuff/web2py/gluon/packages/dal/pydal/adapters/base.py", line
480, in insert
query = self._insert(table, fields)
File "/home/rexwuff/web2py/gluon/packages/dal/pydal/adapters/base.py", line
476, in _insert
','.join(self.expand(v, f.type) for f, v in fields))
File "/home/rexwuff/web2py/gluon/packages/dal/pydal/adapters/base.py", line
476, in <genexpr>
','.join(self.expand(v, f.type) for f, v in fields))
File "/home/rexwuff/web2py/gluon/packages/dal/pydal/adapters/base.py", line
445, in _expand
rv = self.represent(expression, field_type)
File "/home/rexwuff/web2py/gluon/packages/dal/pydal/adapters/base.py", line
382, in represent
return super(SQLAdapter, self).represent(obj, field_type)
File "/home/rexwuff/web2py/gluon/packages/dal/pydal/adapters/base.py", line
336, in represent
return self.representer.represent(obj, field_type)
File
"/home/rexwuff/web2py/gluon/packages/dal/pydal/representers/__init__.py", line
251, in represent
rv = self.get_representer_for_type(field_type)(rv, field_type)
File
"/home/rexwuff/web2py/gluon/packages/dal/pydal/representers/__init__.py", line
209, in _default
return self.adapt(value)
File
"/home/rexwuff/web2py/gluon/packages/dal/pydal/representers/__init__.py", line
227, in adapt
value = str(value)
File "/home/rexwuff/web2py/gluon/packages/dal/pydal/validators.py", line
2880, in __str__
hashed = simple_hash(self.password, key, salt, digest_alg)
File "/home/rexwuff/web2py/gluon/packages/dal/pydal/validators.py", line
2803, in simple_hash
int(keylen), get_digest(alg)))
File "/home/rexwuff/web2py/gluon/packages/dal/pydal/validators.py", line
2786, in pbkdf2_hex
hmac = hashlib.pbkdf2_hmac(hashfunc().name, to_bytes(data),
AttributeError: 'module' object has no attribute 'pbkdf2_hmac'
Thanks for your help,
Stephan
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.