def main():
my_name = os.path.basename(sys.argv[<NUM_LIT:0>])<EOL>if not my_name:<EOL><INDENT>my_name = "<STR_LIT>"<EOL><DEDENT>syslog.openlog(my_name, syslog.LOG_PID, syslog.LOG_LOCAL0)<EOL>global args<EOL>args = parse_args()<EOL>args_fixup()<EOL>global hsm<EOL>try:<EOL><INDENT>hsm = pyhsm.YHSM(device = args.device, debug = args.debug)<EOL><DEDENT>except serial.SerialException as e:<EOL><INDENT>my_log_message(args, syslog.LOG_ERR, '<STR_LIT>' %(args.device, e))<EOL>return <NUM_LIT:1><EOL><DEDENT>write_pid_file(args.pid_file)<EOL>try:<EOL><INDENT>run()<EOL><DEDENT>except KeyboardInterrupt:<EOL><INDENT>print("<STR_LIT>")<EOL>print("<STR_LIT>")<EOL>print("<STR_LIT>")<EOL><DEDENT>
The main function that will be executed when running this as a stand alone script.