1

I am going over the pkg_resources documentation (https://setuptools.readthedocs.io/en/latest/pkg_resources.html) and trying to implement an object similar to resource_filename, but I just want the resource directory that the file exists in. Do I define this as a default somewhere else, like in setup.py or something?

Also, if such a path object exists, is there any benefit to using it as opposed to just an os.path object?

How can this package contain methods like resource_isdir and resource_listdir when there is no way to actually make the resource a dir?

justadampaul
  • 979
  • 1
  • 7
  • 11
  • I have found a seemingly hidden `resource_dir` instance attached to `pkg_resources`, but it is not mentioned anywhere in the documentation and it returns `None` in all cases that I have managed to use it so far. The mystery deepens... – justadampaul Dec 02 '19 at 14:07

1 Answers1

1

pkg_resources.resource_filename accepts directories as an argument -- however, you have to specify the package as the parent directory within your package.

justadampaul
  • 979
  • 1
  • 7
  • 11