import os import subprocess class PeterPan: def __init__(self,attributes=None): self.attributes = attributes #def init def execute_python_dir(self,dir,NEVERLAND_VAR=None,ARGV=None): ''' In this case NEVERLAND_VAR can to be list ''' list=os.listdir(dir) list.sort() for item in list: if os.path.isfile(dir+"/"+item): execfile(dir+"/"+item,locals()) #def execute_dir def execute_binary_dir(self,dir,NEVERLAND_VAR=""): list=os.listdir(dir) list.sort() for item in list: subprocess.Popen([dir+"/"+item,NEVERLAND_VAR],stdout=subprocess.PIPE) #def execute_binary_dir #class PeterPan if __name__=="__main__": pp=PeterPan() pp.execute_binary_dir("/home/hector/test")