Error Running Scrapy through script(Py/Shell)
See original GitHub issue1)Running the Scrapy command from the Python script with the subprocess
from subprocess import call import sys
sys.path.append(“SCRAPYPROJECTPATH”) call ([“scrapy”,“crawl”,“example”])
2)Running the Shell Script from the Python Script (The call value from the above script changes to sh shellscriptname.sh)
Output
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 11, in <module>
sys.exit(execute())
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 109, in execute
settings = get_project_settings()
File "/usr/local/lib/python2.7/dist-packages/scrapy/utils/project.py", line 60, in get_project_settings
settings.setmodule(settings_module_path, priority='project')
File "/usr/local/lib/python2.7/dist-packages/scrapy/settings/__init__.py", line 108, in setmodule
module = import_module(module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named project.settings
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Python Shell not running Scrapy - Stack Overflow
when i run it in command shell i get just the text output i want. i've tested on bbc sport and wiki so...
Read more >Scrapy shell — Scrapy 2.7.1 documentation
The Scrapy shell is an interactive shell where you can try and debug your scraping code very quickly, without having to run the...
Read more >Automate the boring stuff chapter 11: Web Scraping
You could take a few steps out of this task by writing a simple script to automatically launch the map in your browser...
Read more >Run Scrapy Spiders from Python Script - YouTube
Learn how to call Scrapy spider from main.py, a question that I get often. You will learn how to run Scrapy multiple spiders...
Read more >Scrapy From one Script: ProcessCrawler - YouTube
In this video I'll show you how to use the Scraper ProcessCrawler to run a scrapy spider without using scrapy crawl command.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kgrvamsi if you’re going to built it with Flask you may find answers at http://stackoverflow.com/questions/36384286/how-to-integrate-flask-scrapy and http://stackoverflow.com/questions/32724537/building-a-restful-flask-api-for-scrapy/32784312 useful.
@kgrvamsi it should work in Scrapy 1.0+, including Scrapy 1.0.5. Note that Scrapy 1.0.x is no longer supported by us; upgrading to 1.1.x is a good idea 😃