mirror of https://github.com/morpheus65535/bazarr
Catch sooner if gevent is not installed.
This commit is contained in:
parent
377c82df52
commit
7f563449c8
|
@ -2,7 +2,20 @@
|
||||||
|
|
||||||
bazarr_version = '0.7.2'
|
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()
|
monkey.patch_all()
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
|
@ -26,10 +39,10 @@ from init import *
|
||||||
from update_db import *
|
from update_db import *
|
||||||
from notifier import update_notifier
|
from notifier import update_notifier
|
||||||
from logger import configure_logging, empty_log
|
from logger import configure_logging, empty_log
|
||||||
|
import gevent
|
||||||
from gevent.pywsgi import WSGIServer
|
from gevent.pywsgi import WSGIServer
|
||||||
from geventwebsocket import WebSocketError
|
from geventwebsocket import WebSocketError
|
||||||
from geventwebsocket.handler import WebSocketHandler
|
from geventwebsocket.handler import WebSocketHandler
|
||||||
# from cherrypy.wsgiserver import CherryPyWSGIServer
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from six import text_type
|
from six import text_type
|
||||||
from beaker.middleware import SessionMiddleware
|
from beaker.middleware import SessionMiddleware
|
||||||
|
@ -80,20 +93,6 @@ if "PYCHARM_HOSTED" in os.environ:
|
||||||
else:
|
else:
|
||||||
bottle.ERROR_PAGE_TEMPLATE = bottle.ERROR_PAGE_TEMPLATE.replace('if DEBUG and', 'if')
|
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
|
# Reset restart required warning on start
|
||||||
conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
|
|
Loading…
Reference in New Issue