1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-27 01:57:33 +00:00
bazarr/update_modules.py

28 lines
912 B
Python
Raw Normal View History

import subprocess
from subprocess import check_output
import logging
import os
import sys
2017-12-30 05:09:51 +00:00
try:
logging.info('Installing Python modules required for Bazarr...')
2018-01-10 16:44:47 +00:00
command = sys.executable + ' -m pip --disable-pip-version-check -q -q install --user -r ' + os.path.join(os.path.dirname(__file__), 'requirements.txt')
if os.name == 'nt':
codepage = check_output("chcp", shell=True, stderr=subprocess.STDOUT)
encoding = codepage.split(':')[-1].strip()
process = check_output(command, shell=True, stderr=subprocess.STDOUT)
if os.name == 'nt':
process = process.decode(encoding)
2018-07-02 02:20:14 +00:00
except Exception as e:
logging.exception('Unable to install requirements using command line PIP.')
pass
else:
if process == "":
logging.info('Required Python modules installed if missing.')
else:
for line in process.splitlines():
logging.error(line)