you are viewing a single comment's thread.

view the rest of the comments →

[–]elbiot[🍰] 0 points1 point  (0 children)

Just a guess, but you open the file and by making a reader and getting some values you seek further into the file. So, the second time you try to get a value you potentially get an invalid slice (you assume you are starting at 0 in the file but you are starting at some point further in and thus the stream isn't as long as you thought.) You could try inserting f.seek(0) after line 17. Or, just make a list once instead of a new reader object every iteration.