timcogan / lzss

MIT License
2 stars 1 forks source link

IndexError: list index out of range #5

Open pompushko opened 2 weeks ago

pompushko commented 2 weeks ago

Hello I have 8mb file which I want to decompress

Traceback (most recent call last):
  File "/home/lszz.py", line 20, in <module>
    decompress_file(input_file, output_file)
  File "/home/lszz.py", line 9, in decompress_file
    decompressed_data = lzss.decompress(compressed_data)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dev/lib/python3.11/site-packages/lzss/lzss.py", line 55, in decompress
    output_buffer.append(output_buffer[-distance])
                         ~~~~~~~~~~~~~^^^^^^^^^^^
IndexError: list index out of range

Maybe my code is bad?

import lzss

def decompress_file(input_file_path, output_file_path):
    with open(input_file_path, 'rb') as compressed_file:
        compressed_data = compressed_file.read()

    decompressed_data = lzss.decompress(compressed_data)

    with open(output_file_path, 'wb') as output_file:
        output_file.write(decompressed_data)

Thank you!

timcogan commented 2 weeks ago

Thank you for the information. Was the file compressed using this lzss library?