Python操作系统故障

2024-09-25 02:38:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我用pythonqt设计接口,当我试图用os.system调用我的程序时,接口冻结。在

 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=t1和{}的情况下):

^{pr2}$

对我做错了什么有什么想法/建议吗? 请注意,这是我第一次做这种事。在

编辑:

我编辑并使用了这段代码

 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这样的命令,而不是:

cd kat
./run -pair *len*
expr1
expr2

如何使用子流程生成新行?在


Tags: run程序编辑lenoscdoutsystem