ERROR:root:code for hash md5 was not found

mike mikaelpetterson1 at gmail.com
Thu Jan 12 02:25:09 EST 2012


On Jan 12, 7:13 am, mike <mikaelpetters... at gmail.com> wrote:
> On Jan 12, 12:28 am, Steven D'Aprano <steve
>
>
>
>
>
>
>
>
>
> +comp.lang.pyt... at pearwood.info> wrote:
> > On Wed, 11 Jan 2012 05:54:29 -0800, mike wrote:
> > > I did some more digging and found that our class imports a "yacc.py"
> > > that uses
>
> > > import re, types, sys, cStringIO, hashlib, os.path
>
> > > so it has hashlib.
>
> > > yacc.py seems to be an old version 1.3 ( I found 2.3 -->).
>
> > > Reading about hashlib it seems to be dependent on os installation of
> > > OpenSSL but I cannot find out how.
>
> > It shouldn't be. It will use OpenSSL if available, otherwise it will fall
> > back on its own code.
>
> > > br,
>
> > > //mike
>
> > > yacc.py
> > > ===============
>
> > #-----------------------------------------------------------------------------> # ply: yacc.py
>
> > [snip over TWO THOUSAND lines of code]
>
> > Mike, what lead you to believe that an error in hashlib could be solved
> > by posting the ENTIRE two thousand lines of yacc.py? Please do not post
> > such huge chunks of code unless asked. It is unnecessary and annoying.
>
> > Try this. Open a terminal window and enter "python" at the prompt to
> > start a clean interactive session. Then enter the following commands:
>
> > import sys
> > print(sys.version)
> > import hashlib
> > print(hashlib.__file__)
> > print(hashlib.md5)
> > import _md5
> > print(_md5.__file__)
>
> > and copy and paste (do not retype) the full output of these commands.
>
> > Thank you.
>
> > --
> > Steven
>
> Hi,
>
> Sorry for posting huge file. I added your copy-paste snippet.
>
> esekilx5030 [7:09am] [roamFroBl/pysibelius/bin] -> python
> Python 2.7.2 (default, Jun 16 2011, 15:05:49)
> [GCC 4.5.0] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>> import sys
>
> print(sys.version)
> import hashlib
> print(hashlib.__file__)
> print(hashlib.md5)
> import _md5
> print(_md5.__file__) >>> 2.7.2 (default, Jun 16 2011, 15:05:49)
> [GCC 4.5.0]>>> ERROR:root:code for hash md5 was not found.
>
> Traceback (most recent call last):
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 139, in <module>
>     globals()[__func_name] = __get_hash(__func_name)
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 91, in __get_builtin_constructor
>     raise ValueError('unsupported hash type %s' % name)
> ValueError: unsupported hash type md5
> ERROR:root:code for hash sha1 was not found.
> Traceback (most recent call last):
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 139, in <module>
>     globals()[__func_name] = __get_hash(__func_name)
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 91, in __get_builtin_constructor
>     raise ValueError('unsupported hash type %s' % name)
> ValueError: unsupported hash type sha1
> ERROR:root:code for hash sha224 was not found.
> Traceback (most recent call last):
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 139, in <module>
>     globals()[__func_name] = __get_hash(__func_name)
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 91, in __get_builtin_constructor
>     raise ValueError('unsupported hash type %s' % name)
> ValueError: unsupported hash type sha224
> ERROR:root:code for hash sha256 was not found.
> Traceback (most recent call last):
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 139, in <module>
>     globals()[__func_name] = __get_hash(__func_name)
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 91, in __get_builtin_constructor
>     raise ValueError('unsupported hash type %s' % name)
> ValueError: unsupported hash type sha256
> ERROR:root:code for hash sha384 was not found.
> Traceback (most recent call last):
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 139, in <module>
>     globals()[__func_name] = __get_hash(__func_name)
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 91, in __get_builtin_constructor
>     raise ValueError('unsupported hash type %s' % name)
> ValueError: unsupported hash type sha384
> ERROR:root:code for hash sha512 was not found.
> Traceback (most recent call last):
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 139, in <module>
>     globals()[__func_name] = __get_hash(__func_name)
>   File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
> hashlib.py", line 91, in __get_builtin_constructor
>     raise ValueError('unsupported hash type %s' % name)
> ValueError: unsupported hash type sha512>>> /vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/hashlib.pyc
> >>> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
> AttributeError: 'module' object has no attribute 'md5'>>> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
> ImportError: No module named _md5
>
> Thanks for support!
>
> //mike

Hi,

I did some more testing.

The python 2.7.2 lib is stored in a clearcase vob. When I set the env.
and run suggested lines ( with slight modification), on Redhat 5.5,
( by Steven) I get the following:

-> python
Python 2.7.2 (default, Jun 16 2011, 15:05:49)
[GCC 4.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
print(sys.version)
import hashlib
print(hashlib.__file__)
print(hashlib.md5)
import md5
print(md5.__file__)>>> 2.7.2 (default, Jun 16 2011, 15:05:49)
[GCC 4.5.0]
>>> ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 139, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
hashlib.py", line 91, in __get_builtin_constructor
    raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type sha512
>>> /vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/hashlib.pyc
>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'md5'
>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/
md5.py", line 10, in <module>
    from hashlib import md5
ImportError: cannot import name md5

But when I execute the same lines on a Suse 10.4 I get the following
output:

python
Python 2.7.2 (default, Jun 16 2011, 15:05:49)
[GCC 4.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.version)
2.7.2 (default, Jun 16 2011, 15:05:49)
[GCC 4.5.0]
>>> import hashlib
>>> print(hashlib.__file__)
/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/hashlib.pyc
>>> print(hashlib.md5)
<built-in function openssl_md5>
>>> import md5
>>> print(md5.__file__)
/vobs/rnc/rrt/roam1/roamSs/roamFroBl/python/lib/python2.7/md5.pyc

That looks correct to me.

It really confuses me!?

br,

//mike

Ps. Thanks for all the replies.






More information about the Python-list mailing list