Use the select
module in Python's standard library, see http://docs.python.org/library/select.html . select.select([p.stdout.fileno()], [], [], 0)
immediately returns a tuple whose items are three lists: the first one is going to be non-empty if there's something to read on that file descriptor.