2

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

ben.pal
  • 21
  • 1

1 Answers1

0

I would suggest adding the '-W' switch to your command-line statement. This can be found under 'nowait' here. Make sure you capitalize the W!

Caching is trickier- it depends what you are trying to do. I would suggest trying it with and without and seeing which behavior you prefer. I don't use it, but my applications running in batch mode tend to be uni-directional (the user is looking at DOORS data but not writing to DOORS)

Russell Bregman
  • 436
  • 3
  • 8
  • Thanks for the answer. I tried the -W but sadly doesn't seem to solve the problem. The run still ends up in a black empty Doors window. – ben.pal Feb 04 '20 at 13:00
  • It seems like, changing the "-osuser" to "-u username -P passw" solved the problem and the error message returns to the standard output. Now, the -W is working as well. – ben.pal Feb 04 '20 at 14:01