You can add echo statements to your source code to see what happens: import parsecsv var p,q: CsvParser p.open("test_1.csv") q.open("test_2.csv") p.readHeaderRow() q.readHeaderRow() while q.readRow(): echo "while q.readRow():" while p.readRow(): echo p.rowEntry("Letters") Run $ ./t2 while q.readRow(): A B C D while q.readRow(): while q.readRow(): while q.readRow(): Run
I did that as I never used parsecsv before, so guessing may be not easy for me. With echo it is obvious: p.readRow() does its work, for each line, then is at the end of the file and does nothing any more. You may consult API docs if you can reset it to read from beginning again.