Skip to content

Fix for Python 3.14+ not having pkg_resources#66

Open
blepping wants to merge 1 commit intofbcotter:masterfrom
blepping:fix_python14
Open

Fix for Python 3.14+ not having pkg_resources#66
blepping wants to merge 1 commit intofbcotter:masterfrom
blepping:fix_python14

Conversation

@blepping
Copy link
Copy Markdown

Python 3.14 removed the pkg_resources package (it had been deprecated for a while). It seems like importlib_resources is the generally accepted replacement. This small change uses importlib_resources if it's available and falls back to to trying pkg_resources. I wouldn't normally just blind catch Exception but it seems like the best option to make sure there's as little chance as possible that this change breaks anything.

Conversion to importlib_resources is pretty straightforward: https://importlib-resources.readthedocs.io/en/latest/migration.html#pkg-resources-resource-stream

The import could also be done the other way around, trying pkg_resources first if you prefer.

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.

1 participant