New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOError: cannot identify image file #69

Closed
ghost opened this Issue Feb 4, 2014 · 7 comments

Comments

3 participants
@ghost

ghost commented Feb 4, 2014

I've started the build with debug parameters, the output is:

Traceback (most recent call last):
  File "/usr/local/bin/sigal", line 9, in 
    load_entry_point('sigal==0.6.0', 'console_scripts', 'sigal')()
  File "/usr/local/lib/python2.7/dist-packages/sigal/__init__.py", line 154, in main
    parser.dispatch()
  File "/usr/local/lib/python2.7/dist-packages/argh/helpers.py", line 53, in dispatch
    return dispatch(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/argh/dispatching.py", line 124, in dispatch
    for line in lines:
  File "/usr/local/lib/python2.7/dist-packages/argh/dispatching.py", line 200, in _execute_command
    for line in result:
  File "/usr/local/lib/python2.7/dist-packages/argh/dispatching.py", line 183, in _call
    result = args.function(*positional, **keywords)
  File "/usr/local/lib/python2.7/dist-packages/sigal/__init__.py", line 109, in build
    gal.build()
  File "/usr/local/lib/python2.7/dist-packages/sigal/gallery.py", line 239, in build
    process_file(files)
  File "/usr/local/lib/python2.7/dist-packages/sigal/gallery.py", line 311, in process_file
    return process_image(*args[1:])
  File "/usr/local/lib/python2.7/dist-packages/sigal/image.py", line 136, in process_image
    generate_image(filepath, outname, settings, options=options)
  File "/usr/local/lib/python2.7/dist-packages/sigal/image.py", line 64, in generate_image
    img = PILImage.open(source)
  File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 2025, in open
    raise IOError("cannot identify image file")
IOError: cannot identify image file

I have no idea, what cause the problem :)

@ghost

This comment has been minimized.

ghost commented Feb 10, 2014

This issue can be closed. The problem was, that some pictures are broken (size was only 16KB).

@saimn

This comment has been minimized.

Owner

saimn commented Feb 10, 2014

Thanks for the feedback,
Let's keep the issue opened for now, I will see to catch the exception and add an error log.

@saimn saimn added the bug label Mar 31, 2014

@macakraca

This comment has been minimized.

macakraca commented Apr 16, 2014

Maybe this is related. I got a bit different IOError. I suspect that the JPG file in my collection that caused fatal error got corrupted during ftp transfer. However if I run sigal only on that folder it goes trough without an error.

My sugestion would be that sigal keeps on processing the collection despite fatal error on one of the images. With large multimedia collections it's not that convenient to run sigal over and over again until all faulty images are singled out.

DEBUG: Processor: ResizeToFit
Traceback (most recent call last):
  File "/usr/local/bin/sigal", line 9, in <module>
    load_entry_point('sigal==0.6.0', 'console_scripts', 'sigal')()
  File "/usr/local/lib/python2.7/dist-packages/sigal/__init__.py", line 154, in main
    parser.dispatch()
  File "/usr/local/lib/python2.7/dist-packages/argh/helpers.py", line 53, in dispatch
    return dispatch(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/argh/dispatching.py", line 124, in dispatch
    for line in lines:
  File "/usr/local/lib/python2.7/dist-packages/argh/dispatching.py", line 200, in _execute_command
    for line in result:
  File "/usr/local/lib/python2.7/dist-packages/argh/dispatching.py", line 183, in _call
    result = args.function(*positional, **keywords)
  File "/usr/local/lib/python2.7/dist-packages/sigal/__init__.py", line 109, in build
    gal.build()
  File "/usr/local/lib/python2.7/dist-packages/sigal/gallery.py", line 226, in build
    self.pool.map_async(worker, media_list).get(9999)
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 528, in get
    raise self._value
IOError: image file is truncated (35 bytes not processed)
@tintamarre

This comment has been minimized.

tintamarre commented Apr 16, 2014

I had the same issue yesterday.

After verifying each image, I run Sigal again with less NCPU and it went trough without an error ...

@macakraca

This comment has been minimized.

macakraca commented Apr 16, 2014

NCPU didn't work for me.

@macakraca

This comment has been minimized.

macakraca commented Apr 16, 2014

The problem is in

img = PILImage.open(source)

when source is a broken image file (according to PIL). A dirty workaround would be to wrap generate_image & generate_thumbnail functions in image.py in try/except.

This workaround results in gallery being made, but with blank thumbnails and no preview for broken source images.

@saimn

This comment has been minimized.

Owner

saimn commented Apr 20, 2014

A dirty workaround would be to wrap generate_image & generate_thumbnail functions in image.py in try/except.

Yeah, that's something I must look at. Could you send me examples of broken file ?

@saimn saimn closed this in cf63f91 May 7, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment