Arquivo de Tags: linux

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 !

When I tried to install the Library PIL on a Ubuntu 8.04 where I had installed  Python 2.6 I got:

.
.
.
running build_ext
building ‘_imagingtk’ extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/freetype2 -IlibImaging -I/opt/python.org/python/python-2.6/include -I/usr/local/include -I/usr/include -I/opt/python.org/python/python-2.6/include/python2.6 -c _imagingtk.c -o build/temp.linux-i686-2.6/_imagingtk.o
_imagingtk.c:20:16: error: tk.h: No such file or directory
_imagingtk.c:23: error: expected ‘)’ before ‘*’ token
_imagingtk.c:31: error: expected specifier-qualifier-list before ‘Tcl_Interp’
_imagingtk.c: In function ‘_tkinit’:
_imagingtk.c:37: error: ‘Tcl_Interp’ undeclared (first use in this function)
_imagingtk.c:37: error: (Each undeclared identifier is reported only once
_imagingtk.c:37: error: for each function it appears in.)
_imagingtk.c:37: error: ‘interp’ undeclared (first use in this function)
_imagingtk.c:45: error: expected expression before ‘)’ token
_imagingtk.c:51: error: ‘TkappObject’ has no member named ‘interp’
_imagingtk.c:55: warning: implicit declaration of function ‘TkImaging_Init’
error: command ‘gcc’ failed with exit status 1

I’d founded the file ‘tk.h‘ on ‘/usr/include/tcl8.4‘ and after a look at the setup.py file I changed the line number 41 from:

TCL_ROOT = None

to

TCL_ROOT = “/usr/include/tcl8.4″

Now you can run your ‘python setup.py install’ again and get PIL working!

Note: You may perhaps have to install the tk-dev and tcl-dev packages before running the setup.py. I’d already had these packages, so I’m not sure about it.

On Ubuntu run:

apt-get install tk-dev tcl-dev

Para converter uma imagem do formato Bin/Cue para ISO basta usar o programa bchunk. Ele está disponível para instalação através do APT-GET no Ubuntu. Seu uso é através da linha de comando e é bem simples:

bchunk ARQUIVO.BIN ARQUIVO.CUE NOVOARQUIVO.ISO

Dica retirada daqui.

Tive este problema hoje ao tentar compilar o kernel do Gentoo no meu note velho (a bateria da BIOS do coitado foi para o saco). Depois de fuçar um monte na net achei esse meio de resolver o problema:

# make clean
# touch /tmp/teste
# find . -newer /tmp/teste -print -exec touch {} \;
# rm /tmp/teste

e depois é só utilizar o bom e velho:

# make && make modules_install

Eu achei a solução do problema em http://www.experts-exchange.com/OS/Linux/Setup/Q_10127797.html

Problema: alterar o locale do usuário para ISO8859-1 (poderia ser qualquer outro).

Solução: Edite o arquivo .bashrc e inclua as linhas:

export LANG=en_US.iso8859-1
export LC_CTYPE="en_US.iso8859-1"
export LC_NUMERIC="en_US.iso8859-1"
export LC_TIME="en_US.iso8859-1"
export LC_COLLATE="en_US.iso8859-1"
export LC_MONETARY="en_US.iso8859-1"
export LC_MESSAGES="en_US.iso8859-1"
export LC_PAPER="en_US.iso8859-1"
export LC_NAME="en_US.iso8859-1"
export LC_ADDRESS="en_US.iso8859-1"
export LC_TELEPHONE="en_US.iso8859-1"
export LC_MEASUREMENT="en_US.iso8859-1"
export LC_IDENTIFICATION="en_US.iso8859-1"
export LC_ALL="en_US.iso8859-1"

Nota:

  • Verificar se existe chamada ao script .bashrc à partir do .bash_profile. se não existir adicionar a linha:
    source ~/.bashrc