improve start_browser

- make it executable
- try again within 30 seconds
This commit is contained in:
2025-10-14 17:18:54 +02:00
parent 8a4dc7b50c
commit 382ecf67aa

13
start_browser.py Normal file → Executable file
View File

@@ -1,17 +1,26 @@
#!/usr/bin/python
import os import os
import sys
import time import time
import socket import socket
show = True show = True
starttime = time.time()
sys.stderr.write('start\n')
for _ in range(30): for _ in range(30):
try: try:
socket.create_connection(('localhost', 8010), timeout=1) socket.create_connection(('localhost', 8080), timeout=1)
os.system('/usr/bin/chromium-browser http://localhost:8080/') os.system('/usr/bin/chromium-browser http://localhost:8080/')
t = time.time() - starttime
if t > 30:
break break
sys.stderr.write(f'{t:.3f} try again\n')
except Exception as e: except Exception as e:
time.sleep(1) t = time.time() - starttime
sys.stderr.write(f'{t:.3f} failed {e!r}\n')
if show: if show:
print('waiting for frappy websocket') print('waiting for frappy websocket')
show = False show = False
time.sleep(1)
else: else:
print('do not start chrome - waiting for frappy websocket failed') print('do not start chrome - waiting for frappy websocket failed')