dexplo / dataframe_image

A python package for embedding pandas DataFrames as images into pdf and markdown documents
https://dexplo.org/dataframe_image
MIT License
278 stars 41 forks source link

Code stopped working after yesterday's update, please help #71

Closed dfranco13 closed 1 year ago

dfranco13 commented 1 year ago

Just saw the discussion on how to fix this, thank you!!

Hi,

I love this function and I've been using it for my assignments in jupyter lab. This code used to work before:

import pandas as pd
import dataframe_image as dfi

df = pd.DataFrame({'A': [1,2,3,4],
                   'B':['A','B','C','D']})

dfi.export(df,'red_page.png')

Now I get the below error, could you please help?

Traceback (most recent call last):

  File ~\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py:3397 in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  Input In [2] in <cell line: 7>
    dfi.export(df,'red_page.png')

  File ~\Anaconda3\lib\site-packages\dataframe_image\_pandas_accessor.py:24 in export
    return _export(obj, filename, fontsize, max_rows, max_cols, table_conversion, chrome_path)

  File ~\Anaconda3\lib\site-packages\dataframe_image\_pandas_accessor.py:73 in _export
    img_str = converter(html)

  File ~\Anaconda3\lib\site-packages\dataframe_image\_screenshot.py:167 in run
    img = self.take_screenshot()

  File ~\Anaconda3\lib\site-packages\dataframe_image\_screenshot.py:119 in take_screenshot
    img = mimage.imread(buffer)

  File ~\Anaconda3\lib\site-packages\matplotlib\image.py:1560 in imread
    with img_open(fname) as image:

  File ~\Anaconda3\lib\site-packages\PIL\ImageFile.py:112 in __init__
    self._open()

  File ~\Anaconda3\lib\site-packages\PIL\PngImagePlugin.py:676 in _open
    raise SyntaxError("not a PNG file")

  File <string>
SyntaxError: not a PNG file

Thank you,

buckyster commented 1 year ago

see https://github.com/dexplo/dataframe_image/issues/68