From 3bd8fe639235284c4200f1f87211f510a1b2e583 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Tue, 10 Dec 2019 12:48:28 -0800 Subject: [PATCH] Raise FileNotFound from read_filebytes. --- etiquette/helpers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etiquette/helpers.py b/etiquette/helpers.py index 79e5f81..ffcf247 100644 --- a/etiquette/helpers.py +++ b/etiquette/helpers.py @@ -324,6 +324,8 @@ def read_filebytes(filepath, range_min=0, range_max=None, chunk_size=bytestring. Yield chunks of bytes from the file between the endpoints. ''' filepath = pathclass.Path(filepath) + if not filepath.exists: + raise FileNotFoundError(filepath) if range_max is None: range_max = filepath.size range_span = (range_max + 1) - range_min