Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A problem with installing scrapy
#12
(May-24-2019, 11:41 PM)Truman Wrote: this is what I get when working on the tutorial.
Have you made the project(scrapy startproject tutorial) and run it in right folder?

(May-24-2019, 11:41 PM)Truman Wrote: C:\Python36\kodovi>
This is not the right folder,startproject command over make a folder tutorial
You most read the tutorial again and follow every step.

Here some navigation,i use cmder.
# Top folder after run "scrapy startproject tutorial"
# Here you run "scrapy crawl quotes"
E:\div_code\scrapy_files\tutorial
λ ls
scrapy.cfg  tutorial/

# cd in
E:\div_code\scrapy_files\tutorial
λ cd tutorial\

# Files in tutorial folder
E:\div_code\scrapy_files\tutorial\tutorial
λ ls
__init__.py  __pycache__/  items.py  middlewares.py  pipelines.py  settings.py  spiders/

# cd in
E:\div_code\scrapy_files\tutorial\tutorial
λ cd spiders\

# Files in spider folder
E:\div_code\scrapy_files\tutorial\tutorial\spiders
λ ls
__init__.py  __pycache__/  quotes_spider.py

# This is a file you make "quotes_spider.py"
E:\div_code\scrapy_files\tutorial\tutorial\spiders
λ cat quotes_spider.py
import scrapy


class QuotesSpider(scrapy.Spider):
    name = "quotes"

    def start_requests(self):
        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)
E:\div_code\scrapy_files\tutorial\tutorial\spiders
Reply


Messages In This Thread
A problem with installing scrapy - by Truman - May-21-2019, 12:57 AM
RE: A problem with installing scrapy - by snippsat - May-21-2019, 05:10 AM
RE: A problem with installing scrapy - by heiner55 - May-21-2019, 05:11 AM
RE: A problem with installing scrapy - by Truman - May-21-2019, 01:42 PM
RE: A problem with installing scrapy - by snippsat - May-21-2019, 02:09 PM
RE: A problem with installing scrapy - by Truman - May-21-2019, 10:08 PM
RE: A problem with installing scrapy - by snippsat - May-21-2019, 10:43 PM
RE: A problem with installing scrapy - by Truman - May-21-2019, 11:09 PM
RE: A problem with installing scrapy - by snippsat - May-22-2019, 10:16 PM
RE: A problem with installing scrapy - by Truman - May-23-2019, 11:46 PM
RE: A problem with installing scrapy - by Truman - May-24-2019, 11:41 PM
RE: A problem with installing scrapy - by snippsat - May-25-2019, 07:28 AM
RE: A problem with installing scrapy - by Truman - May-25-2019, 11:25 PM
RE: A problem with installing scrapy - by heiner55 - May-29-2019, 02:49 AM
RE: A problem with installing scrapy - by Truman - May-29-2019, 10:34 PM
RE: A problem with installing scrapy - by heiner55 - May-30-2019, 03:52 AM
RE: A problem with installing scrapy - by bishwasbh - May-16-2020, 05:21 AM
RE: A problem with installing scrapy - by Truman - May-24-2020, 07:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Old problem back hunting me installing Blue Dog 4 3,434 Jun-02-2018, 09:49 AM
Last Post: Blue Dog
  Scrapy-cut: Advanced Cookiecutter Scrapy Templating scriptso 2 4,717 Feb-02-2017, 07:57 PM
Last Post: scriptso

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020