Skip to content

Commit

Permalink
prevent file from closing while writing to buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyStegeman committed Dec 3, 2024
1 parent a8517e9 commit fad96a6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions validphys2/src/validphys/coredata.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import pandas as pd
from ruamel.yaml import YAML

yaml = YAML(typ='rt')
yaml = YAML(typ='safe')
from validphys.utils import generate_path_filtered_data

KIN_NAMES = ["kin1", "kin2", "kin3"]
Expand Down Expand Up @@ -474,6 +474,8 @@ def export(self, folder_path):
data_path = folder_path / data_path.name
unc_path = folder_path / unc_path.name
# Export data and uncertainties
self.export_data(data_path.open("w", encoding="utf-8"))
self.export_uncertainties(unc_path.open("w", encoding="utf-8"))
with open(data_path, "w") as file:
self.export_data(file)
with open(unc_path, "w") as file:
self.export_uncertainties(file)
return data_path, unc_path

0 comments on commit fad96a6

Please sign in to comment.