0

I have a python project with the following structure:

src/
  main.py
  example.txt
setup.py

After installation, I should be able to call myprogramm -name bla and it should create a new folder bla and copy example.txt inside.

When installing the program with python setup.py develop (inside a virtualenv) everything works fine and as expected. However, when using python setup.py install, I get a FileNotFoundError when executing the command as Python cannot find example.txt.

Why doesn't it copy example.txt to the correct location when installing with python setup.py install? How can I fix the problem? Do I need to include example.txt explicitly in my setup.py somehow?

stefanbschneider
  • 5,460
  • 8
  • 50
  • 88
  • Show your setup.py – Jim Wright Jun 21 '18 at 09:27
  • *Do I need to include example.txt explicitly in my setup.py somehow?* Yes. See [Including Data Files](https://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files). – phd Jun 21 '18 at 14:46

1 Answers1

0

Including a MANIFEST.in and adding include_package_data=True in my setup.py solved my problem.

Apparently, package_data does not behave how you would expect: https://stackoverflow.com/a/14159430/2745116

stefanbschneider
  • 5,460
  • 8
  • 50
  • 88