except PhidgetException, e: print "Phidget Error %i: %s" % (e.code, e.message) exit(1) print "Opening phidget object...." try: encoder.openPhidget() except PhidgetException, e: print "Phidget Error %i: %s" % (e.code, e.message) exit(1) print "Waiting for attach...." try: encoder.waitForAttach(10000) except PhidgetException, e: print "Phidget Error %i: %s" % (e.code, e.message) try: encoder.closePhidget() except PhidgetException, e: print "Phidget Error %i: %s" % (e.code, e.message) exit(1) exit(1) else: displayDeviceInfo() print "Press Enter to quit...." chr = sys.stdin.read(1)