comparison libervia/server/tasks/implicit/task_brython.py @ 1250:821b6ce57f99

server (tasks/brython): log an error if brython is missing and needed
author Goffi <goffi@goffi.org>
date Mon, 27 Apr 2020 10:55:23 +0200
parents a6c7f07f1e4d
children 6d49fae517ba
comparison
equal deleted inserted replaced
1249:560d381943d8 1250:821b6ce57f99
39 f"brython file at {brython_js} doesn't has implementation " 39 f"brython file at {brython_js} doesn't has implementation "
40 f"version" 40 f"version"
41 ) 41 )
42 installed_ver = None 42 installed_ver = None
43 43
44 import brython 44 try:
45 import brython
46 except ModuleNotFoundError as e:
47 log.error('"brython" module is missing, can\'t use browser code for Brython')
48 raise e
45 ver = [int(v) for v in brython.implementation.split('.')[:3]] 49 ver = [int(v) for v in brython.implementation.split('.')[:3]]
46 if ver != installed_ver: 50 if ver != installed_ver:
47 log.info(_("Installing Brython v{version}").format( 51 log.info(_("Installing Brython v{version}").format(
48 version='.'.join(str(v) for v in ver))) 52 version='.'.join(str(v) for v in ver)))
49 data_path = Path(brython.__file__).parent / 'data' 53 data_path = Path(brython.__file__).parent / 'data'