def main(): # Config: app name (defaults to $0) config = Config('beeper.py') # define what keys to read from settings / optional cli args # if options are not provided by cli args, then they MUST be in the # config. # # -'s in names are read in python as _'s # types are optional, but useful for argparse config.option('beep-rate', type=float) config.option('boop-rate', type=float) # parses args, loads the config file, gets options, throws errors # if options not satisfied config.retrieve() socket = pub(*config.uris) # can now read config values as proprties of the Config instance beep_thread('beep', socket, config.beep_rate).start() beep_thread('boop', socket, config.boop_rate).start() print 'URIs: ' + str(config.uris) try: while True: sleep(10) except KeyboardInterrupt: print " keyboard interrupt, exiting."
def main(): print('Binding socket...') sender = Sender(pub('tcp://127.0.0.1:9999'), 'test') print('Done.') print('Entering send loop...') loop(sender, 3.0)