From cdc033f541d1bcaa2bafb68fec39cdac8772184e Mon Sep 17 00:00:00 2001 From: niten Date: Mon, 9 Jan 2023 11:14:25 -0800 Subject: [PATCH] Removed unnecessary `open` --- src/objectifier.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objectifier.py b/src/objectifier.py index 744b1a4..7108354 100644 --- a/src/objectifier.py +++ b/src/objectifier.py @@ -114,10 +114,10 @@ def result_to_dict(res, base_url): def analyze_image(request: Request, image: UploadFile): print("Initiating file receipt, url: " + str(request.url)) base_url = re.sub(r'\/images\/?$', '/analyzed_images/', str(request.url)) - infile = open(incoming_dir / image.filename) + infile = incoming_dir / image.filename file_hash = hashlib.sha256() file_hash.update(image) - with open(infile, "wxb") as f: + with open(infile, "w") as f: chunk = image.read(buffer_size) while chunk: print ("writing " + buffer_size + " bytes")