This commit is contained in:
Saifeddine ALOUI 2024-04-09 23:56:48 +02:00
parent 057ef9b05e
commit 73ab4559c3

View File

@ -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": "<div class='text-red-500'>"+error_message+"</div>", "execution_time": execution_time}
return error_json