2

My package looks somewhat like this.

Package
   tokenizer,py
   corpus.py
   __init__.py
   resources
     data.txt

I want to access data.txt from corpus.py. How should I do it with pkg_resources? Also do I need to create setup.py for package resources to work?

  • 1
    Possible duplicate of [Python Access Data in Package Subdirectory](https://stackoverflow.com/questions/779495/python-access-data-in-package-subdirectory) – phd Apr 11 '18 at 13:39
  • If you don't have `setup.py` you don't have a package. And if you don't have a package you don't need `pkg_resources`. See the accepted answer at the link above. – phd Apr 11 '18 at 13:41
  • Please refer to this answer https://stackoverflow.com/questions/71677490/how-to-properly-include-data-folder-to-python-package – Eciel Mar 10 '23 at 07:23
  • Please refer to this answer https://stackoverflow.com/questions/71677490/how-to-properly-include-data-folder-to-python-package – Eciel Mar 10 '23 at 07:25

0 Answers0