2

I am trying to figure out the basic structure for a python program I am writing that must include non-python resources for its functionality. In particular, it includes HTML, CSS, JS, and images that it must copy out of the package for report generation. The basic structure currently looks like this:

/project
  /my-package
    /sub-package-a
      __init__.py
      ...
    /sub-package-b
      __init__.py
      ...
    /static-content
      stuff.html
      ...
    __init__.py
    util.py
    command.py

My basic questions is this: if I, from an arbitrary directory, run python my-package/command.py or python -m my-package, how do I get access to the files inside of static-content. If I later turn this into an installable egg, does this change?

dave mankoff
  • 17,379
  • 7
  • 50
  • 64
  • related: [python: can executable zip files include data files?](http://stackoverflow.com/a/5356563/4279). It works for `python -mmy_package` and eggs too. – jfs Sep 24 '12 at 15:16
  • @J.F.Sebastian That relies on setuptools explicitly. That's not the end of the word, but I'm wondering - is there a builtin python way to do this? – dave mankoff Sep 24 '12 at 15:29
  • you'd mentioned eggs so I assumed that you use setuptools. Read other answers from the link, [example](http://stackoverflow.com/a/5356427/4279). – jfs Sep 24 '12 at 15:39

0 Answers0