From f7c1ebdd8c53d2c7ca6ab4accb545e23bc3c1659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Mon, 27 Jul 2020 09:18:13 -0400 Subject: [PATCH] Fix for restart after requirements installation. --- bazarr/init.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bazarr/init.py b/bazarr/init.py index e2f37336a..21c0cc2cc 100644 --- a/bazarr/init.py +++ b/bazarr/init.py @@ -1,6 +1,7 @@ # coding=utf-8 import os +import io import rarfile import json import hashlib @@ -59,10 +60,14 @@ if not args.no_update: stdout=subprocess.PIPE, stderr=subprocess.PIPE) logging.info('BAZARR requirements installed.') try: - from server import webserver - webserver.restart() - except: - logging.info('BAZARR unable to restart. Please do it manually.') + restart_file = io.open(os.path.join(args.config_dir, "bazarr.restart"), "w", encoding='UTF-8') + except Exception as e: + logging.error('BAZARR Cannot create bazarr.restart file: ' + repr(e)) + else: + logging.info('Bazarr is being restarted...') + restart_file.write(str('')) + restart_file.close() + os._exit(0) # create random api_key if there's none in config.ini if not settings.auth.apikey or settings.auth.apikey.startswith("b'"):