From 12af0256dd22313c65a992bf543962e357bb735d Mon Sep 17 00:00:00 2001 From: Finn Stutzenstein Date: Mon, 8 Aug 2016 09:51:44 +0200 Subject: [PATCH] No crash without a browser (fixes #2249) --- openslides/utils/main.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/openslides/utils/main.py b/openslides/utils/main.py index b584048ef..2a420fa32 100644 --- a/openslides/utils/main.py +++ b/openslides/utils/main.py @@ -261,15 +261,19 @@ def start_browser(browser_url): Launches the default web browser at the given url and opens the webinterface. """ - browser = webbrowser.get() + try: + browser = webbrowser.get() + except webbrowser.Error: + print('Could not locate runnable browser: Skipping start') + else: - def function(): - # TODO: Use a nonblocking sleep event here. Tornado has such features. - time.sleep(1) - browser.open(browser_url) + def function(): + # TODO: Use a nonblocking sleep event here. Tornado has such features. + time.sleep(1) + browser.open(browser_url) - thread = threading.Thread(target=function) - thread.start() + thread = threading.Thread(target=function) + thread.start() def get_database_path_from_settings():