How To Open A File In A Package With Importlib?
I am trying to put the back-end of a simple web-scraping application that I'm working on into a package, but this application relies on loading from a pickled python object, which
Solution 1:
As per this answer on a related question (you might want to go and upvote this answer), for importlib.resources
to do its job there has to be a __init__.py
file in the packages.
So in your case, I believe there should be a mypackage/categories/__init__.py
file (as always, that file can be left empty but it has to exist).
Post a Comment for "How To Open A File In A Package With Importlib?"