For some silly reason, the below works on creating the non-existing directory stored in output_result_dir, but not the non_existing directory stored in output_log_dir. The latter results in a FileNotFound Error with description "[WinError 3] The system cannot find the path specified: 'runpackage1\calculated\logs'"
log_dir = os.path.join(output_dir, 'logs')
output_config_dir = os.path.join(output_dir, 'config')
output_result_dir = os.path.join(output_dir, 'results')
for directory in [output_result_dir, log_dir, output_config_dir]:
if not os.path.exists(directory):
os.makedirs(directory)
Am I missing something really stupid here? I also tried inserting an os.path.abspath around the path to get from relative to full paths, but that didn't help either.
Edit: changed directory from path as some people rightfully pointed out. I actually copied code from two separate functions into one self-contained block here, hence introducing the error. It's not the issue that caused my problem.
directorynotpath