From 73ab4559c34e13cd2ca41f2d41c34f3eaec002af Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Tue, 9 Apr 2024 23:56:48 +0200 Subject: [PATCH] updated --- utilities/execution_engines/python_execution_engine.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utilities/execution_engines/python_execution_engine.py b/utilities/execution_engines/python_execution_engine.py index 172d75f1..1cefdfa7 100644 --- a/utilities/execution_engines/python_execution_engine.py +++ b/utilities/execution_engines/python_execution_engine.py @@ -54,7 +54,10 @@ def execute_python(code, client:Client, message_id): # Check if the process was successful. if process.returncode != 0: # The child process threw an exception. - error_message = f"Error executing Python code: {error.decode('utf8')}" + try: + error_message = f"Error executing Python code: {error.decode('utf8')}" + except: + error_message = f"Error executing Python code: {error}" error_json = {"output": "
"+error_message+"
", "execution_time": execution_time} return error_json