maxpmaxp / pdfreader

Python API for PDF documents
MIT License
113 stars 26 forks source link

Fix #113, No module named 'pkg_resources' #114

Closed zacharysyoung closed 4 months ago

zacharysyoung commented 5 months ago

The following two-line patch attempts to fix #113 by changing from the deprecated pkg_resources to importlib.

I looked up pkg_resources and found this landing page for setuptools and a deprecation notice:

Use of pkg_resources is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata). Some useful APIs are also provided by packaging (e.g. requirements and version parsing). Users should refrain from new usage of pkg_resources and should work to port to importlib-based solutions.

I don't understand pkg_resources or importlib, but happened to find importlib.resources.open_binary() which seemed like a good fit to replace pkg_resources.resource_stream().

maxpmaxp commented 4 months ago

@zacharysyoung thanks for the contribution!

zacharysyoung commented 4 months ago

๐Ÿ‘‹๐Ÿป Youโ€™re very welcome ๐Ÿ˜Š