python - Scrapy 警告禁用 HttpCacheMiddleware

标签 python cron scrapy

运行 scrapy 时收到此警告:

 [scrapy] WARNING: Disabled HttpCacheMiddleware: Unable to find scrapy.cfg file to infer project data dir

最佳答案

你的scrapy.cfg文件在哪里?你是从命令行运行的吗?如果是这样,您应该从与 scrapy.cfg 相同的目录运行。

您的项目目录是什么样的。它应该看起来像:

.
├── dirbot
│   ├── __init__.py
│   ├── items.py
│   ├── pipelines.py
│   ├── settings.py
│   └── spiders
│       ├── dmoz.py
│       └── __init__.py
├── README.rst
└── scrapy.cfg

更新

如果您使用cron,请尽量不要(即不要)使用root 用户。您可以将 PATH 信息直接添加到 crontab 中:How to get CRON to call in the correct PATHs

PATH=/usr/local/sbin:...:/absolute/path/to/my/scrapy/project

关于python - Scrapy 警告禁用 HttpCacheMiddleware,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15746537/

相关文章:

python - 如何检查列表是否存在于 Python 中

amazon-web-services - AWS 上的高可用性周期性任务 (cron)

linux - 计算 cron 的运行时间

mysql - scrapy导出到数据库多个表

python - 抓取 : SSL: CERTIFICATE_VERIFY_FAILED error for http://en. wikipedia.org

Scrapy 蜘蛛中的扭曲错误

python - 在 bs4 中使用 .text 时未获取 json

python - 管道损坏 errno32 LDAP Django

python - 使用 Python 代码实现更快的正交解码器循环

linux - 如何安排 Cron 作业在一年中的第 4 周运行