I have a python program that will create and execute another python script in a new terminal. To do so, I'm using subprocess.Popen. I'm trying to get the PID of the new process using .pid. However, the value of this pid doesn't seem to match the real pid of the newly created process (the two values don't match).
Here's a sample of my code:
from subprocess import Popen
p = Popen("gnome-terminal -e 'python'",shell = True)
According to the documentation.
If you set the shell argument to
True, this is the process ID of the spawned shell.
So you'll need