diff --git a/IL Extract.spec b/IL Extract.spec index 8fd3250..02aa579 100644 --- a/IL Extract.spec +++ b/IL Extract.spec @@ -8,7 +8,7 @@ a = Analysis( ['src/il_extract.py'], pathex=['src'], binaries=[], - datas=[('src/assets/*', 'assets'), ('settings.json', '.')], + datas=[('src/assets/*', 'assets'), ('settings.toml', '.')], hiddenimports=[], hookspath=[], hooksconfig={}, diff --git a/src/il_extract.py b/src/il_extract.py index 1548153..d3b1198 100644 --- a/src/il_extract.py +++ b/src/il_extract.py @@ -6,7 +6,7 @@ import json from PyQt5 import QtWidgets from datetime import datetime as dt import il_reports as ilx #TODO redo aliasing -from logging import debug, DEBUG, basicConfig +from logging import debug, DEBUG, basicConfig, exception from tomllib import load from tomli_w import dump @@ -35,7 +35,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): # The location that the outputfile will be saved at self.outputFile = "" # Load the settings.toml - with open("settings.toml") as s: + with open("settings.toml", mode="rb") as s: self.settings = load(s) # Set the current report type to ACH as default @@ -221,7 +221,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): if self.settings["defaultLocations"][self.curReportType] == '': self.settings["defaultLocations"][self.curReportType] = ('/').join(self.inputFile.split('/')[:-1]) debug(f"checked_for_saved: saved new deafult location | {self.curReportType} | {self.settings['defaultLocations'][self.curReportType]}") - with open('settings.toml', 'w') as s: + with open('settings.toml', 'wb') as s: # Save changes to the setting dump(self.settings, s) @@ -294,13 +294,16 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): if __name__ == "__main__": - # Defines the app - app = QtWidgets.QApplication(sys.argv) - # Sets the style - app.setStyle("Fusion") - # Builds the main window - window = MainWindow() - window.setWindowTitle("IL Extract") - window.show() - # Starts the app - app.exec() + try: + # Defines the app + app = QtWidgets.QApplication(sys.argv) + # Sets the style + app.setStyle("Fusion") + # Builds the main window + window = MainWindow() + window.setWindowTitle("IL Extract") + window.show() + # Starts the app + app.exec() + except Exception as e: + exception(f"HIGH LEVEL EXECPTION: {e}")