Reading the gap, Tango7

The following code demonstrates how the undulator grap is read and how exceptions are printed in Tango7.

#!/usr/local/bin/python26

import time
from PyTango import *

proxy = DeviceProxy( "someHost:10000/someBL/attributemotor/gap")

time_max = -1
try:
    for n in range( 1, 1000):
	time_start = time.time()
	pos = proxy.Position
        print( "%d pos %g readout time max %g " % (n, pos, time_max))
	diff = time.time() - time_start
	if( diff > time_max):
            time_max = diff
        time.sleep(1)

except DevFailed:
    exctype , value = sys.exc_info()[:2]
    print( "Failed with exception ! " , exctype)
    for err in value:
        print( " reason" , err.reason) 
        print( " description" , err.desc)
        print( " origin" , err.origin)
        print( " severity" , err.severity)