Subprocess wont take the output of dxl script

Question!

Im using Python's subprocess module to run a dxl script. My Problem is when i try to catch the Output (In this example a print-statement or a error message) of my dxl script, it is shown in the command prompt, but when i try to catch it with stdout=subprocess.PIPE or subprocess.check_output it always returns an empty string. Is there a way to catch the output or how could I get the Error messages from Doors? It's important that you dont see the GUI of DOORS.

Here is my quick example that shows my problem:

test.dxl

print "Hello World"

test.py

import subprocess
doorsPath = "C:\\Program Files (x86)\\IBM\\Rational\\DOORS\\9.5\\bin\\doors.exe"
userInfo = ' -user dude -password 1234 -d 127.0.0.1 -batch ".\\test.dxl"'
dxl = " -W"

output = subprocess.check_output(doorsPath+dxl+userInfo)
print(output)

Edit: Using Windows 7 , DOORS 9.5 and Python 2.7

By : TooBroke


Answers

your script have many error try this link for example for subprocess

and try this :

import subprocess
import sys

path = "C:\\Program Files(x86)\\IBM\\Rational\\DOORS\\9.5\\bin\\doors.exe"
userInfo = "C:\\Program Files (x86)\\IBM\\Rational\\DOORS\\9.5\\bin\\doors.exe"

proc = subprocess.Popen([path,userInfo,"-W"])
proc.communicate()

i hape it work on your system!



This video can help you solving your question :)
By: admin