如何用python 登录QC库

蜡笔不小心 发布于 2013/11/07 14:09
阅读 587
收藏 0

登录QC库要加载很多插件,我查阅了部分资料,然后自己模仿写了一段,执行过程中却要报错,不知道为什么会报这样的错误,路过的大神们怎么看? 求指教

from win32com.client import Dispatch
qcServer = "https://10.135.55.13/qcbin/start_a.htm"
qcUser = "user"
qcPassword = "123456"
qcDomain = "MBB"
qcProject = "RP_IV"

def get_QCConnection(qcServer,qcUser,qcPassword,qcDomain,qcProject):
    QCConnection = Dispatch("TDApiOle80.TDConnection")
    QCConnection.InitConnectionEx(qcServer)
    QCConnection.Login(qcUser, qcPassword)
    QCConnection.Connect(qcDomain, qcProject)    
    return QCConnection

conn = get_QCConnection(qcServer,qcUser,qcPassword,qcDomain,qcProject)


执行的后出现错误为:

raceback (most recent call last):
  File "C:\Users\chenrxia\Desktop\Workspaces\PYTHON\Scripts\test.py", line 83, in <module>
    conn = get_QCConnection(qcServer,qcUser,qcPassword,qcDomain,qcProject)
  File "C:\Users\chenrxia\Desktop\Workspaces\PYTHON\Scripts\test.py", line 55, in get_QCConnection
    QCConnection.Login(qcUser, qcPassword)
  File "<COMObject TDApiOle80.TDConnection>", line 3, in Login
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, u'Invalid server response', u'<html><head><title>Apache Tomcat/5.5.9 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /qcbin/start_a.htm/servlet/tdservlet/TDAPI_GeneralWebTreatment</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/qcbin/start_a.htm/servlet/tdservlet/TDAPI_GeneralWebTreatment</u></p><p><b>description</b> <u>The requested resource (/qcbin/start_a.htm/servlet/tdservlet/TDAPI_GeneralWebTreatment) is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.5.9</h3></body></html>', 0, -2147482494), None)


加载中
0
蜡笔不小心
蜡笔不小心
问了一个老外,得到了答案,为什么链接会报错,原因是地址有问题,qcServer = "https://10.135.55.13/qcbin/" 就没问题了,哈哈
0
刁钻古怪
刁钻古怪

求教,能在64位的win7中使用吗?

刁钻古怪
刁钻古怪
回复 @蜡笔不小心 : 试过了,应该要用32位的python和win32com,不能用64位的,最开始直接用64位了,就悲剧了。
蜡笔不小心
蜡笔不小心
应该可以把,找pywin32 的64位模块安装了
返回顶部
顶部