I have a python script where i am calling another script using subprocess as below.
sp = subprocess.Popen("script.py --arg1 --arg2', cwd=GIVEN_PATH, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while sp.poll() is None:
for out in iter(sp.stdout.readline,''):
self.log(out.rstrip())
This is working fine for me but i want to get any exception from the script.py. I know we can get the retcode but i actually need to get the full exception information.
If script.py raises
raise IOERROR("got an exception")
then i need to know this information. simailar way we get the sys.exc_info() etc.
is there a way i can do this?
Thanks in Advance