views:

31

answers:

1

Hello,

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.

A: 

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()
Anders
nope, doesnt work. The script opens in another separate window
Larry
@Larry, Works fine for me, what OS are are you using?
Anders
@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`.
Anders
Great Stuff, that got it working (removing the START). Thanks
Larry