Skip to content

Commit 09be8f4

Browse files
Merge pull request #1075 from mantidproject/1073_catch_oserror
Catch OSError exception when attempting to save to read-only folder
2 parents b7567aa + 0d41230 commit 09be8f4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/mslice/models/workspacemanager/file_io.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,12 @@ def _get_slice_mdhisto_xye(histo_ws):
270270

271271

272272
def _output_data_to_ascii(output_path, out_data, header):
273-
np.savetxt(
274-
_to_absolute_path(str(output_path)), out_data, fmt="%12.9e", header=header
275-
)
273+
try:
274+
np.savetxt(
275+
_to_absolute_path(str(output_path)), out_data, fmt="%12.9e", header=header
276+
)
277+
except OSError as e:
278+
raise RuntimeError(f"Error occurred: {e}")
276279

277280

278281
def _to_absolute_path(filepath: str) -> str:

src/mslice/util/mantid/algorithm_wrapper.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,5 @@ def remove_from_ads(workspacename):
129129
if AnalysisDataService.Instance().doesExist(hiddenworkspace):
130130
AnalysisDataService.Instance().remove(hiddenworkspace)
131131
hiddenworkspace = "__MSL" + workspacename + "_HIDDEN"
132-
print(AnalysisDataService.Instance().getObjectNames())
133132
if AnalysisDataService.Instance().doesExist(hiddenworkspace):
134133
AnalysisDataService.Instance().remove(hiddenworkspace)

0 commit comments

Comments
 (0)