Reputation: 239
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.
Upvotes: 0
Views: 582
Reputation: 6218
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()
Upvotes: 1