0

Suppose:

- dir1
  - subdir
    - installed_module
- dir2
  - dbfile

This is my folder structure. I want to find dbfile and I am in some other directory. How to use pkg_resources in python to find the location of the dbfile using installed module installed_module?

I tried using pkg_resources.resource_filename('installed_module', dbfile) to get some path that isn't what I was expecting.

Ayush Jain
  • 316
  • 4
  • 11
  • If this is new code look at importlib instead https://importlib-resources.readthedocs.io/en/latest/ – wim Mar 21 '19 at 21:43
  • Isn't there a way to do it using pkg_resources or pkg_util? – Ayush Jain Mar 22 '19 at 12:47
  • Yes, there is, but you'll need to make an MCVE. The folder structure of your working directory does not tell sufficient information (would need to see the installer / packaging code to see where the installed code goes to - the installed files are the only files that `pkg_resources` knows about). – wim Mar 22 '19 at 18:30

0 Answers0