Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #5970 #6082

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions scrapy/commands/crawl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import logging

from scrapy.commands import BaseRunSpiderCommand
from scrapy.exceptions import UsageError

logger = logging.getLogger(__name__)


class Command(BaseRunSpiderCommand):
requires_project = True
Expand All @@ -12,6 +16,27 @@ def short_desc(self):
return "Run a spider"

def run(self, args, opts):
if opts.output:
extensions_base = self.settings.getdict("EXTENSIONS_BASE")
extensions = self.settings.getdict("EXTENSIONS")

feed_exporter_base = extensions_base.get(
"scrapy.extensions.feedexport.FeedExporter"
)
feed_exporter = extensions.get("scrapy.extensions.feedexport.FeedExporter")

if feed_exporter_base is None:
logger.warning(
"A file output was specified but the FeedExporter extension is not enabled in EXTENSIONS_BASE."
)
elif (
"scrapy.extensions.feedexport.FeedExporter" in extensions.keys()
and feed_exporter is None
):
logger.warning(
"A file output was specified but the FeedExporter extension is not enabled in EXTENSIONS."
)

if len(args) < 1:
raise UsageError()
elif len(args) > 1:
Expand Down