I got this error message in Scrapy spider, when I was writing the html of website to file.
with open('{}.html'.format(name), 'wb') as html_file:
FileNotFoundError: [Errno 2] No such file or directory:'CHARCOAL.html'
98% of the websites html were written correctly, however some threw this error (different file names).To make sure I printed the names and they all exist.
this is the code I use to write to files
#code here
name = response.xpath('//*[@id="itemTitle"]//text()').extract()[1]
with open('{}.html'.format(name), 'wb') as html_file:
html_file.write(response.body)