New submission from Graham Coster <graham_coster...@yahoo.co.uk>:
Hi there, As demonstrated in the attached script, I found that a StopIteration exception occurs once a SpooledTemporaryFile has been rolled over from memory to disk, even though seek(0) had move the file position to the top of the file. I had previously been using a TemporaryFile, which wrote directly to disk, without any issues. However, once I swapped to a SpooledTemporaryFile, the StopIteration exception started to appear. I'm guessing the problem relates to the csv reader having an Iterator that is no longer looking at the correct file after the SpooledTemporaryFile is rolled-over. I found that instantiating a new csv reader post roll-over works around the problem. I had expected that I could just swap from a TemporaryFile to a SpooledTemporaryFile with no change to behaviour. However, if this is not the case, perhaps the SpooledTemporaryFile documentation should explicitly state this. Cheers, Graham. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38625> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com