logging in right folder when called from other dir

This commit is contained in:
davidpagnon 2023-08-04 13:05:51 +02:00
parent 00cda59e33
commit 8e9c5dd1d6
2 changed files with 9 additions and 4 deletions

View File

@ -42,10 +42,10 @@ import os
import time
import logging, logging.handlers
if not os.path.exists('User'): os.mkdir('User')
with open(os.path.join('User', 'logs.txt'), 'a+') as log_f: pass
logging.basicConfig(format='%(message)s', level=logging.INFO,
handlers = [logging.handlers.TimedRotatingFileHandler(os.path.join('User', 'logs.txt'), when='D', interval=7), logging.StreamHandler()])
# if not os.path.exists('User'): os.mkdir('User')
# with open(os.path.join('User', 'logs.txt'), 'a+') as log_f: pass
# logging.basicConfig(format='%(message)s', level=logging.INFO,
# handlers = [logging.handlers.TimedRotatingFileHandler(os.path.join('User', 'logs.txt'), when='D', interval=7), logging.StreamHandler()])
## AUTHORSHIP INFORMATION
@ -80,6 +80,10 @@ def base_params(config_dict):
seq_name = os.path.basename(project_dir)
frames = ["all frames" if frame_range == [] else f"frames {frame_range[0]} to {frame_range[1]}"][0]
with open(os.path.join(project_dir, 'User', 'logs.txt'), 'a+') as log_f: pass
logging.basicConfig(format='%(message)s', level=logging.INFO,
handlers = [logging.handlers.TimedRotatingFileHandler(os.path.join(project_dir, 'User', 'logs.txt'), when='D', interval=7), logging.StreamHandler()])
return project_dir, seq_name, frames

View File

@ -554,6 +554,7 @@ def calibrate_cams_all(config):
if project_dir == '': project_dir = os.getcwd()
calib_folder_name = config.get('project').get('calib_folder_name')
calib_dir = os.path.join(project_dir, calib_folder_name)
print(calib_dir)
calib_type = config.get('calibration').get('type')
if calib_type=='vicon':
vicon_path = glob.glob(os.path.join(calib_dir, '*.xcp'))[0]