I'm using a Python sub-process to start IBM Doors in batch mode with a DXL script and an outside variable. When I run the script usually it runs fine, but sometimes the return value is empty. Other problem occurs when I purposely give incorrect user credentials. Doors opens a window which I'd like to close by the code and write out the error but, the error appears only after closing the window by hand. I had used a temporary directory for exports which I checked from Python and when an update happened I handled it, but reading from std out seemed to be a better solution.
- Can -caching (-k) increase reliability (in case of the empty returns)?
- Is it possible to catch -E- DOORS: Invalid username or password massage and similar error massages during the run before closing the window and close the batch run from code in case of an error?
.py
import subprocess
import os
if __name__ == '__main__':
script_name = 'demo_dummy_script.dxl'
filename = os.path.join(os.path.dirname(os.path.realpath('__file__')), script_name)
var = "apple"
proc = subprocess.Popen(r'"C:\Program Files\IBM\Rational\DOORS\bin\doors.exe"'
r' -dxl "string myVar = \"'
+ var +
r'\"" -b '
+ filename +
r' -osuser',
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout = proc.communicate()
encoding = 'utf-8'
print(stdout[0].decode(encoding).split())
.dxl
cout << myVar
Using Doors 9.6, Python 3.6, Windows10