From 6d1edf918499515df890542d3dc202e6b003f56a Mon Sep 17 00:00:00 2001 From: martin legrand Date: Tue, 15 Apr 2025 20:56:58 +0200 Subject: [PATCH] fix :__main__ not working within interpreter --- frontend/agentic-seek/src/App.js | 1 + sources/tmp.py | 7 +++++++ sources/tools/PyInterpreter.py | 4 ++++ start_services.sh | 2 -- 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 sources/tmp.py diff --git a/frontend/agentic-seek/src/App.js b/frontend/agentic-seek/src/App.js index 04093ec..267c37e 100644 --- a/frontend/agentic-seek/src/App.js +++ b/frontend/agentic-seek/src/App.js @@ -14,6 +14,7 @@ function App() { useEffect(() => { scrollToBottom(); + checkHealth(); }, [messages]); // Added: checks /health diff --git a/sources/tmp.py b/sources/tmp.py new file mode 100644 index 0000000..24d29f5 --- /dev/null +++ b/sources/tmp.py @@ -0,0 +1,7 @@ + +def print_hello(): + hello = "Hello World" + print(hello) + +if __name__ == "__main__": + print_hello() diff --git a/sources/tools/PyInterpreter.py b/sources/tools/PyInterpreter.py index 3e2c59f..5d8ec86 100644 --- a/sources/tools/PyInterpreter.py +++ b/sources/tools/PyInterpreter.py @@ -30,6 +30,7 @@ class PyInterpreter(Tools): '__builtins__': __builtins__, 'os': os, 'sys': sys, + '__name__': '__main__' } code = '\n\n'.join(codes) try: @@ -93,6 +94,9 @@ here is a save test def print_hello(): hello = "Hello World" print(hello) + +if __name__ == "__main__": + print_hello() ``` """ py = PyInterpreter() diff --git a/start_services.sh b/start_services.sh index 88923b3..7a340e7 100755 --- a/start_services.sh +++ b/start_services.sh @@ -54,8 +54,6 @@ if [ ! -f "docker-compose.yml" ]; then exit 1 fi -echo "SearXNG setup complete!" - # start docker compose for searxng, redis, frontend services echo "Warning: stopping all docker containers (t-4 seconds)..." sleep 4