abcat / pypng

Automatically exported from code.google.com/p/pypng
0 stars 0 forks source link

Deprecation warnings when using pypng. #54

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call the asRGB function of the library

What is the expected output? What do you see instead?
The following python warnings are seen

1) png.py:1133: DeprecationWarning: 'i' format requires -2147483648 <=
number <= 2147483647

2) verify = struct.pack('!i', verify)

3) outfile.write(struct.pack("!i", checksum))

What version of the product are you using? On what operating system?
Revision number: 110

Please provide any additional information below.
None: 

Original issue reported on code.google.com by vish...@gmail.com on 9 Jun 2009 at 4:51

GoogleCodeExporter commented 9 years ago
Could you please provide a transcript of code that produces the warning?  In 
other words a cut and paste 
from a Terminal window that shows the error.

Could you also say what Computer, Operating System, and version of Python you 
are using?

I'll hazard a guess and say you're using a 64-bit machine.

From the information provided it looks like it could be related to this problem 
with the CRC32 computation: http://bugs.python.org/issue1202

Original comment by d...@pobox.com on 10 Jun 2009 at 1:26

GoogleCodeExporter commented 9 years ago
This issue was closed by r183.

Original comment by d...@pobox.com on 10 Jun 2009 at 1:50

GoogleCodeExporter commented 9 years ago

Original comment by d...@pobox.com on 10 Jun 2009 at 1:52

GoogleCodeExporter commented 9 years ago

Original comment by d...@pobox.com on 16 Jun 2009 at 8:35

GoogleCodeExporter commented 9 years ago
Warning the was produced on the "google app engine" platform and following are
the messages from the console log

#
06-14 07:16AM 39.185
/base/data/home/apps/charmo-meter/1.334199149815290197/charmometer/png.py:1133:
DeprecationWarning: 'i' format requires -2147483648 <= number <= 21474
#
E 06-14 07:16AM 39.185 verify = struct.pack('!i', verify)
#
E 06-14 07:16AM 39.186
/base/data/home/apps/charmo-meter/1.334199149815290197/charmometer/png.py:943:
DeprecationWarning: 'i' format requires -2147483648 <= number <= 214748
#
E 06-14 07:16AM 39.186 outfile.write(struct.pack("!i", checksum))

Original comment by vish...@gmail.com on 16 Jun 2009 at 12:08

GoogleCodeExporter commented 9 years ago
@vishpat:

Thanks for that.  So far I have not been able to reproduce this.  But I made a 
change to fix it anyway (r183).

This is incorporated into release 0.0.9: 
http://code.google.com/p/pypng/downloads/list

Could you please try that?  And report back here in this issue.  Thanks.

Original comment by d...@pobox.com on 17 Jun 2009 at 3:23

GoogleCodeExporter commented 9 years ago
I get this same DeprecationWarning with the google app engine.  
PyPng version 0.0.11

from google.appengine.api import images
....
bytes = decodedFromEmailAttachment()
img = images.Image(image_data = bytes)
img.resize(400, 300)
googBytes = img.execute_transforms()     # returns a byteString

reader = png.Reader(bytes=googBytes)
boxRowFlatPixel = list(reader.asDirect()[2])
outfile = cStringIO.StringIO()
img = png.Writer(width=400, height=300, planes=3)
img.write(outfile, boxRowFlatPixel)
pngBytes = outfile.getvalue()
----

At this point if I attach and email googBytes and pngBytes back to myself the 
googBytes is fine but pngBytes is wacked.

Original comment by doug.tea...@gmail.com on 27 Jan 2010 at 10:18

GoogleCodeExporter commented 9 years ago
@dlooney: is it possible that you can attach a small example of googBytes and 
pngBytes?  Any warnings that you 
see would be useful as well.  Thanks.

Original comment by d...@pobox.com on 28 Jan 2010 at 9:28

GoogleCodeExporter commented 9 years ago
I resolved the wacked image problem.  Probably my own mis-read of the docs.
The google framework is adding an alpha channel during its resize 
transformation.

>>> img = png.Writer(width=w, height=h, planes = 4) # does not work
>>> img = png.Writer(width=w, height=h, alpha = True) # does work!

I still don't know why I we get the DeprecationWarning, but one hurdle at a 
time I guess

Original comment by doug.tea...@gmail.com on 28 Jan 2010 at 5:28

GoogleCodeExporter commented 9 years ago
The fix from r183 around line 1153 can be applied (more or less) around line 
963 to fix the DeprecationWarning on Google App Engine, I think.

Original comment by ilginnyc@gmail.com on 18 Mar 2011 at 3:40

GoogleCodeExporter commented 9 years ago
Ah, right.  I see now that the original report pointed out the problem with 
that line too (and I missed it).  Curiously, I also picked up on this last 
night doing a 2to3 port at the Python NorthWest meeting.

Original comment by drj...@googlemail.com on 18 Mar 2011 at 9:32

GoogleCodeExporter commented 9 years ago
Fixed by r212?

Original comment by drj...@googlemail.com on 28 Mar 2011 at 3:38