Skip to content

Commit 0e2686d

Browse files
committed
open correct url with oc gui
1 parent 2ead332 commit 0e2686d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cravat/cravat_web.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import time
3333
import cravat.util
3434
import threading
35+
from pathlib import Path
3536

3637

3738
SERVER_ALREADY_RUNNING = -1
@@ -266,7 +267,8 @@ def _open():
266267
try:
267268
webbrowser.open(url)
268269
except:
269-
pass
270+
import traceback
271+
traceback.print_exc()
270272
threading.Thread(target=_open, daemon=True).start()
271273

272274
def run_flask(args):
@@ -292,7 +294,11 @@ def run_flask(args):
292294

293295
server_config = get_server()
294296
if not args.headless:
295-
open_browser('http://localhost:8080')
297+
url = f'http://{server_config['host']}:{server_config['port']}'
298+
if args.result is not None:
299+
dbpath = Path(args.result).resolve()
300+
url += f'/result/index.html?dbpath={dbpath}'
301+
open_browser(url)
296302

297303
gui.start_server(server_config['host'],
298304
server_config['port'],

0 commit comments

Comments
 (0)