开发者

package data not installed from python .egg file

开发者 https://www.devze.com 2023-01-22 14:36 出处:网络
I\'m trying to include some data files in a python package using the setuptools package_data option. I\'m then accessing the files with pkg_resources. This works perfectl开发者_高级运维y when the pyth

I'm trying to include some data files in a python package using the setuptools package_data option. I'm then accessing the files with pkg_resources. This works perfectl开发者_高级运维y when the python .egg file is installed as-is (i.e. still zipped). But when the egg file is unzipped during installation, the data files are not installed.

In other words, if I run:

python setup.py bdist_egg
cd dist
sudo easy_install -z EnrichPy-0.1.001-py2.6.egg

then the egg file is installed (with the data safely zipped inside) and everything works.

On the other hand, if I run

sudo easy_install -Z EnrichPy-0.1.001-py2.6.egg

then the data files are not installed. I have a directory called EnrichPy-0.1.001-py2.6.egg/enrichpy/ under dist-packages, but it contains only my source files, not my data files.

Can anyone suggest what I need to do to get the package_data files to be installed when easy_install unzips the egg file?

Notes:

The package is available at http://github.com/roban/EnrichPy

I can test it by running: import enrichpy.yields enrichpy.yields.Data_vdHG().data If that exits without errors, then pkg_resources is finding the installed data.


Problem solved, thanks to help from P.J. Eby on the distutils-sig email list:

http://mail.python.org/pipermail/distutils-sig/2010-November/017054.html

Just needed to rename files to avoid the '..' string.

0

精彩评论

暂无评论...
验证码 换一张
取 消