jupyter_to_medium icon indicating copy to clipboard operation
jupyter_to_medium copied to clipboard

Fixed PNG syntax error. Fixed issue with .jpg filenames

Open FoamoftheSea opened this issue 2 years ago • 0 comments

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 avatar Aug 23 '23 00:08 FoamoftheSea