Problem Solving: Scrapy Unknown command: crawl

Today, with pycharm commissioning new scrapy-redis Project error:

Connected to pydev debugger (build 183.4588.64)
Scrapy 1.8.0 - no active project

Unknown command: crawl

Use "scrapy" to see available commands

I did not use scrapy crawl xxxthe form of running scrapy, but wrote a startup script:

main.py:

from scrapy.cmdline import execute
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
execute(["scrapy","crawl","douban_redis"])

I looked at the error reports of others , basically because they did not use scrapy startproject xxxthe lack of which led to the creation scrapy project scrapy.cfgfile, and my project is the existence scrapy.cfgof the file.

My directory structure:
Here Insert Picture Description

So taking into account my startup script may be a problem. But I main.pyin other projects where it is possible, prove that the code part of the problem does not exist.

So taking into account the likely start of a problem with startup environment script, click Edit ConfigurationHere Insert Picture Description

Feel might be Working directorya problem.
Here Insert Picture Description

I looked at the unusual items Working directory:
Here Insert Picture Description

Sure enough, the cause of the error is starting to run the script environment settings error.

Published 673 original articles · won praise 644 · views 380 000 +

Guess you like

Origin blog.csdn.net/zhaohaibo_/article/details/105277768