Skip to content
Snippets Groups Projects
Commit db1c9d25 authored by Sylvia Biscoveanu's avatar Sylvia Biscoveanu Committed by Colm Talbot
Browse files

Fix multinest temporary directory functionality

parent 03b41f8c
No related branches found
No related tags found
No related merge requests found
...@@ -181,11 +181,15 @@ class Pymultinest(NestedSampler): ...@@ -181,11 +181,15 @@ class Pymultinest(NestedSampler):
self.outputfiles_basename, self.temporary_outputfiles_basename self.outputfiles_basename, self.temporary_outputfiles_basename
) )
) )
if os.path.islink(self.outputfiles_basename.strip("/")): if self.outputfiles_basename.endswith('/'):
os.unlink(self.outputfiles_basename.strip("/")) outputfiles_basename_stripped = self.outputfiles_basename[:-1]
elif os.path.isdir(self.outputfiles_basename): else:
shutil.rmtree(self.outputfiles_basename, ignore_errors=True) outputfiles_basename_stripped = self.outputfiles_basename
shutil.move(self.temporary_outputfiles_basename, self.outputfiles_basename) if os.path.islink(outputfiles_basename_stripped):
os.unlink(outputfiles_basename_stripped)
elif os.path.isdir(outputfiles_basename_stripped):
shutil.rmtree(outputfiles_basename_stripped)
shutil.move(self.temporary_outputfiles_basename, outputfiles_basename_stripped)
def run_sampler(self): def run_sampler(self):
import pymultinest import pymultinest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment