通过python获取Phantomjs的进程ID

通过python获取Phantomjs的进程ID,python,phantomjs,Python,Phantomjs,我一直在运行python脚本,以这种方式运行phatomjs命令: cmd=“phantomjs--ignore ssl errors=yes rasterize.js input-output” 状态,输出=命令。getstatusoutput(cmd) 状态和输出良好 我想得到phantomJS进程的PID。 有什么方法可以做到这一点吗?您可以在这里使用子压力模块: import subprocess cmd="phantomjs --ignore-ssl-errors=yes raster

我一直在运行python脚本,以这种方式运行phatomjs命令:

cmd=“phantomjs--ignore ssl errors=yes rasterize.js input-output”

状态,输出=命令。getstatusoutput(cmd)

状态和输出良好

我想得到phantomJS进程的PID。
有什么方法可以做到这一点吗?

您可以在这里使用子压力模块:

import subprocess
cmd="phantomjs --ignore-ssl-errors=yes rasterize.js input output"
proc = subprocess.Popen([cmd])
print "PID of running process::", proc.pid