Q:

OpenOPC timeout error

I am using python and OpenOPC to connect to a SCADA server.  My tags read OK
except after a random number of reads (anywhere between 30 and 50) I get
a timeout error.
File"test7.py", line 12 in <module>
value=opc.read(group='mygroup')
File "C:\OpenOPC\src\OpenOPC.py" line 619, in read
    return list(results)
File "C:\OpenOPC\src\OpenOPC.py" line 537, in iread
raise TimeoutError, 'Callback:Timeout waiting for data'
OpenOPC.TimeoutError:Callback: Timeout waiting for data

Is there anyone experienced with OpenOPC that might know how to resume
on the error, or ignore the error and continue.  I don't mind missing 
the odd value as long as the program does not crash.
#!C:\Python27\python.exe
import OpenOPC

opc = OpenOPC.client()
import datetime, threading, time
opc.connect('Citect.OPC.1')
tags = ['Loop_3_SP']
opc.read(tags, group='mygroup', update=1)
while True:
  value = opc.read(group='mygroup')
  print value
  time.sleep(10)

A:

You could just surround your code by a try catch block like this:
#!C:\Python27\python.exe
import OpenOPC

opc = OpenOPC.client()
import datetime, threading, time
opc.connect('Citect.OPC.1')
tags = ['Loop_3_SP']
opc.read(tags, group='mygroup', update=1)
while True:
  try:
     value = opc.read(group='mygroup')
     print value
  except OpenOPC.TimeoutError:
     print "TimeoutError occured"

  time.sleep(10)

This should catch the Error and only print that it occured. If you don't want that anything happens in case of the TimeoutError, just user pass instead of the print statement.

