diff --git a/glennopt/base/optimizer.py b/glennopt/base/optimizer.py index 997b7d3f..d227a91e 100644 --- a/glennopt/base/optimizer.py +++ b/glennopt/base/optimizer.py @@ -14,6 +14,7 @@ import math import pprint import logging +from warnings import catch_warnings import pandas as pd """ External Modules @@ -54,8 +55,12 @@ def __init__(self,name:str,eval_command:str, eval_folder:str = None,opt_folder:s self.name = name assert opt_folder is not None - logging.basicConfig(filename=os.path.join(opt_folder,'log.dat'), level=logging.DEBUG) - self.logger = logging.getLogger() + try: + logging.basicConfig(filename=os.path.join(opt_folder,'log.dat'), level=logging.DEBUG) + self.logger = logging.getLogger() + except: + self.logger = None + if (not os.path.isabs(eval_folder)): eval_folder = os.path.join(os.getcwd(),eval_folder) @@ -458,7 +463,8 @@ def __write_proc_log__(self,p:subprocess.Popen,pop:int,ind_name:str): """ if p is not None: for line in p.stdout: - self.logger.debug('POP {0} Indivudual: {1} Message: {2}'.format(pop,ind_name,line.decode("utf-8").replace('\n', ' ').replace('\r', '')).strip()) + if (self.logger): + self.logger.debug('POP {0} Indivudual: {1} Message: {2}'.format(pop,ind_name,line.decode("utf-8").replace('\n', ' ').replace('\r', '')).strip()) def load_history_file(self): """Reads the history file if exists diff --git a/pyproject.toml b/pyproject.toml index 6b5040e1..d61e9413 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "GlennOPT" -version = "1.4.3" +version = "1.4.4" description = "Multi and single objective optimization tool for cfd/computer simulations." authors = ["Paht Juangphanich "]