CMS 3D CMS Logo

processFromFile.py
Go to the documentation of this file.
1 import sys
2 import types
3 from importlib.machinery import SourceFileLoader
4 
5 def processFromFile(filename, args=None):
6  old_sys_argv = None
7  if args is not None:
8  old_sys_argv = sys.argv[:]
9  sys.argv = [filename]+args
10 
11  loader = SourceFileLoader("pycfg", filename)
12  mod = types.ModuleType(loader.name)
13  loader.exec_module(mod)
14  process = mod.process
15 
16  if old_sys_argv is not None:
17  sys.argv = old_sys_argv
18 
19  return process
def processFromFile(filename, args=None)