zlib decode fails with -5

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Watson

    #1

    zlib decode fails with -5

    Traceback (most recent call last):
    File "<string>", line 20, in ?
    File "c:\Python24\li b\encodings\zli b_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


    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?


  • ncf

    #2
    Re: zlib decode fails with -5

    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_ERRO R if there was not enough room in the output buffer"

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

    Comment

    • Paul Watson

      #3
      Re: zlib decode fails with -5

      "ncf" <nothingcanfulf ill@gmail.com> wrote in message
      news:1127877052 .360470.227960@ z14g2000cwz.goo glegroups.com.. .[color=blue]
      >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_ERRO R if there was not enough room in the output buffer"
      >
      > Sorry I couldn't be of much assistance on this matter.
      > -Wes[/color]

      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.filen o(), os.O_BINARY)
      msvcrt.setmode( sys.stdout.file no(), os.O_BINARY)
      except:
      pass


      Comment

      Working...