Skip to content

Tag: bytesio

How to json dump inside Zipfile.open process?

I am trying to write a json inside a ZipFile BytesIO process. It goes like this: It is later saved in a Django File field. However it does not dump the data into the json_file. Finds it hard since it does not report an error message. Answer Your code ‘shadows’ zipfile, which won’t be a probl…

Convert PDF page to image with pyPDF2 and BytesIO

I have a function that gets a page from a PDF file via pyPdf2 and should convert the first page to a png (or jpg) with Pillow (PIL Fork) That results in an error: OSError: cannot identify image file <_io.BytesIO object at 0x0000023440F3A8E0> I found some threads with a similar issue, (PIL open() method …