main.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:exoduscli 作者: cthlo 项目源码 文件源码
def _run_exodus(*args):
    '''Run a Exodus using runpy
    '''
    fullpath = path.join(config.addonsdir, config.exodus['id'], config.exodus['entryfile'])
    entrypath, entryfile = path.split(fullpath)
    if entrypath not in sys.path:
        sys.path.insert(0, entrypath)
    module, _ = path.splitext(entryfile)

    # Exodus assumes thread names start at 1
    # and gets provider names from the thread name
    c = threading._counter = count().next
    c() # consume 0

    sys.argv = list(args)
    # note: cannot use __import__ because Exodus spawns threads that do import
    # so that would cause deadlock
    old_modules = set(sys.modules.keys()) # unload the newly added modules after runpy
    runpy.run_module(module)
    for k in set(sys.modules.keys()) - old_modules:
        del sys.modules[k]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号