I’m doing a tutorial for a web scraping framework in python and I keep getting this issue. I already have the latest version of it installed. Any ideas?
Error:
Traceback (most recent call last):
File "/home/dominic/code/imgspider/imgspider/spiders/img_spider.py", line 3, in <module>
import scrapy
ModuleNotFoundError: No module named 'scrapy'
Code:
#!/usr/bin/env python3
import scrapy
class ImageSpider(scrapy.Spider):
name = "images"
def start_requests(self):
# links go here
urls = [
'http://quotes.toscrape.com/page/1/',
'http://quotes.toscrape.com/page/2/'
]
for url in urls:
yield scrapy.Request(url=url, callback=self.parse)
def parse(self, response):
page = response.url.split("/")[-2]
filename = 'quotes-%s.html' % page
with open(filename, 'wb') as f:
f.write(response.body)
self.log('Saved file %s' % filename)