# $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/src/obs_ctrl/py/abort.py 427 2018-02-06 16:45:14Z depa $

import sys, traceback, Ice
import argparse
import sharknir
import lbto


if __name__ == "__main__":
    try:
        ic = Ice.initialize(sys.argv)
        base = ic.stringToProxy("SimpleObsControlAdapter:default -p 10500")
        obsController = sharknir.obsControl.SequencerPrx.checkedCast(base)
        if not obsController:
            raise RuntimeError("Invalid Proxy")

        # status = obsController.setupMotion(dictNonSci, strSetupMotion)
        # print "Wheel configuration string is: {:s}".format(strSetupMotion)
        status = obsController.emergencyAbort()


    except:
        traceback.print_exc()
        status = 1

    if ic:
    # Clean up
        try:
            ic.destroy()
            print ("ABORT!")
        except:
            traceback.print_exc()
            status = 1

    sys.exit(status)
