You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In very rare circumstances, the write() on the TemporaryFile files with an IOError, but no error code. I tracked the bug down to the following: When using a file object with read and write mode, then you have to flush or seek, when switching between reading and writing (see http://bugs.python.org/issue3207).
To fix this here, simply reset the filestream pointer by seeking to the position returned by tell(). More specifically, in tee.py:154 add self.tmp.seek(self.tmp.tell()).
If you want to reproduce the error yourself, use the following script. The html file needs to be bigger than two chunk sizes (32KB), so a file with 45 KB should do the trick.
importunittestfromrestkit.teeimportTeeInputimportosimporttempfileclassTempfileErrorCase(unittest.TestCase):
deftest_ioerror(self):
withopen("/path/to/large/html/file", "rb") asf:
i=TeeInput(f)
for_inrange(200):
i.readline()
i.tmp.flush()
deftearDown(self):
os.remove(self.tmpfile.name)
# Guard importing as main moduleif__name__=="__main__":
unittest.main()
The text was updated successfully, but these errors were encountered:
In very rare circumstances, the write() on the TemporaryFile files with an IOError, but no error code. I tracked the bug down to the following: When using a file object with read and write mode, then you have to flush or seek, when switching between reading and writing (see http://bugs.python.org/issue3207).
To fix this here, simply reset the filestream pointer by seeking to the position returned by tell(). More specifically, in tee.py:154 add
self.tmp.seek(self.tmp.tell())
.If you want to reproduce the error yourself, use the following script. The html file needs to be bigger than two chunk sizes (32KB), so a file with 45 KB should do the trick.
The text was updated successfully, but these errors were encountered: