bchanudet / OctoPrint-Octorant

Discord plugin for OctoPrint
MIT License
26 stars 14 forks source link

Thumbnails Broken in Python <3.9 #66

Closed VidFerris closed 1 year ago

VidFerris commented 1 year ago

Hi; thanks for making this repo! I have an OctoPi set up from a while ago, so it's still using Python 3.7.3.

In line 79 of media.py, thumbnailB64 += line.removeprefix("; ").removesuffix('\n') The removeprefix and removesuffix functions aren't present in versions of Python earlier than 3.9. (Took a fair bit of debugging to figure this out!) I've replaced it on my version with thumbnailB64 += line[2:-1] which is working fine for me now, but probably too brittle to directly merge upstream - implementing a more robust patch would expand the compatibility to anyone using those lower versions still.

Thanks again for writing this plugin!

bchanudet commented 1 year ago

Hi, thanks for your feedback and the time spent to figure out the exact error.

I'll try to have a look at it ASAP and get a new update out. :)