def main(): user = raw_input('QQ:') pwd = getpass.getpass('Password: ') qq = WebQQ(user, pwd) qq.on_gotmsg = reply_qq qq.login() while 1: time.sleep(0.5) try: qq.step() except KeyboardInterrupt: print "CTRL+C met, exit!" return except Exception as e: print "Error : ", e