From e723d4bb35e64879b11786317602a9ee8199f2b5 Mon Sep 17 00:00:00 2001
From: Gregory Ashton <gregory.ashton@ligo.org>
Date: Tue, 30 Apr 2019 22:55:41 -0500
Subject: [PATCH] Adds a check to dynesty to ensure the dir exists before
 writing the pickle file

---
 bilby/core/sampler/dynesty.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bilby/core/sampler/dynesty.py b/bilby/core/sampler/dynesty.py
index edf6b8c85..2b6dc72c3 100644
--- a/bilby/core/sampler/dynesty.py
+++ b/bilby/core/sampler/dynesty.py
@@ -209,6 +209,7 @@ class Dynesty(NestedSampler):
         if self.kwargs["verbose"]:
             print("")
 
+        check_directory_exists_and_if_not_mkdir(self.outdir)
         dynesty_result = "{}/{}_dynesty.pickle".format(self.outdir, self.label)
         with open(dynesty_result, 'wb') as file:
             pickle.dump(out, file)
-- 
GitLab