diff --git a/openhtf/output/callbacks/__init__.py b/openhtf/output/callbacks/__init__.py index d29ce4531..63911b7ce 100644 --- a/openhtf/output/callbacks/__init__.py +++ b/openhtf/output/callbacks/__init__.py @@ -22,6 +22,7 @@ import collections import contextlib +import os import shutil import tempfile @@ -82,6 +83,10 @@ def serialize_test_record(test_record): @staticmethod def open_file(filename): """Override method to alter file open behavior or file types.""" + basepath = os.path.dirname(filename) + if not os.path.exists(basepath): + os.makedirs(basepath) + return Atomic(filename) def create_file_name(self, test_record):