Skip to content

Fixed PNG syntax error. Fixed issue with .jpg filenames#79

Open
FoamoftheSea wants to merge 1 commit intodexplo:masterfrom
FoamoftheSea:bug_fixes
Open

Fixed PNG syntax error. Fixed issue with .jpg filenames#79
FoamoftheSea wants to merge 1 commit intodexplo:masterfrom
FoamoftheSea:bug_fixes

Conversation

@FoamoftheSea
Copy link
Copy Markdown

@FoamoftheSea FoamoftheSea commented Aug 23, 2023

Fixes Issue #63

Also fixes this issue with medium not understanding file names with .jpg extension:

  File "C:\Users\indez\.venvs\jtm_dev\lib\site-packages\jupyter_to_medium\_publish_to_medium.py", line 249, in load_images_to_medium
    new_url = req_json["data"]["url"]
KeyError: 'data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\indez\jupyter_to_medium\publish.py", line 3, in <module>
    jtm.publish(
  File "C:\Users\indez\.venvs\jtm_dev\lib\site-packages\jupyter_to_medium\_publish_to_medium.py", line 465, in publish
    p.main()
  File "C:\Users\indez\.venvs\jtm_dev\lib\site-packages\jupyter_to_medium\_publish_to_medium.py", line 338, in main
    self.load_images_to_medium()
  File "C:\Users\indez\.venvs\jtm_dev\lib\site-packages\jupyter_to_medium\_publish_to_medium.py", line 251, in load_images_to_medium
    raise ValueError("Problem loading image {name}.{extension} to Medium: " + r.text)
ValueError: Problem loading image {name}.{extension} to Medium: {"errors":[{"message":"The media is not in a format we understand.","code":-1}]}

The easiest fix for the above would be in the nbconvert package where these file names are generated, but to keep the solution in this repo the markdown and filenames must be corrected after they are generated.

@FoamoftheSea FoamoftheSea changed the title Fixed PNG syntax error. Fixed issue with medium rejecting filenames Fixed PNG syntax error. Fixed issue with .jpg filenames Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SyntaxError: not a PNG file

1 participant