software distribution - What is the proper way to access data files from projects distribuited with python wheel? -


I am not working on a pure Python project (i.e., no DLL, SOS etc etc) but some of my projects include HTML files are not those documentation, but actual data which is usually used by my software (read only).

The following line is in my setup.py:

  data_files = [('Html', ['share / myproj / html / index.html', 'share / Myproj / html / template.html '])],  

When I run Python3 setup.py bdist_wheel the zip file is created properly and the data files It has been included there. After installation, these files end in / usr / local / share / myproj / html . But what is the right way to reach them with my code? Hardcoding / usr / local / is a good idea. I was looking at pkg_resource but it seems that any idea of ​​working with eggs only?

If the file should be accessible to your package, then instead of package data data files For instructions on how to do this, in a nutshell, the files are included to put them in your package directory instead of a separate data directory (as you are doing now). Once you do this, the files can access normally.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -