Xterm using python subprocess

Hi,

I am trying to run a shell script using subprocess in python.
I can run simple script with arguments using subprocess.But I am not able to embed xterm in subrocess command.

#!/usr/bin/python
import subprocess
subprocess.call(["xterm -e","./script.sh", fname2])

Above code gives me error.
Please help me in syntax

Thanks and Regards

I have no idea what fname2 is but

Try:-

subprocess.call(["xterm", "-e", "./script.sh", fname2])

OR...

subprocess.call(["/full/path/to/xterm", "-e", "/full/path/to/script.sh", fname2])
1 Like

Thanks man it works