从詹金斯运行CANoe时访问拒绝错误

时间:2020-04-04 11:52:00

标签: python jenkins canoe

我正在尝试在詹金斯(Jenkins)的CANoe中运行自动测试。我使用CANoe COM界面编写了python脚本。它可以在本地计算机(配置为Jenkins从站)中的命令行下正常工作。但是,当我尝试从Jenkins调用python脚本时,出现了以下错误。

Traceback (most recent call last):
  File "automatic_test.py", line 165, in <module>
    app = CanoeSync()
  File "automatic_test.py", line 23, in __init__
    app = win32com.client.gencache.EnsureDispatch("CANoe.Application")
  File "C:\Python27\lib\site-packages\win32com\client\gencache.py", line 527, in EnsureDispatch
    disp = win32com.client.Dispatch(prog_id)
  File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147024891, 'Access is denied.', None, None)

其他信息:CANoe版本:11.0SP2; Python版本:2.7 ;。 Jenkins帐户也是从计算机的管理员帐户。 python脚本在本地的Jenkins帐户中正常工作。

非常感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

最后,问题已解决!这是一个权限问题。请尝试使用Win32com codes not working on IIS中的解决方案,并记住添加您的Jenkins用户名并设置完全权限。

答案 1 :(得分:0)

即使在按照 Win32com codes not working on IIS 中提到的步骤尝试从 Jenkins 启动 CANoe 应用程序时,我也面临同样的问题。如果我从 CMD 执行脚本它工作正常,但在使用我的用户 ID 从 jenkins 启动时观察到问题 在CANoe中是否也有什么具体的设置要完成

File "C:\Program Files (x86)\Python279\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147467238, 'The server process could not be started because the configured identity is incorrect. Check the username and password.', None, None)