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