[IronPython] Problems with hashlib and threading

Brian Merrell brian at merrells.org
Sat Dec 20 22:56:44 CET 2008


I get the following error periodically:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "C:\Program Files\IronPython 2.0\Lib\threading.py", line 486, in
_Thread__bootstrap_inner
    self.run()
  File "initial_ingest.py", line 33, in run
    md5 = hashlib.md5(contents).hexdigest()
SystemError: Hash not valid for use in specified state.

I am not sharing a md5() object between threads and have tried to avoid any
shared memory issues:


class Convert(threading.Thread):
    def __init__(self, queue):
        threading.Thread.__init__(self)
        self.queue = queue
    def run(self):
        import hashlib
        while True:
            abs_filename = self.queue.get()
            f = open(abs_filename, "rb")
            contents = f.read()
            f.close()
            md5 = hashlib.md5(contents).hexdigest()
            print md5, abs_filename
            self.queue.task_done()

Any ideas why this is failing?  Thanks,

-brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081220/2baa0c33/attachment.html>


More information about the Ironpython-users mailing list