Python setuptools get IOError not a directory for json fi Python集成包获取IOError不是JSON文件的目录

2024-04-25 04:09:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在学习写这本书设置.py对于我正在开发的python包。我在这个包和设置.py我添加的文件

    package_data={"tiny.core": ["*.json"],
                  "tiny.vasp_io": ["*.yaml"]},

我还添加了以下信息在清单.in文件:

include *.rst requirements*.txt
recursive-include tiny *.py *.json *.yaml

以下是设置.cfg文件

[aliases]
release = register sdist bdist_wheel upload

然后我做了python setup.py install,一切看起来都很好。但是当我运行我的包时,我在egg中得到了一个json文件的IOError: [Errno 20] Not a directory。然而,当我解压egg文件夹时,json就在那里。如果我删除了egg文件,一切又恢复正常了。我对安装工具很陌生。你知道为什么会这样吗?我还注意到其他一些python模块有egg链接文件,但我没有。这就是原因吗? 存储库采用这种形式:

/tiny
- .git/
- setup.py
- setup.cfg
- requirements.txt
- MANIFEST.in
- README.rst
- tiny
    - __init__.py
    - core
        - __init__.py
        - json_files.json
        - yaml_files.yaml
        - some_script.py
    - cli
        - __init__.py
        - cli.py
        - some_script.py

似乎如果我使用python setup.py develop,我不会得到错误。不知道为什么。你知道吗


Tags: 文件inpycoretxtjsonyamlinclude