from PyTango import * import sys import time def read_format(values): t1 = DeviceProxy(sys.argv[1]) info = t1.get_attribute_config(sys.argv[2]) print "Current format for attribute" print sys.argv[2] print "in device" print sys.argv[1] print " " print info.format def write_format(values): print values t1 = DeviceProxy(sys.argv[1]) info = t1.get_attribute_config(sys.argv[2]) info.format = str(sys.argv[3]) t1.set_attribute_config_ex([info]) # # main # try : if( len( sys.argv) == 1 ): print "Usage:" print "->for changing format" print "python set_attribute_display_format.py device_name atribute_name new_format" print "new_format with sintax like %6.2f for float or %6d for integer." print "Ex." print "python set_attribute_display_format.py line1/exp/por2 Atribute2 %6.1f" print "->for getting current format" print "python set_attribute_display_format.py device_name atribute_name" elif( len( sys.argv) == 3 ): read_format(sys.argv) elif( len( sys.argv) == 4 ): write_format(sys.argv) except : print "Failed with exception !" print sys.exc_info()[0]