raiseIOError in python lib ImageFile.py: "image file is truncated"

Asked by sergio mena doce

I recently installed xibo python client. I'm using Ubuntu 10.04.4 LTS and followed the steps of installation for Ubuntu 10.04 and derivatives in the following guide: http://wiki.xibo.org.uk/index.php?title=Install_Guide_Python_Client&oldid=975.

Everything in the process of installation went well until I typed ./run.sh

and outputs the following:

sergio@sergio-desktop:/opt/xibo/pyclient/client/python$ ./run.sh
Xibo Client v1.2.2a1
Reading default configuration
Reading user configuration
Log Level is: 0
Logging will be handled by: XiboLogXmds
Switching to new logger

[12-02-27 18:20:32.127] WARNING: Could not find font face Arial. Using sans instead.
Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "XiboClient.py", line 1641, in run
    self.currentMedia.add()
  File "/opt/xibo/pyclient/client/python/plugins/media/ImageMedia.py", line 43, in add
    image.thumbnail((w,h),Image.ANTIALIAS)
  File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1559, in thumbnail
    self.load()
  File "/usr/lib/python2.6/dist-packages/PIL/ImageFile.py", line 201, in load
    raise IOError("image file is truncated (%d bytes not processed)" % len(b))
IOError: image file is truncated (14 bytes not processed)

I tested the /opt/xibo/pyclient/client/python/site.cfg file combinations with
fullscreen=false/true but it gives the same problem.

I feel this problem has more to do with python libraries than xibo client itself. Does anyone know something about this problem or how to fix it?

Thank you very much in advance.

Question information

Language:
English Edit question
Status:
Solved
For:
Xibo Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Alex Harrington (alexharrington) said :
#1

It's crashing because the ImageMagic library isn't able to process the image you've uploaded to the server. It says that it's been truncated which likely means the upload failed.

Try uploading the image to the server again and see if that improves things.

The client could handle that better. I'll file a bug,

Alex

Revision history for this message
sergio mena doce (sergy8612) said :
#2

Thanks for your answer, but I tested it with several image sizes and formats, deleting and uploading images to the server, and keeps giving the same error:

File "/usr/lib/python2.6/dist-packages/PIL/ImageFile.py", line 201, in load
    raise IOError("image file is truncated (%d bytes not processed)" % len(b))
IOError: image file is truncated (14 bytes not processed)

Am I the only one that gets this error?

Revision history for this message
Alex Harrington (alexharrington) said :
#3

Can you check in the data directory that the image files are downloaded properly and open with GIMP or similar?

If they do open okay, please can I have a copy of one of these images so I can see for myself?

I've not seen this error in the wild before.

Alex

Revision history for this message
sergio mena doce (sergy8612) said :
#4

Sure, I tried with these images: http://www.mathworks.com/matlabcentral/fx_files/21944/2/DancingPeaks.gif
and a light image that shouldn't give any problems: http://www.etoncollege.com/UserFiles/Image/Eton%20Blue.jpg

When uploaded, I set these images as background of the layout.
And yes, images are downloaded properly and not corrupted, I can open them with GIMP. It seems it happens with any image.

Revision history for this message
Alex Harrington (alexharrington) said :
#5

I put both those images as the background on a layout on a 1.2.2 client and they work fine - no errors.

You do have at least one region on your layout with something in it don't you?

So for example the layout I created had one region on it with some text in it, and the images you describe as the background image.

In Xibo, every layout must have at least one region and that region must have a media item in it.

Alex

Revision history for this message
sergio mena doce (sergy8612) said :
#6

This is odd. This time I added a region with some text and a image, and still having the same problem:

Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "XiboClient.py", line 1641, in run
    self.currentMedia.add()
  File "/opt/xibo/pyclient/client/python/plugins/media/ImageMedia.py", line 43, in add
    image.thumbnail((w,h),Image.ANTIALIAS)
  File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1559, in thumbnail
    self.load()
  File "/usr/lib/python2.6/dist-packages/PIL/ImageFile.py", line 201, in load
    raise IOError("image file is truncated (%d bytes not processed)" % len(b))
IOError: image file is truncated (14 bytes not processed)

Revision history for this message
sergio mena doce (sergy8612) said :
#7

This may give some more info. When I set none as background image, it prompts:

Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "XiboClient.py", line 1641, in run
    self.currentMedia.add()
  File "/opt/xibo/pyclient/client/python/plugins/media/ImageMedia.py", line 43, in add
    image.thumbnail((w,h),Image.ANTIALIAS)
  File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1559, in thumbnail
    self.load()
  File "/usr/lib/python2.6/dist-packages/PIL/ImageFile.py", line 201, in load
    raise IOError("image file is truncated (%d bytes not processed)" % len(b))
IOError: image file is truncated (14 bytes not processed)

Exception in thread Thread-6 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
  File "XiboClient.py", line 1012, in run
  File "XiboClient.py", line 1166, in updateMediaInventory
  File "XiboClient.py", line 2974, in MediaInventory
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Types'
Unhandled exception in thread started by
Error in sys.excepthook:

Original exception was:
Segmentation fault

But at the second time I typed ./run.sh, it prompted the same as always. Furthermore, I'm unable to stop python process by killing it as sudo, I just doesn't stop:

 1386 pts/0 Sl+ 0:03 /usr/bin/python XiboClient.py

So I have to restart my computer to stop the process

Revision history for this message
Dan Garner (dangarner) said :
#8

Solved in linked bug