dexplo / dataframe_image

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

SyntaxError("not a PNG file") #72

Closed erickalfaro closed 1 year ago

erickalfaro commented 1 year ago

Hi all,

As of last night at around ~5:51PM EST this function call no longer works for me.

dfi.export(styled, '../../data/images/trending.png')

I have a process that runs every minute. It has been running for over a year now.

I am seeing chatter around others having the same issue.

https://stackoverflow.com/questions/75135530/error-exporting-styled-dataframes-to-image

erickalfaro commented 1 year ago
Traceback (most recent call last):
  File "C:\Users\Administrator\Documents\GitHub\py_twitter\src\stream_tweets\trending.py", line 507, in <module>
    schedule.run_pending()
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\schedule\__init__.py", line 780, in run_pending
    default_scheduler.run_pending()
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\schedule\__init__.py", line 100, in run_pending
    self._run_job(job)
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\schedule\__init__.py", line 172, in _run_job
    ret = job.run()
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\schedule\__init__.py", line 661, in run
    ret = self.job_func()
  File "C:\Users\Administrator\Documents\GitHub\py_twitter\src\stream_tweets\trending.py", line 363, in create_trending_png
    dfi.export(styled, '../../data/images/trending.png')
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\dataframe_image\_pandas_accessor.py", line 24, in export
    return _export(obj, filename, fontsize, max_rows, max_cols, table_conversion, chrome_path)
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\dataframe_image\_pandas_accessor.py", line 73, in _export
    img_str = converter(html)
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\dataframe_image\_screenshot.py", line 167, in run
    img = self.take_screenshot()
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\dataframe_image\_screenshot.py", line 119, in take_screenshot
    img = mimage.imread(buffer)
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\matplotlib\image.py", line 1560, in imread
    with img_open(fname) as image:
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\PIL\ImageFile.py", line 121, in __init__
    self._open()
  File "C:\ProgramData\Anaconda3\envs\py39\lib\site-packages\PIL\PngImagePlugin.py", line 676, in _open
    raise SyntaxError("not a PNG file")
SyntaxError: not a PNG file
buckyster commented 1 year ago

duplicate of https://github.com/dexplo/dataframe_image/issues/68

PaleNeutron commented 1 year ago

Should be fixed in 0.2.0