Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python setuptools无法在用户配置目录中安装数据文件_Python_Setuptools - Fatal编程技术网

Python setuptools无法在用户配置目录中安装数据文件

Python setuptools无法在用户配置目录中安装数据文件,python,setuptools,Python,Setuptools,我希望从包中安装子目录中的一组sql文件 project\ thetask\ __init__.py MainThing.py sql\ foo\thingone.sql foo\thingtwo.sql bar\thingone.sql bar\thingtwo.sql README.md MANIFEST.in 我的清单.in仅包含递归包含sql*.sql Mysetup.py尝试在appdirs找到的user\u config\u dir中

我希望从包中安装子目录中的一组sql文件

project\
thetask\
    __init__.py
    MainThing.py
sql\
    foo\thingone.sql
    foo\thingtwo.sql
    bar\thingone.sql
    bar\thingtwo.sql
README.md
MANIFEST.in
我的
清单.in
仅包含
递归包含sql*.sql

My
setup.py
尝试在
appdirs
找到的
user\u config\u dir
中安装文件

import setuptools
import os

from appdirs import AppDirs
APP_DIRS = AppDirs("table_builder", "thetask")

def long_desc(path_to_md):
    """
    Use markdown for description on devpi server.
    """
    with open(path_to_md, "r") as _fh:
        return _fh.read()

setuptools.setup(
    name="mything-thetask",
    version="0.1a",
    description="Tools for building TheTask tables.",
    long_description=long_desc("README.md"),
    long_description_content_type="text/markdown",
    author="Someguy SomeGuysLastName",
    author_email="Someguy.SomeGuysLastName@mything.com",
    license="Proprietary",
    install_requires=[
        "xlrd",
        "pyodbc",
        "appdirs",
        ],
    include_package_data=True,
    packages=setuptools.find_packages(),
    scripts=[
        "foo.py",
        "bar.py",
    ],
    data_files=[
        (APP_DIRS.user_config_dir, [
        "sql\\foo\\*.sql",
        "sql\\bar\\*.sql"
        ])
    ],
)
任务\\table\u builder目录是在my
AppData\\Local
目录中创建的,但是
install\u data
失败,原因是:

    running install_data
    error: can't copy 'sql\foo\*.sql': doesn't exist or not a regular file

    ----------------------------------------
Command "c:\users\someguy\projects\testinstall\venv\scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\someguy\\AppData\\Local\\Temp\\pip-install-bmlgs1fl\\mything-thetask\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\someguy\AppData\Local\Temp\pip-record-ia0ycbsc\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\someguy\projects\testinstall\venv\include\site\python3.7\mything-thetask" failed with error code 1 in C:\Users\someguy\AppData\Local\Temp\pip-install-bmlgs1fl\mything-thetask\
command failed
我希望看到的所有文件都在
.zip
包的
sql
目录中。我哪里做错了

UPDATE:
我试图使用特定的sql文件,而不是
data\u文件中的通配符,这消除了错误,但没有在
AppData\\Local
中安装任何文件。这有点令人沮丧。

我想我会回答这个问题。使用
glob()
。我想你会回答这个问题的。使用
glob()