Skip to content

Commit aea4231

Browse files
Don't delete GeophiresInputParameters temporary output file
1 parent c0808ea commit aea4231

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/geophires_x_client/geophires_input_parameters.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,18 @@ def __init__(self, params: Optional[MappingProxyType] = None, from_file_path: Op
6262
f.writelines([', '.join([str(p) for p in param_item]) + '\n' for param_item in self._params.items()])
6363

6464
self._id = hash(self._file_path)
65+
self._output_file_path: Path = None
6566

6667
def as_file_path(self):
6768
return self._file_path
6869

6970
def get_output_file_path(self):
70-
return Path(tempfile.gettempdir(), f'geophires-result_{self._id}.out')
71+
if self._output_file_path is None:
72+
base_name = f'_geophires-result_{self._id}.out'
73+
tf = tempfile.NamedTemporaryFile(delete=False, suffix=base_name)
74+
self._output_file_path = Path(tf.name)
75+
76+
return self._output_file_path
7177

7278
def as_text(self):
7379
with open(self.as_file_path(), encoding='UTF-8') as f:

0 commit comments

Comments
 (0)