I am looking for the solution to this error and I checked other similar questions but couldn't find an answer. I am trying to implement Lempel-Ziv-1978 data compression algorithm and I have that error in my decompression function which is:
def decompresser(stringAdecompresser):
from io import StringIO
# creer la dictionnaire
size = 256
dictionnaire = {chr(i): i for i in range(size)}
resultat = StringIO()
w = chr(stringAdecompresser.pop(0))
resultat.write(w)
for k in stringAdecompresser:
if k in dictionnaire:
entree = dictionnaire[k]
else: # k == size:
entree = w + w[0]
resultat.write(entree)
#ajouter dans la dictionnaire
dictionnaire[size] = w + entree[0]
size += 1
w = entree
return resultat.StringIO()
and I got: File "lz78.py", line 52, in decompresser return resultat.StringIO() AttributeError: '_io.StringIO' object has no attribute 'StringIO'
Python version: 3.6
return resultat.getvalue()... - mechanical_meat