我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用runpy._run_module_as_main()。
def run(folder): folder = os.path.abspath(folder) module = os.path.basename(folder).replace(".sikuli", "") # print("Running %s from %s" % (module, folder)) sys.path.append(folder) sys.path.append(os.path.dirname(folder)) # FIXME: adding parent is unofficial Settings.ImagePaths.append(folder) try: runpy._run_module_as_main(module) # mod = __import__(module) except KeyboardInterrupt: pass