[PyQt] QImage.save() traceback

Hans-Peter Jansen hpj at urpla.net
Thu May 8 09:27:34 BST 2008


Am Mittwoch, 7. Mai 2008 schrieb Sergi Blanch i Torné:
>
> I attach an standalone python script, without tango, using a simply black
> image. Before I was using ipython.
> Maybe I can provide a little more information, because changing the
> format of the image I found how to save it, and further more from the
> attached script I receive the message 'libpng error: Valid palette
> required for paletted images' for the first 8 bit grayscale image (not
> the second!).

You should always create a QApplication instance first, if even the simplest 
things behave strange..

But that smells hefty like a Qt problem, thus you should try to reproduce 
this in C++ and, if successful, send it to the qt support and/or the 
qt-interest ML.

Phil can't do anything about it in this case.

> My main question is how I can have a longer answer that true of false,
> because having only this I cannot distinguish if the problem becomes from
> the image, the filesystem, or wherever.

I fear, you don't besides a qt rebuild with debugging enabled. Looking into 
the source will give you more hints.

True, not throwing exceptions in such cases isn't the most pythonic 
behavior, but it's inherited from Qt, and it's not possible to get changed 
without modifying Qt and its libs itself, where you scare Phil away on 
changing the FIRST bit.

What I could imagine is a Qt debug build, where SOME qDebug calls get 
converted to python exceptions, but start defining SOME and you will see, 
how insane this idea is..

Anyway, keep us cc'ed, I'm sure, others here will find this issue 
interesting..

Pete



More information about the PyQt mailing list