想要以批处理方式运行IBM Doors时检测到错误的用户名和/或密码

问题描述 投票:2回答:1

我正在使用Python子流程通过DXL脚本和外部变量以批处理方式启动IBM Doors。当我运行脚本时,它通常运行良好,但有时返回值为空。当我故意提供不正确的用户凭据时,还会发生其他问题。门会打开一个窗口,我想按代码关闭该窗口并写出错误,但该错误仅在手动关闭窗口后才会出现。我曾使用一个临时目录进行导出,并从Python中进行了检查,当发生更新时,我对其进行了处理,但从std读取似乎是一个更好的解决方案。


  • 可以-缓存(-k)提高可靠性(在空收益)?
  • 是否有可能在运行期间在关闭窗口之前捕获-E-DOORS:无效的用户名或密码消息和类似的错误消息,并在出现错误的情况下从代码中关闭批处理运行?

。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

使用门9.6,Python 3.6,Windows10

python error-handling subprocess ibm-doors
1个回答
0
投票

我建议在命令行语句中添加'-W'开关。可以在“ nowait” here下找到。确保大写W!

缓存比较棘手,这取决于您要执行的操作。我建议您尝试使用和不使用它,并查看您喜欢哪种行为。我没有使用它,但是我的以批处理模式运行的应用程序往往是单向的(用户正在查看DOORS数据但未写入DOORS)

© www.soinside.com 2019 - 2024. All rights reserved.