The issue is probably with the "
. You don't need to use these when passing a list of params to subprocess. It will be escaped properly before being run.
The window is closing because the generated command is probably malformed and thus generates an error and exits immediately.
So if you have the literal command you want to run, you can use shlex.split to generate the appropriate list to pass to subprocess. Usually, you just don't have to worry about quotes and escape characters. So to pass a space as an argument, just write a space.