简体   繁体   English

Python 中的 RTD 客户端

[英]RTD client in Python

my goal is to get the updates of an rtd server in python我的目标是在 python 中获取 rtd 服务器的更新

I've following call in excel which is working:我在 excel 中进行了以下呼叫,该呼叫正在运行:

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

For python I've found following client library: https://github.com/brotchie/pyrtd/blob/master/rtd/client.py对于 python,我发现以下客户端库: https://github.com/brotchie/pyrtd/blob/master/rtd/client.py

I tried to get a simple example where I can connect to the server我试图获得一个可以连接到服务器的简单示例

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

My first problem was that I've used 64bit python, but after I solved this I receive following exception from the connect():我的第一个问题是我使用了 64 位 python,但是在我解决了这个问题后,我从 connect() 收到了以下异常:

xrtd.xrtd error: This COM object can not automate the makepy process xrtd.xrtd 错误:此 COM object 无法自动化 makepy 过程

  • please run makepy manually for this object请为此 object 手动运行 makepy

I've no idea what I've to do now.我不知道我现在要做什么。 I've python experience but no experience with COM Objects我有 python 的经验,但没有 COM 对象的经验

Try this尝试这个

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')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM