From 77b3aa5011c0d70092b6eda6721b07693712d16d Mon Sep 17 00:00:00 2001 From: Trenton Holmes Date: Sat, 8 Oct 2022 12:50:16 -0700 Subject: [PATCH] Fixes is_relative_to not being availible for 3.8 --- src/documents/tasks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/documents/tasks.py b/src/documents/tasks.py index 289586e7e..72b8b5244 100644 --- a/src/documents/tasks.py +++ b/src/documents/tasks.py @@ -117,9 +117,11 @@ def consume_file( # Move it to consume directory to be picked up # Otherwise, use the current parent to keep possible tags # from subdirectories - if path.is_relative_to(settings.SCRATCH_DIR): + try: + # is_relative_to would be nicer, but new in 3.9 + _ = path.relative_to(settings.SCRATCH_DIR) save_to_dir = settings.CONSUMPTION_DIR - else: + except ValueError: save_to_dir = path.parent barcodes.save_to_dir(