The following macro shows how to read a motor position and how a motor is moved:
#!/bin/env python import time import string import sys from PyTango import * proxy = DeviceProxy( "p15/motor/exp.65") if len( sys.argv) == 1: print " Position %g " % proxy.read_attribute( "Position").value sys.exit() if len( sys.argv) != 2: print "\n usage: ./move.py [pos]" sys.exit() pos = sys.argv[1] try: status = proxy.write_attribute( "Position", float( pos)) while( proxy.state() == DevState.MOVING): print " state ", proxy.state(), print "motor position %g " % proxy.read_attribute( "Position").value time.sleep(0.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 except: print sys.exc_info()[0] sys.exit() print "motor position %g " % proxy.read_attribute( "Position").value