def main(): config = ConfigParser() config.read(expanduser("~/.wn.conf")) wndb = WNDB(path=expanduser(config['Database']['path'])) interpreter = Interpreter() telegram = Telegram(config, interpreter) scheduler = Scheduler(wndb, telegram) thread = Thread(target=scheduler.run) thread.start() while True: try: sleep(.1) except (KeyboardInterrupt, SystemExit): break scheduler.shutdown() thread.join() telegram.shutdown() interpreter.shutdown()