Code Monkey home page Code Monkey logo

Comments (8)

Mukei avatar Mukei commented on August 17, 2024

I found out that in Python 3.13 imghdr was removed.

Important deprecations, removals or restrictions:
PEP 594: The remaining 19 “dead batteries” have been removed from the standard library: aifc, audioop, cgi, cgitb, chunk, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu and xdrlib.

And PEP 594 gives the below advice:

imghdr: use the projects filetype, puremagic, or python-magic instead. (Contributed by Victor Stinner in gh-104773.)

I will switch to Python 3.12, but you might want to update the library to support future version of Python!

Thank you!

from md2pptx.

MartinPacker avatar MartinPacker commented on August 17, 2024

Hi @Mukei. First, thank you for your bug report. I take currency seriously - but haven't seen benefits in 3.12 or 3.13 for this project. Nevertheless it needs to run.

I discovered an issue with 3.12 - which I aim to get a fix out for soon. Another deprecated behaviour going away, of course.

I actually had trouble getting a 3.12 install to find python-pptx - but obviously I need to fix that.

What I think the current use of imghdr is to recognise the dimensions (really proportions) of an image and its type. I'll have to see how I can replicate that function - preferably not creating another dependency (that might go away).

Anyhow, please do test on 3.12. I think you'll find it breaks there, too.

from md2pptx.

MartinPacker avatar MartinPacker commented on August 17, 2024

It looks like Pillow at a high enough level could do. (9.5.0 for 3.12?) We already make it an optional prereq. Probably have to make it a mandatory one.

from md2pptx.

MartinPacker avatar MartinPacker commented on August 17, 2024

I was wrong. imghdr is apparently just picking up the filetype for a graphic. Will have to think about how to do that differently. (Pillow is used for something else and can remain optional.)

from md2pptx.

MartinPacker avatar MartinPacker commented on August 17, 2024

This Stack Overflow article poses the idea that one could use the file extension:

filename.lower().endswith(('.png', '.jpg', '.jpeg', '.tiff', '.bmp', '.gif'))

I'm not wowed by this but maybe imghdr was doing little more than that.

from md2pptx.

MartinPacker avatar MartinPacker commented on August 17, 2024

Built not using imghdr but testing filename extensions. Please try the latest md2pptx file out. On 3.12 if you like. Or maybe 3.13. Let me know how it goes. I want to publish a release that says it supports 3.12.

from md2pptx.

MartinPacker avatar MartinPacker commented on August 17, 2024

My initial tests with 3.12.2 and 3.13.0a5 show md2pptx continuing to work. (Installed both via pyenv and installed python-pptx into each environment.)

Thanks to your opening this issue @Mukei I now know how to test with newer versions. That should help keep this (and mdpre) current. mdpre is part of my make-driven presentation build toolchain and it worked fine with 3.12 and 3.13.

from md2pptx.

MartinPacker avatar MartinPacker commented on August 17, 2024

Fixed and shipped in v4.4.

Closing. Please reopen if you don't consider it fixed.

from md2pptx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.