From aaaeee3e88746efeeae1060d1c36005ba1fc1ca8 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Wed, 20 Jul 2022 09:57:45 +0900 Subject: [PATCH] clarify error messages of chargeScripts when antechamber or xtb is unavailable fix #1034 Signed-off-by: Eisuke Kawashima --- .../qtplugins/scriptcharges/chargeScripts/antechamber.py | 6 +++++- avogadro/qtplugins/scriptcharges/chargeScripts/xtb.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/avogadro/qtplugins/scriptcharges/chargeScripts/antechamber.py b/avogadro/qtplugins/scriptcharges/chargeScripts/antechamber.py index 0d4fe1e26c..4e3b3fda61 100644 --- a/avogadro/qtplugins/scriptcharges/chargeScripts/antechamber.py +++ b/avogadro/qtplugins/scriptcharges/chargeScripts/antechamber.py @@ -144,7 +144,11 @@ def potential(): if args["metadata"]: print(json.dumps(getMetaData())) elif args["display_name"]: - print(getMetaData()["name"]) + name = getMetaData().get("name") + if name: + print(name) + else: + raise RuntimeError("antechamber is unavailable") elif args["charges"]: print(charges()) elif args["potential"]: diff --git a/avogadro/qtplugins/scriptcharges/chargeScripts/xtb.py b/avogadro/qtplugins/scriptcharges/chargeScripts/xtb.py index ecd6e659c2..193b58b40e 100644 --- a/avogadro/qtplugins/scriptcharges/chargeScripts/xtb.py +++ b/avogadro/qtplugins/scriptcharges/chargeScripts/xtb.py @@ -93,7 +93,11 @@ def potential(): if args["metadata"]: print(json.dumps(getMetaData())) elif args["display_name"]: - print(getMetaData()["name"]) + name = getMetaData().get("name") + if name: + print(name) + else: + raise RuntimeError("xtb is unavailable") elif args["charges"]: print(charges()) elif args["potential"]: