From f744d97d9c3e27f9db0a3ab2011c1de17c811f4d Mon Sep 17 00:00:00 2001
From: Michael <m.langguth@fz-juelich.de>
Date: Tue, 19 Jul 2022 13:30:00 +0200
Subject: [PATCH] Trouble shooting in config_postprocess.py in case user only
 presses 'Enter'.

---
 .../runscript_generator/config_postprocess.py | 21 +++++++++----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/video_prediction_tools/utils/runscript_generator/config_postprocess.py b/video_prediction_tools/utils/runscript_generator/config_postprocess.py
index 54433783..5edf0030 100755
--- a/video_prediction_tools/utils/runscript_generator/config_postprocess.py
+++ b/video_prediction_tools/utils/runscript_generator/config_postprocess.py
@@ -78,7 +78,7 @@ class Config_Postprocess(Config_runscript_base):
         _ = Config_Postprocess.get_subdir_list(dir_base)
         
         # Chose the checkpoint directory
-        ckp_req_str = "Chose a checkpoint directory from the list above:"
+        ckp_req_str = "Choose a checkpoint directory from the list above:"
         ckp_req_err = NotADirectoryError("Could not find the passed directory.")
         dir_base = Config_Postprocess.keyboard_interaction(ckp_req_str, Config_Postprocess.check_dir, ckp_req_err,
                                                            prefix2arg=dir_base+"/", ntries=2)
@@ -172,24 +172,23 @@ class Config_Postprocess(Config_runscript_base):
 
         status = False
 
-        model_in = os.path.basename(model_path)
-        if model_in == "help":
-            if not silent:
-                print("**** Known models ****")
-                for model in Config_Postprocess.list_models:
-                    print(model)
-                print("**** Known models ****")
+        model_in = os.path.basename(model_path)      # try to infer model-name (empty in case user simply pressed enter)
 
-        if not os.path.isdir(model_path):
+        if model_in == "help" or not os.path.isdir(model_path):
             if not silent:
-                print("The directory {0} does not exist".format(model_path))
+                if model_in != "help": 
+                    print("The directory {0} does not exist".format(model_path))
                 try:
                     _ = Config_Postprocess.get_subdir_list(os.path.dirname(model_path))
                 except: 
                     print("The base directory does not exist as well!")
             return status
 
-        if not model_in in Config_Postprocess.list_models:
+        if not model_in:     # user just printed 'Enter'
+            _ = Config_Postprocess.get_subdir_list(os.path.dirname(model_path))
+            return status
+        
+        if not model_in in Config_Postprocess.list_models :
             if not silent:
                 print("%{0}: WARNING: Unknown model name passed, but trained model seems to be present. \n ".format(method) +
                       "Please delete the directory '{0}' if this is not the case!".format(model_path))
-- 
GitLab