0

Im trying to call an external python script, and so far i was able to do so successfully using:

os.system("START fileNameHere")

However right now im running in the console, and i want the contents of the other python file to be shown in the same console. ATM it shows it in a separate console.

Thanks in Advance.

1 Answer 1

1

This outta do it.

import subprocess

p = subprocess.Popen('command', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    for line in p.stdout.readlines():
        print line,
retval = p.wait()
Sign up to request clarification or add additional context in comments.

4 Comments

nope, doesnt work. The script opens in another separate window
@Larry, Works fine for me, what OS are are you using?
@Larry, Ok, Windows. The START command is listed as: "Enables a user to start a separate window in Windows from the Windows command line." Don't use it if you don't want the output to be in another window! Simply run fileNameHere and don't use START.
Great Stuff, that got it working (removing the START). Thanks

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.