Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FoamoftheSea
Copy link

@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