When running the program for the first time, the program tries to use logging.FileHandler to create the debug.log file in the Valorant-Zone-Stats folder in AppData. The issue is that this folder does not exist when a new user starts the app for the first time. and logging.FileHandler will not create this directory on its own.
Hence the program crashes with the following error
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\<username>\\AppData\\Roaming\\Valorant-Zone-Stats\\debug.log'
I notice that migrate_files tries to create that directory if it does not exist, however it is after the logger is attempted to initialize, hence the required directories are never created.
Instead of creating the app folder in migrate_files function which is run on module's main method. We can create that folder one time (if does not already exist), right before the logger is loaded, this will ensure that the folder is always present in all cases.
This PR should fix the above issue and has been tested on my machine.
When running the program for the first time, the program tries to use
logging.FileHandler
to create thedebug.log
file in theValorant-Zone-Stats
folder inAppData
. The issue is that this folder does not exist when a new user starts the app for the first time. andlogging.FileHandler
will not create this directory on its own.Hence the program crashes with the following error
I notice that
migrate_files
tries to create that directory if it does not exist, however it is after the logger is attempted to initialize, hence the required directories are never created.Instead of creating the app folder in
migrate_files
function which is run on module's main method. We can create that folder one time (if does not already exist), right before the logger is loaded, this will ensure that the folder is always present in all cases.This PR should fix the above issue and has been tested on my machine.