From b97e0723ee03f64e824bc5dd78ba6a51adc5553f Mon Sep 17 00:00:00 2001 From: "Joshua E. Hansel" Date: Thu, 31 Aug 2023 16:17:14 -0500 Subject: [PATCH] Added error message for failed plot script in MooseDocs Refs #23900 --- python/MooseDocs/extensions/media.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/MooseDocs/extensions/media.py b/python/MooseDocs/extensions/media.py index 3a78e15a663c..cebdd7950f14 100644 --- a/python/MooseDocs/extensions/media.py +++ b/python/MooseDocs/extensions/media.py @@ -133,10 +133,10 @@ def createToken(self, parent, info, page, settings): # Generate the plot LOG.info("Executing plot script %s", script_path) - result = subprocess.run(["python", script_path], capture_output=True) + result = subprocess.run(["python", script_path], capture_output=True, text=True) if result.returncode != 0: - msg = "Failed to execute python script: %s" - raise exceptions.MooseDocsException(msg, script_path) + msg = "Failed to execute python script '{}':\n{}" + raise exceptions.MooseDocsException(msg, script_path, result.stderr) # Currently the plot is assumed to reside in the same directory as the plot script. plot_name = settings['image_name'] or os.path.basename(script_path).replace('.py', '.png')