2013-04-29 87 views
2

我设计使用pythonqt的接口,当我尝试使用os.system,接口冻结打电话给我的程序。Python的OS故障

def pairClicked(self,exp1,exp2): 
     os.system("""cd kat 
        ./run -v pair""") #in the terminal i used to call my python interface, it runs this commands 
     os.system(exp1+" "+expr2) #but here nothing happens 

一旦我杀程序的终端说,(在exp1=t1exp2=t2情况下):

sh 1: t1 not found 
sh 2: t2 not found 

任何IDEIA /什么IAM做错了建议吗? 请注意,这是我第一次做这类事情。

编辑:

我已经编辑和使用这段代码,而不是

p=subprocess.Popen(['cd','kat','./run', '-pair', str(test.__len__()),expr1Text,expr2Text],stdout=subprocess.PIPE,shell=True) 
out= p.communicate() 
print(out) 

但它返回('',None)。 我认为这个问题是我使用的命令一样cd kat ./run -pair *len* expr1 expr2代替:

如何使用子进程作出新的生产线?

+0

'run'是什么? – Blender 2013-04-29 02:25:36

回答

1

这听起来像./run阻止。

您可能需要产生一个异步子进程或可能使用另一个线程,因此您的GUI可以在./run运行时继续工作。