From 5c09ef78f87146d39bfee989c1ea1ca6da5dc4af Mon Sep 17 00:00:00 2001 From: Athanasius Date: Mon, 18 Jan 2021 16:31:54 +0000 Subject: [PATCH] Add comment as to why the file open is done at top level --- EDMarketConnector.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 7cfda5c2..55fd4bd5 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -43,6 +43,8 @@ if __name__ == '__main__': if __name__ == "__main__": journal_dir = config.get('journaldir') or config.default_journal_dir + # This must be at top level to guarantee the file handle doesn't go out + # of scope and get cleaned up, removing the lock with it. journal_dir_lockfile = open(join(journal_dir, 'edmc-journal-lock.txt'), mode='w+', encoding='utf-8') def no_other_instance_running() -> bool: # noqa: CCR001