Python Forum
Help with script error - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Help with script error (/thread-3605.html)

Pages: 1 2


RE: Help with script error - mason28 - Jun-07-2017

Just thought I would post the fix here:

from string import join
from array import array
import sha, base64i
from time import time

# This fix https://mail.python.org/pipermail/python-list/2010-January/563791.html
# Place the 6 lines of code below after the imports then replace every occurrence of "L" with unit32 in the py3 code
for typecode in 'IL':
     if len(array(typecode, [0]).tostring()) == 4:
          uint32 = typecode
          break
     else:
         raise RuntimeError("Neither 'I' nor 'L' are unsigned 32-bit integers.")

class CryptError(Exception): pass
def _hash(str): return sha.new(str).digest()

# rest of py3 code