I don't "do" Python, but the obvious issue is that you're
open
ing the file in the code that doesn't work, whereas you're just passing in the path in the code that does work.
Try just passing in the path instead:
path = 'C:/Users/lap/Desktop/ff/fr*.csv'
for file in iglob(path):
h = HuffmanCoding(file)
output_path = h.compress()
print("Compressed file path: " + output_path)
decom_path = h.decompress(output_path)
print("Decompressed file path: " + decom_path)