9 raise RuntimeError(
'Please specify tutorial file path as only argument of this script')
12file_path = os.path.expanduser(sys.argv[1])
13sys.argv.remove(sys.argv[1])
15if os.path.exists(file_path):
18 module_name =
"__main__"
22 ROOT.gROOT.SetBatch(
True)
25 sys.dont_write_bytecode =
True
28 if sys.version_info >= (3,5):
30 spec = importlib.util.spec_from_file_location(module_name, file_path)
31 module = importlib.util.module_from_spec(spec)
32 sys.modules[module_name] = module
33 spec.loader.exec_module(module)
36 imp.load_module(module_name, open(file_path,
'r'), file_path, (
'.py',
'r',1))
38 raise RuntimeError(
'Cannot execute test, {} is not a valid tutorial file path'.format(file_path))