-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathmain.py
More file actions
35 lines (30 loc) · 994 Bytes
/
main.py
File metadata and controls
35 lines (30 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import logging
try:
import platform
from tkinter import messagebox
# Check OS
if platform.system() != 'Windows':
err = "MF Run Counter only runs on Windows"
messagebox.showerror('OS Error', err)
raise SystemError(err)
except Exception as e:
logging.exception(e)
raise e
try:
import win32event
import win32api
from winerror import ERROR_ALREADY_EXISTS
import sys
import os
from utils import tk_utils
from master_frame import MasterFrame
mutex = win32event.CreateMutex(None, False, 'A957B84C-9800-4BAE-8B56-8F446AB8ED5B')
last_error = win32api.GetLastError()
if last_error == ERROR_ALREADY_EXISTS:
messagebox.showerror('Already open', 'An instance of MF Run Counter is already open - Aborting!')
logging.exception(f'An instance of MF Run Counter is already open - Aborting! {last_error}')
sys.exit(0)
MasterFrame()
except Exception as e:
logging.exception(e)
raise e