timxx / pywpsrpc

Python bindings for WPS Office RPC (for Linux)
MIT License
219 stars 44 forks source link

调用CompareDocuments进行文件比较出现参数类型错误 #56

Closed qbmzc closed 1 year ago

qbmzc commented 1 year ago

Describe the bug 通过Documents.Open()方法返回的文档类型为wpsapi._Document,而CompareDocuments需要的参数类型为wpsapi.Document

To Reproduce

    def _handle_result(hr):
        if abort_on_fails and hr != S_OK:
            raise ConvertException("open file failed", hr)

    hr, ori_doc = docs.Open(original_file, PasswordDocument='xxx', ReadOnly=True)
    if hr != S_OK:
        return _handle_result(hr)
    hr, rev_doc = docs.Open(revised_file, PasswordDocument='xxx', ReadOnly=True)
    if hr != S_OK:
        return _handle_result(hr)
    print(type(ori_doc))
    hr, act_doc = app.CompareDocuments(ori_doc, rev_doc)

Expected behavior

应该怎么样才能获取正确的Document类型

Screenshots

202210191535729

Environment

timxx commented 1 year ago

真的是1.0.2的版本吗,好旧了😅 看了下c++ sdk参数传的就是document,不过这个是空壳,python转成了下划线的,还得研究研究怎么处理

qbmzc commented 1 year ago

真的是1.0.2的版本吗,好旧了😅 看了下c++ sdk参数传的就是document,不过这个是空壳,python转成了下划线的,还得研究研究怎么处理

版本是2.3.1,😅 wps是11.1.0.11664

verydemo commented 1 year ago

@qbmzc 搞定了么?

qbmzc commented 1 year ago

@qbmzc 搞定了么?

还没有

verydemo commented 1 year ago

image 同样的问题, 版本 2.3.3 @timxx 有解决的办法么

mjTree commented 1 year ago

@timxx 这个issue有规避方案不?

mjTree commented 1 year ago

@timxx 看到五一节作者还在更新👍👍,不过我这边测试后虽然没有类型报错,但CompareDocuments方法好像没有驱动sdk做word文件比较,返回结果是(-2147417851, None)。 pywpsrpc版本:pypi的2.3.4/自己编译的2.3.4 ubuntu: 20.04版本 wps-version: v11.1.0.10920-release

timxx commented 1 year ago

这个应该是Linux客户端的BUG,我试了C++ SDK直接调用也是不行的。。建议给官方反馈。。

mjTree commented 1 year ago

这个应该是Linux客户端的BUG,我试了C++ SDK直接调用也是不行的。。建议给官方反馈。。

尝试了其他方法也可以,谢谢作者。