From fbc407f7ab6bfe8c293999ef6c74428a0800a37a Mon Sep 17 00:00:00 2001 From: Marek Makowski Date: Tue, 4 Jul 2023 12:27:19 +0200 Subject: [PATCH] lpdiag: improved work-dir diagnostics. Diagnostics of possible problems with wrong working directory improved, as well as the corresponding tip on dealing with the problem. --- message_ix/tools/lp_diag/lpdiag.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/message_ix/tools/lp_diag/lpdiag.py b/message_ix/tools/lp_diag/lpdiag.py index 45c5ba75d..4d5cde671 100644 --- a/message_ix/tools/lp_diag/lpdiag.py +++ b/message_ix/tools/lp_diag/lpdiag.py @@ -73,12 +73,14 @@ def read_args(): # dir2 = os.getcwd() # print(f"{dir2 =}") w_dir = args.wdir or "." - # prob_id = args.mps or "test_mps/diet" # default MPS for testing prob_id = args.mps or "test_mps/aez" # default MPS for testing + # alternative specs of test-MPS commented below + # prob_id = args.mps or "test_mps/diet" # default MPS for testing # prob_id = args.mps or "test_mps/err_tst" # default MPS for testing + # prob_id = args.mps or "test_mps/jg_korh" # default MPS for testing # prob_id = args.mps or "test_mps/lotfi" # default MPS for testing - # prob_id = args.mps or "test_mps/of_led1" # default MPS for testing if len(w_dir) > 1: + work_dir = w_dir print(f"Changing work-directory to: {w_dir}.") try: os.chdir(w_dir) @@ -87,8 +89,8 @@ def read_args(): # dir3 = os.getcwd() # print(f"{dir3 =}") assert isfile(prob_id), ( - f"MPS file {prob_id} not accessible from the dir:\n'{w_dir}'.\n" - "Try to use the --wdir command option to set the work-directory." + f"MPS file {prob_id} not accessible from the work-directory:\n'{work_dir}'." + "\nTry to use the --wdir command option to set the work-directory." ) assert access(prob_id, R_OK), f"MPS file {prob_id} is not readable."