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
This is visible in the standard tests. Error does not occur for Pillow 7.0.0. This may have to do with the rewrite of png files in Pillow. The error that occurred with Pillow 7.1.0 was python-pillow/Pillow#4518, for which a fix was released with Pillow 7.1.1. In the new version, the error message has changed to:
def test_gif_writer():
grid = make_pupil_grid(256)
mw = GifWriter('test.gif')
for i in range(25):
field = Field(np.random.randn(grid.size), grid)
plt.clf()
imshow_field(field)
mw.add_frame()
> mw.close()
tests\test_plotting.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
hcipy\plotting\animation.py:139: in close
self.convert()
hcipy\plotting\animation.py:132: in convert
return self.convert_to_gif(self.filename, self.path_to_frames, self.framerate, num_files_to_convert=self.num_frames)
hcipy\plotting\animation.py:125: in convert_to_gif
loop=0)
C:\ProgramData\Anaconda3\lib\site-packages\PIL\Image.py:2134: in save
save_handler(self, fp, filename)
C:\ProgramData\Anaconda3\lib\site-packages\PIL\GifImagePlugin.py:499: in _save_all
_save(im, fp, filename, save_all=True)
C:\ProgramData\Anaconda3\lib\site-packages\PIL\GifImagePlugin.py:510: in _save
if not save_all or not _write_multiple_frames(im, fp, palette):
C:\ProgramData\Anaconda3\lib\site-packages\PIL\GifImagePlugin.py:430: in _write_multiple_frames
for im_frame in ImageSequence.Iterator(imSequence):
C:\ProgramData\Anaconda3\lib\site-packages\PIL\ImageSequence.py:49: in __next__
self.im.seek(self.position)
C:\ProgramData\Anaconda3\lib\site-packages\PIL\PngImagePlugin.py:748: in seek
self._seek(f)
C:\ProgramData\Anaconda3\lib\site-packages\PIL\PngImagePlugin.py:784: in _seek
ImageFile._safe_read(self.fp, self.__prepare_idat)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
fp = <_io.BufferedReader name='test.gif_frames\\00000.png'>, size = 8192
def _safe_read(fp, size):
"""
Reads large blocks in a safe way. Unlike fp.read(n), this function
doesn't trust the user. If the requested size is larger than
SAFEBLOCK, the file is read block by block.
:param fp: File handle. Must implement a <b>read</b> method.
:param size: Number of bytes to read.
:returns: A string containing up to <i>size</i> bytes of data.
"""
if size <= 0:
return b""
if size <= SAFEBLOCK:
> return fp.read(size)
E ValueError: read of closed file
C:\ProgramData\Anaconda3\lib\site-packages\PIL\ImageFile.py:549: ValueError
I'm not sure yet whether this is a bug in HCIPy or in Pillow.
The text was updated successfully, but these errors were encountered:
Bug was in Pillow, and was fixed already but not yet released. python-pillow/Pillow#4543 suggested a workaround that seems to work fine for all platforms.
This is visible in the standard tests. Error does not occur for Pillow 7.0.0. This may have to do with the rewrite of png files in Pillow. The error that occurred with Pillow 7.1.0 was python-pillow/Pillow#4518, for which a fix was released with Pillow 7.1.1. In the new version, the error message has changed to:
I'm not sure yet whether this is a bug in HCIPy or in Pillow.
The text was updated successfully, but these errors were encountered: