hashlib suddenly broken

Larry Martell larry.martell at gmail.com
Thu Sep 18 23:30:22 CEST 2014

On Thu, Sep 18, 2014 at 2:21 PM, John Gordon <gordon at panix.com> wrote:
> In <mailman.14119.1411067922.18130.python-list at python.org> Larry Martell <larry.martell at gmail.com> writes:
>> It's failing on the 'import _sha' in hashlib.py:
>>  66   def __get_builtin_constructor(name):
>>  67        try:
>>  68          if name in ('SHA1', 'sha1'):
>>  69   ->        import _sha
>>  70              return _sha.new
>> (Pdb) s
>> ImportError: 'No module named _sha'
> This appears to differ from the error you originally reported:
>>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py",
>> line 91, in __get_builtin_constructor
>>     raise ValueError('unsupported hash type %s' % name)
>> ValueError: unsupported hash type sha1

It's the lower level error that triggers the initial error I reported.
The ImportError is caught and the ValueError is reported.

> Could there be two different versions of hashlib.py on your system?

No, I checked and there is only the ones for the various python
versions. And none that were recently installed or modified. And you
can see the full path reported by python is the expected one.

More information about the Python-list mailing list