Operating System - HP-UX
1745920 Members
4437 Online
108723 Solutions
New Discussion юеВ

problem with hashlib in python

 
Marian Hromiak
New Member

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?
2 REPLIES 2
dirk dierickx
Honored Contributor

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
Peter Kolenic
New Member

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