Commit 498d3487 authored by Sander Bollen's avatar Sander Bollen
Browse files

hashes must be encoded in python3

parent 02cddf6c
...@@ -5,6 +5,7 @@ __author__ = 'ahbbollen' ...@@ -5,6 +5,7 @@ __author__ = 'ahbbollen'
from datetime import datetime from datetime import datetime
import hashlib import hashlib
import sys
import vcf import vcf
...@@ -54,7 +55,12 @@ class NoPrimersException(Exception): ...@@ -54,7 +55,12 @@ class NoPrimersException(Exception):
def datehash(): def datehash():
a = datetime.utcnow() a = datetime.utcnow()
st = "{:f}".format((a-datetime(1970, 1, 1)).total_seconds()) st = "{:f}".format((a-datetime(1970, 1, 1)).total_seconds())
hash = hashlib.md5(st).hexdigest() if sys.version_info[0] == 2:
hash = hashlib.md5(st).hexdigest()
elif sys.version_info[0] == 3:
hash = hashlib.md5(st.encode("utf-8")).hexdigest()
else:
raise NotImplementedError
return hash[:5] return hash[:5]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment