import pylirc sockid = pylirc.init("ir_receiver") while True: code = pylirc.nextcode() if code: print code[:]