Skip to content
Snippets Groups Projects
Commit c06601a2 authored by Florstedt, Julius's avatar Florstedt, Julius
Browse files

Merge branch '43-confidential-issue' into 'main'

file write extension

Closes #43

See merge request !43
parents 6bfd895c 7d7309fe
Branches expand_type_support
Tags
1 merge request!43file write extension
Pipeline #1652573 passed
...@@ -418,7 +418,9 @@ class Serializer: ...@@ -418,7 +418,9 @@ class Serializer:
if self._written_to_file: if self._written_to_file:
raise NotImplementedError("You can only write the figure into the JSON once! Multiple tries were attempted") raise NotImplementedError("You can only write the figure into the JSON once! Multiple tries were attempted")
if isinstance(file, str): if isinstance(file, str):
os.makedirs(os.path.dirname(file), exist_ok=True) directory = os.path.dirname(file)
if directory:
os.makedirs(directory, exist_ok=True)
with open(file, "w") as file: with open(file, "w") as file:
self.write_json_file(file) self.write_json_file(file)
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment