Skip to content

Commit

Permalink
Fixes bodge in cfg script
Browse files Browse the repository at this point in the history
  • Loading branch information
zenlan committed May 30, 2024
1 parent cff4809 commit 13b4378
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions funcs/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def init_dirs():
os.mkdir(OUT_DIR)


ROOT_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))
# ROOT_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))
ROOT_DIR = sys.prefix
DATA_DIR = os.path.join(ROOT_DIR, "dat", "")
ORDS_DIR = os.path.join(ROOT_DIR, "dat/ords")
LOG_DIR = os.path.join(ROOT_DIR, "log", "")
Expand All @@ -27,15 +28,19 @@ def init_dirs():

def init_logger(caller):

venv = sys.prefix != sys.base_prefix
filename, file_ext = os.path.splitext(os.path.basename(caller))
path = os.path.join(LOG_DIR, filename + ".log")
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler(path, mode="w")
fh.setLevel(logging.DEBUG)
logger.addHandler(fh)
logger.debug(f"ROOT {ROOT_DIR}")
logger.debug(f"VENV? {sys.prefix != sys.base_prefix}")
logger.debug(f"VENV? {venv}")
logger.debug(f"ROOT_DIR {ROOT_DIR}")
logger.debug(f"DATA_DIR {DATA_DIR}")
logger.debug(f"LOG_DIR {LOG_DIR}")
logger.debug(f"OUT_DIR {OUT_DIR}")
return logger


Expand Down

0 comments on commit 13b4378

Please sign in to comment.