pforma_io.py 文件源码

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

项目:PH5 作者: PIC-IRIS 项目源码 文件源码
def run_cmds (self, cmds, x = 0, ems = None) :
        '''
            Run conversion commands in a subprocess
            cmds -> A dictionary of families that point to a list of commands.
                    cmds['B']['125a2ph5 -n master.ph5 ...', '1302ph5 -n master.ph5 ...']
            x -> The sequence of the current command executing in the list in cmds.
            ems -> The list of families ['A', 'B', 'C' etc]
        '''
        pees = {}
        if ems == None :
            ems = self.nmini
        else :
            ems = [ems]
        #for inst in ('texan', 'rt-130', 'nodal') :
        for m in ems :
            if len (cmds[m]) > x :
                insts = cmds[m][x]
                pees[m] = subprocess.Popen (insts, 
                                            shell=True, 
                                            bufsize=-1,
                                            cwd=os.path.join (self.home, m),
                                            stdout=subprocess.PIPE,
                                            stderr=subprocess.PIPE)

            else :
                pees[m] = None
        if len (ems) > 1 :
            return pees, x
        else :
            return pees[m], x
    #
    ###   Should this be implemented as a closure?
    #
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号