コード例 #1
0
ファイル: console.py プロジェクト: vxgmichel/python-sequence
def main():
    """  Main function for console execution """
    # Parse arguments
    file_name, depth, backup, debug_level = parse_command_line_args()
    # Create Log Handler
    stream_sequence_logs(sys.stdout, debug_level)
    # Load sequence
    engine = SequenceEngine()
    try:
        engine.load(file_name, depth, backup)
    except Exception as exc:
        print(exc)
        return
    # Wait for input
    try:
        res = raw_input("Press 'r' to run, any other key to abort: ")
    except KeyboardInterrupt:
        res = 'a'
    if res.lower() == 'r':
        print("RUN")
        engine.start()
        boolean = False
        while not boolean:
            try:
                boolean = engine.wait(1)
            except KeyboardInterrupt:
                print("USER STOP")
                engine.interrupt()
        print("FINISHED")