1👍
✅
It seems that I should not rely on the FieldFile’s implicit call to open()
. The file will automatically open itself the first time, but not after you close it.
Adding explicit calls to open()
makes it work.
p2.data_file.open('rU')
with p2.data_file:
for line in p2.data_file:
print '1: ' + line
p2.data_file.open('rU')
with p2.data_file:
for line in p2.data_file:
print '2: ' + line
Source:stackexchange.com