From 545a5a75fb6a798310b7849bac68cfa0a7a21d89 Mon Sep 17 00:00:00 2001 From: glubsy Date: Fri, 13 Aug 2021 20:56:33 +0200 Subject: [PATCH] Fix for older python versions The "walrus" operator is only available in python 3.8 and later. Fall back to more traditional notation. --- core/fs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/fs.py b/core/fs.py index 3435aba9..9fc89cfb 100644 --- a/core/fs.py +++ b/core/fs.py @@ -138,8 +138,13 @@ class File: try: with self.path.open("rb") as fp: md5 = hashlib.md5() - while filedata := fp.read(CHUNK_SIZE): + filedata = fp.read(CHUNK_SIZE) + while filedata: md5.update(filedata) + filedata = fp.read(CHUNK_SIZE) + # FIXME For python 3.8 and later + # while filedata := fp.read(CHUNK_SIZE): + # md5.update(filedata) self.md5 = md5.digest() except Exception: pass