I use my python script for pentest and I want to call another script in a new terminal. I'm getting the following error.
There was an error creating the child process for this terminal.
If I use this line with space, it only opens a new terminal with python shell but it doesn't read the path of the new script /root/Desktop/script/WPA1TKIP.py:
os.system("gnome-terminal -e python /root/Desktop/script/WPA1TKIP.py")
-
Take a look at this: code.google.com/p/wifiteBlender– Blender2013年05月03日 20:32:13 +00:00Commented May 3, 2013 at 20:32
-
1Welcome to Stack Overflow. When posting code, please indent it by four spaces to make it readable.James Scholes– James Scholes2013年05月03日 20:33:07 +00:00Commented May 3, 2013 at 20:33
-
This may help: cyberciti.biz/faq/…Dogbert– Dogbert2013年05月03日 20:35:42 +00:00Commented May 3, 2013 at 20:35
-
Have you though about accepting any answer?Léo Léopold Hertz 준영– Léo Léopold Hertz 준영2017年06月25日 09:11:11 +00:00Commented Jun 25, 2017 at 9:11
3 Answers 3
Try to quote the command you pass to -e:
os.system("gnome-terminal -e 'python /root/Desktop/script/WPA1TKIP.py'")
Otherwise the argument to -e is ony python, the rest is silently ignored by gnome-terminal.
Comments
That's because the command you are using is malformed, the command you are running contains a space character, so you need to quote the python [filename] part:
gnome-terminal -e "python /root/Desktop/script/WPA1TKIP.py"
Also, don't use os.system use subprocess. So you'll use similar commands in the end:
subprocess.call(['gnome-terminal', '-e', 'python /root/Desktop/script/WPA1TKIP.py'])
Note that in that case, subprocess takes care of the escaping, you just pass a list of parameters/command parts.
1 Comment
You do not have an executable called python on your $PATH. Are you sure that python is installed, and that $PATH includes the appropriate directory?
6 Comments
it only opens a new terminal with python shell but it doesn't read the path of the new script. But maybe that's also another issue, that's just a guess given what is given...os.system(). Were you able to get the error message that the OP describes?-e argument correctly, or he'll just get a python shell.