problem with hashlib in python (246 Views)
Reply
Occasional Visitor
Marian Hromiak
Posts: 1
Registered: ‎04-02-2009
Message 1 of 3 (246 Views)

problem with hashlib in python

Hello,

I have problem with import hashlib in python. I found this:
$ python
Python 2.5.1 (r251:54863, Nov 7 2007, 22:40:57) [C] on hp-ux11
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.5/hashlib.py", line 133, in
md5 = __get_builtin_constructor('md5')
File "/usr/local/lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
import _md5
ImportError: No module named _md5


After this I tried import _hashlib, and I've got this output:
>>> import _hashlib
Traceback (most recent call last):
File "", line 1, in
ImportError: Unsatisfied code symbol 'EVP_MD_CTX_md' in load module '/usr/local/lib/python2.5/lib-dynload/_hashlib.so'.

Any idea?
Honored Contributor
dirk dierickx
Posts: 958
Registered: ‎12-20-1999
Message 2 of 3 (246 Views)

Re: problem with hashlib in python

were did this python version come from? seems like it can't import md5, try to 'import md5'.

could also be that some environments are not set so python is not finding all your modules.

all vars are listed here:
http://docs.python.org/using/cmdline.html#environment-variables
Occasional Visitor
Peter Kolenic
Posts: 1
Registered: ‎04-07-2009
Message 3 of 3 (246 Views)

Re: problem with hashlib in python

Hello,

(i'm coworker of Marian)
thank You for Your answer Dirk, but trying to set PYTHONHOME did not help - i investigated further, and found that
EVP_MD_CTX_md is just macro defined in /usr/include/openssl/evp.h
and in our _haslib.so is:
$ objdump -T /usr/local/lib/python2.5/lib-dynload/_hashlib.so | grep EVP_MD_CTX_md
0421b600 DF *UND* 00000000 EVP_MD_CTX_md

(and i checked (for being sure) EVP_MD_CTX_md is not defined in any of libcrypto.so*, libssl.so* on our system)

so maybe different versions of openssl was used to build python
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.