Closed jakubgs closed 5 years ago
It's possible that the archive you're trying to load is too large and the tool fails trying to load and render everything in memory. Something like #73 might help with if it gets implemented.
I didn't have the time to fully test this, but the following patch fixed things for me:
diff --git a/slackviewer/archive.py b/slackviewer/archive.py
index 39a829e..86d9209 100644
--- a/slackviewer/archive.py
+++ b/slackviewer/archive.py
@@ -23,8 +23,15 @@ def SHA1_file(filepath, extra=""):
:rtype: str
"""
+ h = hashlib.sha1()
with io.open(filepath, 'rb') as f:
- return hashlib.sha1(f.read() + extra).hexdigest()
+ while True:
+ data = f.read(2**20)
+ if not data:
+ break
+ h.update(data)
+ h.update(extra)
+ return h.hexdigest()
def extract_archive(filepath):
Instead of putting the whole archive in memory, it reads it chunk by chunk. If someone wants to make a PR of this, feel free.
Thanks @vweevers! I just merged a variant of this solution. @jakubgs let us know if that helps.
I tried using this but it just sucks up all the memory available and then fails. I don't see how this is usable.