Skip to content

SyntaxError: not a PNG file #63

Open
@BexTuychiev

Description

@BexTuychiev

I can't push a notebook to Medium because of the following error:

Traceback (most recent call last):
  File "\\wsl$\Ubuntu\home\bexgboost\articles\deploy_to_medium.py", line 4, in <module>
    jtm.publish('2023/1_january/3_synthetic_data_generators/notebook.ipynb',
  File "C:\Users\bex\AppData\Roaming\Python\Python39\site-packages\jupyter_to_medium\_publish_to_medium.py", line 300, in publish
    p.main()
  File "C:\Users\bex\AppData\Roaming\Python\Python39\site-packages\jupyter_to_medium\_publish_to_medium.py", line 218, in main
    self.md, self.image_data_dict = self.create_markdown()
  File "C:\Users\bex\AppData\Roaming\Python\Python39\site-packages\jupyter_to_medium\_publish_to_medium.py", line 121, in create_markdown
    no_ex_pp.preprocess(self.nb, self.resources)
  File "C:\Users\bex\anaconda3\envs\articles\lib\site-packages\nbconvert\preprocessors\base.py", line 69, in preprocess
    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
  File "C:\Users\bex\AppData\Roaming\Python\Python39\site-packages\jupyter_to_medium\_preprocesors.py", line 148, in preprocess_cell
    output['data'] = {'image/png': converter(html)}
  File "C:\Users\bex\AppData\Roaming\Python\Python39\site-packages\jupyter_to_medium\_screenshot.py", line 169, in run
    img = self.take_screenshot()
  File "C:\Users\bex\AppData\Roaming\Python\Python39\site-packages\jupyter_to_medium\_screenshot.py", line 121, in take_screenshot
    img = mimage.imread(buffer)
  File "C:\Users\bex\AppData\Roaming\Python\Python39\site-packages\matplotlib\image.py", line 1560, in imread
    with img_open(fname) as image:
  File "C:\Users\bex\AppData\Roaming\Python\Python39\site-packages\PIL\ImageFile.py", line 116, in __init__
    self._open()
  File "C:\Users\bex\AppData\Roaming\Python\Python39\site-packages\PIL\PngImagePlugin.py", line 712, in _open
    raise SyntaxError("not a PNG file")
SyntaxError: not a PNG file

What might be the reason for this? Plots (I do have some from Seaborn). The problem is only with that notebook, other notebooks are pushing fine. Here is a link to the notebook.

@tdpetrou, can you please take a look if you have time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions