Skip navigation

Problem:  When uploading images to Satchmo I got this error message: "Upload a valid image. The file you uploaded was either not an image or a corrupted image." even with valid JPEG files.

To test the Python Image Library (PIL) I’d  executed this code on python console:

from PIL import Image
file = open("/tmp/logo.jpg")
image_test = Image.open(file)
image_test.load()

what output:

<PixelAccess object at 0x37dce100>

This is ok, but when I’d run the same code inside a Django view I got the error "decoding error when reading image file".

I checked the Python Path and it was the same for both console and Django Application.

After looking on google I discover a post from Peter Schoenster on “Django-Photologue”  wiki page saying he had the same problem and discovered that python shell was using one version of libjpeg and Apache was using other. (He, as me had two version of this library on the system). He discovered it using the command

# lsof | grep libjpeg

I just remove the old libjpe62 from my system using:

# apt-get remove libjpeg62

And everything works !

Problem: Error on Uploading a image file to Satchmo. Message: "Upload a valid image. The file you uploaded was either not an image or a corrupted image."

To test the Python Image Library (PIL) I run this code on python console:

from PIL import Image
file = open("/tmp/logo.jpg")
image_test = Image.open(file)
image_test.load()

what output:

<PixelAccess object at 0x37dce100>

This is ok, but when I run the same code inside a Django view I got the error "decoding error when reading image file".

I checked the Python Path and it was the same for both console and Django Application.

After looking on google I discover a post from Peter Schoenster on “Django-Photologue”  home page saying he had the same problem and discovered that python shell was using one version of libjpeg and Apache was using other. (He, as me had two version of this library on the system). He discovered it using the command

# lsof | grep libjpeg

I just remove the old libjpe62 from my system using:

# apt-get remove libjpeg62

And everything works !

About these ads

One Comment

  1. Thank yo u!!


Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s

Seguir

Obtenha todo post novo entregue na sua caixa de entrada.

%d blogueiros gostam disto: