我有一个这样的项目:
├── CHANGES.txt
├── LICENSE
├── MANIFEST.in
...
├── docs
│ └── index.rst
├── negar
│ ├── Negar.py
│ ├── Virastar.py
│ ├── Virastar.pyc
│ ├── __init__.py
│ ├── data
│ │ ├── __init__.py
│ │ └── untouchable.dat
│ ├── gui.py
│ ├── gui.pyc
│ ├── i18n
│ │ ├── fa_IR.qm
│ │ └── fa_IR.ts
│ └── negar.pro
├── setup.py
...
在里面我的文件Virastar.py
需要一些来自data.untouchable.dat
. 在我用这个安装项目之前它工作正常setup.py
:
setup(
...
include_package_data=True,
packages = find_packages() + ['negar'],
package_dir={'negar': 'negar'},
package_data={'negar': ['data/*.dat']},
entry_points={
'console_scripts': [
'negar = negar.Negar:main',
],
},
...
)
之后,当我启动程序并需要该数据文件时,它会返回此错误:
IOError: [Errno 2] No such file or directory: 'data/untochable.dat'
即使在我的egg-info
来源中,我也找不到任何数据文件:
...
negar/Negar.py
negar/Virastar.py
negar/__init__.py
negar/gui.py
negar/data/__init__.py
我在这里错过了什么吗?
谢谢你们。
编辑:我必须在init .py 中添加任何特殊的东西吗?
我必须添加这个:我使用 untouchable.dat 就像这样:
f = codecs.open('data/untouchable.dat', encoding="utf-8")