From 2a90e69ff91f13e1fcb49ec23c6a2f3ae3c6fbbf Mon Sep 17 00:00:00 2001
From: Saifeddine ALOUI <aloui.seifeddine@gmail.com>
Date: Sun, 29 Sep 2024 12:16:48 +0200
Subject: [PATCH] fix python execution

---
 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 546b6fd2..778238fb 100644
--- a/utilities/execution_engines/python_execution_engine.py
+++ b/utilities/execution_engines/python_execution_engine.py
@@ -70,7 +70,10 @@ def execute_python(code, client, message_id, build_file=True):
             return error_json
 
         # The child process was successful.
-        output_json = {"output": output.decode("utf8"), "execution_time": execution_time}
+        if output:
+            output_json = {"output": output.decode("utf8"), "execution_time": execution_time}
+        else:
+            output_json = {"output": "", "execution_time": execution_time}
         return output_json
 
     return spawn_process(code)