开发者社区> 问答> 正文

如何用python 登录QC库?报错

登录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)


展开
收起
爱吃鱼的程序员 2020-06-22 14:36:02 472 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    问了一个老外,得到了答案,为什么链接会报错,原因是地址有问题,qcServer="https://10.135.55.13/qcbin/"就没问题了,哈哈

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

    回复<aclass='referer'target='_blank'>@蜡笔不小心:试过了,应该要用32位的python和win32com,不能用64位的,最开始直接用64位了,就悲剧了。应该可以把,找pywin32的64位模块安装了

    2020-06-23 11:57:52
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载