1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-21 11:27:38 +03:00

Catch only 'Exception' off mvscrt.locking()

* It *should* only be a PermissionError, although the docs actually say
  the 'higher' OSError.  This way we will always catch whatever it is.
* The print uses {e!r} so as to make it explicit what the type of the
  exception is.
This commit is contained in:
Athanasius 2021-01-18 20:59:23 +00:00
parent dbba1d24c7
commit bf2a10f88b

@ -65,16 +65,8 @@ if __name__ == "__main__":
try:
msvcrt.locking(journal_dir_lockfile.fileno(), msvcrt.LK_NBLCK, 4096)
except PermissionError as e:
print(f"PermissionError: Couldn't lock journal directory \"{journal_dir}\", assuming another process running\n{e}")
return False
except OSError as e:
print(f"OSError: Couldn't lock journal directory \"{journal_dir}\", assuming another process running\n{e}")
return False
except Exception as e:
print(f"other Exception: Couldn't lock journal directory \"{journal_dir}\", assuming another process running\n{e}")
print(f"Exception: Couldn't lock journal directory \"{journal_dir}\", assuming another process running\n{e!r}")
return False
journal_dir_lockfile.write(f"Path: {journal_dir}\nPID: {os_getpid()}\n")