Catch sooner if gevent is not installed.

pull/302/head
Louis Vézina 6 years ago
parent 377c82df52
commit 7f563449c8

@ -2,7 +2,20 @@
bazarr_version = '0.7.2'
from gevent import monkey
# Try to import gevent and exit if it's not available. This one is required to use websocket.
try:
from gevent import monkey
except ImportError as e:
logging.exception('BAZARR require gevent Python module to be installed using pip.')
try:
stop_file = open(os.path.join(args.config_dir, "bazarr.stop"), "w")
except Exception as e:
logging.error('BAZARR Cannot create bazarr.stop file.')
else:
stop_file.write('')
stop_file.close()
os._exit(0)
monkey.patch_all()
import gc
@ -26,10 +39,10 @@ from init import *
from update_db import *
from notifier import update_notifier
from logger import configure_logging, empty_log
import gevent
from gevent.pywsgi import WSGIServer
from geventwebsocket import WebSocketError
from geventwebsocket.handler import WebSocketHandler
# from cherrypy.wsgiserver import CherryPyWSGIServer
from io import BytesIO
from six import text_type
from beaker.middleware import SessionMiddleware
@ -80,20 +93,6 @@ if "PYCHARM_HOSTED" in os.environ:
else:
bottle.ERROR_PAGE_TEMPLATE = bottle.ERROR_PAGE_TEMPLATE.replace('if DEBUG and', 'if')
# Install gevent under user directory if it'S not already available. This one is required to use websocket.
try:
import gevent
except ImportError as e:
logging.exception('BAZARR require gevent Python module to be installed using pip.')
try:
stop_file = open(os.path.join(args.config_dir, "bazarr.stop"), "w")
except Exception as e:
logging.error('BAZARR Cannot create bazarr.stop file.')
else:
stop_file.write('')
stop_file.close()
os._exit(0)
# Reset restart required warning on start
conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c = conn.cursor()

Loading…
Cancel
Save