i have a function which calls os.popen this works just fine: p = os.popen(stmt, "r") print p.readline() however, this does not: p = os.popen(stmt, "r") print p.readline() while 1: line = p.readline() print line oh and this works too: p = os.popen(stmt, "r") line = p.readline() print line so i can do readline outside of the while loop but inside a while loop it returns a null value and then breaks out (according to the logic i wrote)