RTD client in Python

Viewed 3022

my goal is to get the updates of an rtd server in python

I've following call in excel which is working:

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

For python I've found following client library: 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():

xrtd.xrtd error : This COM object can not automate the makepy process

  • please run makepy manually for this object

I've no idea what I've to do now. I've python experience but no experience with COM Objects

1 Answers

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