From 2cd7037e15607598a100d9b887e64f7c484413b2 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Thu, 24 Apr 2025 12:06:35 +0200 Subject: [PATCH] Weird "name too long" --- main.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index f1f0c588..6a069ebc 100644 --- a/main.py +++ b/main.py @@ -222,9 +222,10 @@ restart_btn.add_event_cb(lambda event: machine.reset(),lv.EVENT.CLICKED,None) import _thread +import traceback def execute_script(script_source, is_file, lvgl_obj, return_to_launcher): - thread_id = _thread.get_ident(); + thread_id = _thread.get_ident() print(f"Thread {thread_id}: executing script") try: script_globals = { @@ -239,16 +240,21 @@ def execute_script(script_source, is_file, lvgl_obj, return_to_launcher): script_source = f.read() print(f"Thread {thread_id}: starting script") try: - exec(script_source, script_globals) + # Compile the script to catch syntax errors with better context + compiled_script = compile(script_source, '