python read stdout line by line