-1

$ スクレイピー バージョン: 0.14 $

$ ファイル: settings.py $

EXTENSIONS = { 'myproject.extensions.MySQLManager': 500 } 

$ファイル:pipeline.py$

# -- coding: utf-8 -- 
# Define your item pipelines here # 
# Don't forget to add your pipeline to the ITEM_PIPELINES setting 
# See: doc.scrapy.org/topics/item-pipeline.html 

from scrapy.project import extensions
from urlparse import urlparse 
import re 
class MySQLStorePipeline(object): 
    def process_item(self, item, spider): 
        if self.is_allowed_domain(item['url'], spider) is True: 
            MySQLManager.cursor... #cannot load MySQLManager

ImportError: 名前拡張子をインポートできません。/scrapy/project.py に拡張クラスが見つかりません

4

1 に答える 1

0

何をインポートしようとしているのかわかりませんが、私が理解している限り、拡張機能を「インポート」したい場合は、scrapy プロジェクトの settings.py ファイルにいくつかの行を追加する必要があります。

例:

EXTENSIONS = {
    'scrapy.contrib.corestats.CoreStats': 500,
    'scrapy.webservice.WebService': 500,
    'scrapy.myextension.myextension': 500,
}

Scrapy 拡張機能の詳細については、こちらをご覧ください

于 2012-09-14T09:38:28.077 に答える