Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/363.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/57.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
pythonegg:包含顶级目录_Python_Egg_Scrapyd - Fatal编程技术网

pythonegg:包含顶级目录

pythonegg:包含顶级目录,python,egg,scrapyd,Python,Egg,Scrapyd,我们有类似的东西: /dir/ subdir1/ subdir1-1/ (some module) setup.py subdir1-2/ (another module) subdir2/ (another module) 来自subdir1-2的代码使用(=导入)来自subdir2模块的代码

我们有类似的东西:

/dir/
    subdir1/
           subdir1-1/
                    (some module)
                    setup.py
           subdir1-2/
                    (another module)
    subdir2/
           (another module)
来自subdir1-2的代码使用(=导入)来自subdir2模块的代码。一切都很好,直到我们想要将subdir2打包到EGG中(来自subdir1-1)并重新使用它。似乎EGG无法从高级目录中打包任何内容

我们的setup.py:

data_files=[
    (root, [os.path.join(root, f) for f in files])
    for root, _, files in itertools.chain(
        os.walk('some_module'),
        os.walk('../subdir2'),  # DOES NOT WORK!
        os.walk('../../subdir2),  # DOES NOT WORK!
        os.walk(os.path.join(current_dir, '..', 'subdir2')),  # DOES NOT WORK
        os.walk(os.path.join(current_dir, '..', '..', 'subdir2'))  # DOES NOT WORK AS WELL!
    )
],
我们还尝试将模块添加到sys.path中,但没有成功。位于内部目录中的任何模块都可以正常工作。来自更高级别目录的任何模块都不工作

我是通过内存编写的,所以请不要在我上面提供的代码中查找错误类型-在我们的代码中,我们编写了100%正确的代码-没有拼写错误,没有错误的级别目录(比如..而不是../)

问题恰恰是这样的:更高级别的dir没有包含在EGG中;或者我们不能使用它们

这里的答案是:不起作用

Scrapyd 0.24,Python 2.7(标准Ubuntu 14.04 x64包)

谢谢


另外,我们正在使用Scrapyd将代码打包成蛋。调试这样一个“智能”解决方案真的很痛苦(毕竟,谁决定使用这样一个噩梦般的部署解决方案?如果我们能扔掉Scrapyd…。

将setup.py移到/dir/并相应地重写所有内容

它的工作方式1-1是构建树的根,所以不,你不能超过这个。在生成的egg中也起作用,因此不能包含更高级别的dir,如果包含,则不能使用它们