0

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")    
4
  • Take a look at this: code.google.com/p/wifite Commented May 3, 2013 at 20:32
  • 1
    Welcome to Stack Overflow. When posting code, please indent it by four spaces to make it readable. Commented May 3, 2013 at 20:33
  • This may help: cyberciti.biz/faq/… Commented May 3, 2013 at 20:35
  • Have you though about accepting any answer? Commented Jun 25, 2017 at 9:11

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

i will tray it ty "subprocess"
0

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 does run Python, but not the file because the filename is passed to gnome-terminal and not python (because of the missing quotes).
Are you sure it runs python? The error message he quoted is what gnome-terminal prints when the exec fails.
I tried it, and that's what happened. Also, this is what OP said: 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...
Right, but then he contradicted himself by saying, "I'm getting the error "There was an error creating the child process for this terminal"". Either he got the error, or he got the python shell, but he could not have gotten both from the same call to os.system(). Were you able to get the error message that the OP describes?
And yes, of course, he needs to quote -e argument correctly, or he'll just get a python shell.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.