From 60ac1ddbb93b6acda61589509293b4f8009d00b6 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Fri, 27 Nov 2020 13:19:58 +0100 Subject: [PATCH] fix warnings about unclosed files. --- src/documents/management/commands/document_consumer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.py index 295da4f5c..7baeccce0 100644 --- a/src/documents/management/commands/document_consumer.py +++ b/src/documents/management/commands/document_consumer.py @@ -137,7 +137,8 @@ class Command(BaseCommand): f"Using inotify to watch directory for changes: {directory}") inotify = INotify() - descriptor = inotify.add_watch(directory, flags.CLOSE_WRITE | flags.MOVED_TO) + descriptor = inotify.add_watch( + directory, flags.CLOSE_WRITE | flags.MOVED_TO) try: while not self.stop_flag: for event in inotify.read(timeout=1000, read_delay=1000): @@ -147,3 +148,4 @@ class Command(BaseCommand): pass inotify.rm_watch(descriptor) + inotify.close()