Skip to content
Snippets Groups Projects
main.py 41.4 KiB
Newer Older
  • Learn to ignore specific revisions
  • Romain MATIAS's avatar
    Romain MATIAS committed
                        except(Exception) as error:
                            debugLog(style.YELLOW, "/!\ This script will computeAll plantability in all territory")
    
                        # Launch function
                        computeAll(int(secArgv), thirdArgv)
                    else:
                        debugLog(style.RED, "The grid size value is not a number. Please correct your input")
            elif firstArgv == 'test':
                secArgv = sys.argv[1:][1]
                test(secArgv)
            elif firstArgv == 'help':
                showDoc()
            else:
                showDoc()
                debugLog(style.RED, "Unrecognized arguments for this script", logging.ERROR)
        else:
            showDoc()
    
    if __name__ == "__main__":
        # Enable windows native color
        os.system("")
    
        # Init logs directory
        logsPath = './logs/'
        checkAndCreateDirectory(logsPath)
    
        # Init logging
        initLogging(logsPath)
    
        # Load .env values
        load_dotenv()
    
        # Check .env file initialization
        checkEnvFile()
    
        # Init env variable
        initEnv()
    
        # Only print in console
        print(style.YELLOW + "Current database settings : {} - {} \n".format(DB_params['host'], DB_params['database']), style.RESET)
    
        # Check if ./tmp/ folder exist then create if not
        tmpPath = './tmp/'
        checkAndCreateDirectory(tmpPath)
    
        # Launch main function
        main()