3

I am writing a bootstrap program that runs several individual programs simultaneously. Thus, I require each sub-program to have its own terminal window, in a manner that gives me the ability to start/stop each sub-program individually within the bootstrap.

I was able to do this on Windows using Popen and CREATE_NEW_CONSOLE (each sub-program has it's own .py file), however I am having trouble achieving this with Linux. I am using a Raspberry Pi and Python 2.7.9.

I have tried:

Subprogram = Popen([executable, 'Foo.py'], shell=True)

However this does not seem to create a new window.. and

os.system("python ./Foo.py")

Does not seem to create a new window nor allow me to terminate the process.

Other research has thus far proved unfruitful..

How can I do this? Many thanks in advance.

1
  • You could always use screen to launch them all in the same terminal window Commented May 27, 2016 at 22:54

2 Answers 2

4

I finally figured it out, but wanted to post the solution so others can find it in the future.

Subprogram = Popen(['lxterminal', '-e', 'python ./Foo.py'], stdout=PIPE)

The lxterminal is the Raspberry Pi's terminal name, -e is required, python ./Foo.py launches the python file, and stdout=PIPE displays the output on the new terminal window.

Running the above launches Foo.py in a new terminal window, and allows the user to terminate the Foo.py process if desired.

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

Comments

0

How about this?

os.system("gnome-terminal --disable-factory")

It forces it to open a new process.

1 Comment

gnome-terminal is not on raspberry pi, and (please correct me if I am wrong) I do not believe I can kill an os.system process remotely.

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.