From a27c115699d93091e1937bd24f47edba0ee9f0fa Mon Sep 17 00:00:00 2001
From: Karim Ahmed <karim.ahmed@xfel.eu>
Date: Tue, 10 Dec 2019 15:39:33 +0100
Subject: [PATCH] avoid errs when run not int

---
 xfel_calibrate/calibrate.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/xfel_calibrate/calibrate.py b/xfel_calibrate/calibrate.py
index 6f9f9ebb9..256406890 100755
--- a/xfel_calibrate/calibrate.py
+++ b/xfel_calibrate/calibrate.py
@@ -795,12 +795,10 @@ def run():
                 if "run" in args:
                     rr = args["run"]
                     # Only put run, when it is not in the folder path
-                    # (e.g. out-folder from webservice conf)
-                    if "r{:04d}/".format(rr) not in out_path and\
-                            "{}".format(rr) not in out_path:
-                        if isinstance(rr, int):
-                            out_path = "{}/r{:04d}/".format(out_path, rr)
-                        else:
+                    # (e.g. out-folder from webservice config)
+                    if isinstance(rr, int):
+                        rr = "r{:04d}".format(rr)
+                    if "{}".format(rr) not in out_path:
                             out_path = "{}/{}/".format(out_path, rr)
             else:
                 print("No 'out_folder' defined as argument, outputting to '{}' instead.".format(
-- 
GitLab