Add check for webbrowser import which may not be available in all Python builds (like certain NAS devices).
This commit is contained in:
@@ -17,11 +17,16 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import threading
|
import threading
|
||||||
import webbrowser
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import cherrypy
|
import cherrypy
|
||||||
import datetime
|
import datetime
|
||||||
import uuid
|
import uuid
|
||||||
|
# Some cut down versions of Python may not include this module and it's not critical for us
|
||||||
|
try:
|
||||||
|
import webbrowser
|
||||||
|
no_browser = False
|
||||||
|
except ImportError:
|
||||||
|
no_browser = True
|
||||||
|
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
from apscheduler.triggers.interval import IntervalTrigger
|
from apscheduler.triggers.interval import IntervalTrigger
|
||||||
@@ -228,6 +233,7 @@ def daemonize():
|
|||||||
|
|
||||||
|
|
||||||
def launch_browser(host, port, root):
|
def launch_browser(host, port, root):
|
||||||
|
if not no_browser:
|
||||||
if host == '0.0.0.0':
|
if host == '0.0.0.0':
|
||||||
host = 'localhost'
|
host = 'localhost'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user