-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
53 lines (48 loc) · 1.76 KB
/
main.py
File metadata and controls
53 lines (48 loc) · 1.76 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import os
import sys
import tkinter
from tkinter import messagebox
import pandas as pd
from utils import get_app_dir
from data_process import process_data
from avails import avails_process
def main():
# Display a message box to state that the program is running
root = tkinter.Tk()
root.withdraw()
messagebox.showinfo("Data Processing", "Data processing started. Click OK to continue.")
# Process the data
try:
process_data()
# Display completion message
print("Data processing complete! Please wait while Avails are being generated.")
except Exception as e:
# Display error message
root = tkinter.Tk()
root.withdraw()
messagebox.showerror("Error", "An error occurred while processing the data. Please check the log file for more information.")
# Write error message to log file
app_dir = get_app_dir()
log_file = os.path.join(app_dir, 'error.log')
with open(log_file, 'w') as f:
f.write(str(e))
sys.exit(1)
# Process Avails
try:
avails_process()
except Exception as e:
# Display error message
root = tkinter.Tk()
root.withdraw()
messagebox.showerror("Error", "An error occurred while processing the Avails. Please check the log file for more information.")
# Write error message to log file
app_dir = get_app_dir()
log_file = os.path.join(app_dir, 'error.log')
with open(log_file, 'w') as f:
f.write(str(e))
# Display completion message
root = tkinter.Tk()
root.withdraw()
messagebox.showinfo("Task Completed", "Avails processing complete! Check the avails folder for the output files. Click OK to exit.")
if __name__ == '__main__':
main()