On Apr 28, 7:37 am, Bart <[EMAIL PROTECTED]> wrote: > Hi everyone! > > Im using module that gives errors to stderr/stdout (generated by SWIG) > Problem is that I need to parse this errors/information from module. > > os.popen3 looks nice but this executes command not function. > > Is there any solution? > > Best regards > Bart.
Maybe something like this: moduleA.py: ----------- def someFunc(): print "hello" raise ValueError someFunc() ---------- import subprocess print "Main executing" try: p = subprocess.Popen(["python", "6test.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) result = p.wait() if result == 0: print "output:", p.stdout.read() else: print "output before error:", p.stdout.read() print "error:", p.stderr.read() except (OSError, TypeError, ValueError), e: print "subprocess was never started" print e -- http://mail.python.org/mailman/listinfo/python-list