SBentley / qvd-utils

Read Qlik Sense .qvd files
https://pypi.org/project/qvd/
Apache License 2.0
49 stars 16 forks source link

Content file from memory - BytesIO support #6

Open BuSHari opened 3 years ago

BuSHari commented 3 years ago

First thank you for this library!

Is there a chance that it can support BytesIO content? I'm getting the error:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "*****************/env/lib/python3.9/site-packages/qvd/qvd_reader.py", line 6, in read
    data = read_qvd(file_name)
TypeError: Can't convert <_io.BytesIO object at 0x1361585e0> to PyString

This is my code:

from io import BytesIO
from qvd import qvd_reader

qvd = BytesIO()
with open('file.qvd', 'rb') as f:
   qvd.write(f.read())

qvd.seek(0)
content = BytesIO(qvd.getvalue())

df = qvd_reader.read(content)

Thanks in advanced...

sepodev commented 1 year ago

Totally agree, this library is absolutely fantastic, great stuff! @BuSHari Did you find any way to solve your problem :) ? Sitting with exactly same issue here.

Would be nice to have this functionality build-in.