【问题标题】:RTD client in PythonPython 中的 RTD 客户端
【发布时间】:2023-03-08 17:07:01
【问题描述】:

我的目标是在 python 中获取 rtd 服务器的更新

我在 excel 中进行了以下调用:

=RTD("xrtd.xrtd";;"EUCA")

对于 python,我发现了以下客户端库:https://github.com/brotchie/pyrtd/blob/master/rtd/client.py

我尝试了一个可以连接到服务器的简单示例

import sys
sys.path.append(".")
from client import RTDClient 
name = "xrtd.xrtd"

try:
    client = RTDClient(name)
    client.connect(False)
    client.register_topic('EUCA')

except Exception as identifier:
    print(str(name) + " error : " + str(identifier))

我的第一个问题是我使用了 64 位 python,但在我解决了这个问题后,我从 connect() 收到以下异常:

xrtd.xrtd 错误:此 COM 对象无法自动执行 makepy 过程

  • 请为此对象手动运行 makepy

我不知道我现在要做什么。我有 Python 经验,但没有 COM 对象经验

【问题讨论】:

  • 它可能关心的人,这个库写在python2
  • 我已经将库移植到 python3 只是一些修改

标签: python excel rtd


【解决方案1】:

试试这个

import pythoncom
from rtd import RTDClient

if __name__ == '__main__':
    time = RTDClient('xrtd.xrtd')
    time.connect()
    time.register_topic('EUCA')

    while 1:
        pythoncom.PumpWaitingMessages()

        if time.update():
            print time.get('EUCA')

【讨论】:

猜你喜欢
  • 2021-03-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-07-10
  • 1970-01-01
  • 2011-04-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多