473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

zlib decode fails with -5

Traceback (most recent call last):
File "<string>", line 20, in ?
File "c:\Python24\lib\encodings\zlib_codec.py", line 43, in zlib_decode
output = zlib.decompress(input)
zlib.error: Error -5 while decompressing data

The -5 error appears to be a Z_BUF_ERROR from looking at the manual at
http://www.zlib.net/

The original data was 50K. It compressed to 30K. When I try to decompress,
this error occurs.

I have done this successfully on 150K of data, so I do not know why it would
be a space issue.

Any ideas or suggestions?
Sep 27 '05 #1
2 4547
ncf
I don't mean this harshly, but have you tried recompressing the data to
see if you may have had a bad data set?

If it still fails, then I'm really not sure why/how zlib decides that
there isn't enough room in the output buffer.
"Z_BUF_ERROR if there was not enough room in the output buffer"

Sorry I couldn't be of much assistance on this matter.
-Wes

Sep 28 '05 #2
"ncf" <no***************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I don't mean this harshly, but have you tried recompressing the data to
see if you may have had a bad data set?

If it still fails, then I'm really not sure why/how zlib decides that
there isn't enough room in the output buffer.
"Z_BUF_ERROR if there was not enough room in the output buffer"

Sorry I couldn't be of much assistance on this matter.
-Wes


Ok. The answer seems to be that sys.stdin.read() on Windows appears to be
doing newline massaging. I had to set the mode to binary. If msvcrt fails
to load, then it is not a Windows machine and should do the right thing
anyway.

try
import msvcrt, os
msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
except:
pass
Sep 29 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Greg Bakken | last post by:
I am writing a python program that recieves 'compressed and encoded' strings from another piece of software. I can successfully uncompress and decode the strings via import base64, zlib def...
3
by: Alan Toppen | last post by:
I was unable to use the ZipFile class in the zipfile module in Python2.4. I got an error that zlib could not be found. Comparing my Python 2.2 installation I noticed Python 2.4 was missing a...
2
by: aurora | last post by:
I have some unicode string with some characters encode using python notation like '\n' for LF. I need to convert that to the actual LF character. There is a 'unicode_escape' codec that seems to...
0
by: Jan Prochazka | last post by:
Hi, I need to decompress zip archive. I wrote a parser of zip file, i obtain the compressed data, but when i call zlib.decompress(data) on them, it throws this error: decbuf =...
0
by: Jan Prochazka | last post by:
Hi, I need to decompress zip archive. I wrote a parser of zip file, i obtain the compressed data, but when i call zlib.decompress(data) on them, it throws this error: decbuf =...
4
by: shamzz | last post by:
Hi, I've compiled (configure/make/make install) Python 2.4.4 from source on Suse Linux Enterprise Server 9 (x64). I need Python to be compiled with Zlib so that I can compile and use Zope. ...
4
by: Anonymous | last post by:
Slightly OT, but can't find a zlib specific ng - so hopefuly, someone can point out why uncompressed strings are not matching the original strings (lots of strange characters at end of string). ...
3
by: stuntgoat | last post by:
import zlib works in Python 2.4 (debian etch AMD64 - default python version for that distro) I built python 2.5 from source; zlib is not importable. I am trying to compile MySQLdb. any...
4
by: MZ | last post by:
Hello! I`ve tried to instal zlib library to use zip functions to pack files into zip archive. I don`t know how I have to configure zlib to make it work. I have built up php.ini file and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.