终端执行和popen的区别
difference between terminal execution and popen
在我的 ubuntu 终端中键入命令可识别我命令中的参数 t
:
/home/daniel/Downloads/SALOME-7.6.0-UB14.04/salome start -t
通过 Popen 在 python 中启动相同的进程有什么区别?
command ='/home/daniel/Downloads/SALOME-7.6.0-UB14.04/salome'
commandargs= 'start -t'
import subprocess
subprocess.Popen([command, commandargs], shell=True).wait()
我的参数代表终端模式,但 运行 我的应用程序 (salome) 通过 python Popen 打开 GUI。
参见:https://docs.python.org/3.5/library/subprocess.html#subprocess.Popen
args should be a sequence of program arguments or else a single string.
另见:
subprocess.Popen([command, commandargs.split(' ')], shell=True).wait()
您也可以这样做,但不太推荐:
subprocess.Popen(command + commandargs, shell=True).wait()
应该可以解决问题
在我的 ubuntu 终端中键入命令可识别我命令中的参数 t
:
/home/daniel/Downloads/SALOME-7.6.0-UB14.04/salome start -t
通过 Popen 在 python 中启动相同的进程有什么区别?
command ='/home/daniel/Downloads/SALOME-7.6.0-UB14.04/salome'
commandargs= 'start -t'
import subprocess
subprocess.Popen([command, commandargs], shell=True).wait()
我的参数代表终端模式,但 运行 我的应用程序 (salome) 通过 python Popen 打开 GUI。
参见:https://docs.python.org/3.5/library/subprocess.html#subprocess.Popen
args should be a sequence of program arguments or else a single string.
另见:
subprocess.Popen([command, commandargs.split(' ')], shell=True).wait()
您也可以这样做,但不太推荐:
subprocess.Popen(command + commandargs, shell=True).wait()
应该可以解决问题