Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A problem with installing scrapy
#11
this is what I get when working on the tutorial.

C:\Python36\kodovi>scrapy crawl quotes
Scrapy 1.6.0 - no active project

Unknown command: crawl

Use "scrapy" to see available commands
Reply
#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
#13
now when I started from the right folder it works
C:\Python36\kodovi\tutorial\tutorial\spiders>scrapy crawl quotes
2019-05-26 01:22:37 [scrapy.utils.log] INFO: Scrapy 1.6.0 started (bot: tutorial
)
2019-05-26 01:22:37 [scrapy.utils.log] INFO: Versions: lxml 4.2.4.0, libxml2 2.9
.5, cssselect 1.0.3, parsel 1.5.1, w3lib 1.19.0, Twisted 19.2.0, Python 3.6.4 (v
3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)], pyOpenSSL 18.
0.0 (OpenSSL 1.1.0j  20 Nov 2018), cryptography 2.4.2, Platform Windows-7-6.1.76
01-SP1
2019-05-26 01:22:37 [scrapy.crawler] INFO: Overridden settings: {'BOT_NAME': 'tu
torial', 'NEWSPIDER_MODULE': 'tutorial.spiders', 'ROBOTSTXT_OBEY': True, 'SPIDER
_MODULES': ['tutorial.spiders']}
2019-05-26 01:22:37 [scrapy.extensions.telnet] INFO: Telnet Password: efa59b5328
9793c7
2019-05-26 01:22:38 [scrapy.middleware] INFO: Enabled extensions:
['scrapy.extensions.corestats.CoreStats',
 'scrapy.extensions.telnet.TelnetConsole',
 'scrapy.extensions.logstats.LogStats']
2019-05-26 01:22:40 [scrapy.middleware] INFO: Enabled downloader middlewares:
['scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware',
 'scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware',
 'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware',
 'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware',
 'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware',
 'scrapy.downloadermiddlewares.retry.RetryMiddleware',
 'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware',
 'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware',
 'scrapy.downloadermiddlewares.redirect.RedirectMiddleware',
 'scrapy.downloadermiddlewares.cookies.CookiesMiddleware',
 'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware',
 'scrapy.downloadermiddlewares.stats.DownloaderStats']
2019-05-26 01:22:40 [scrapy.middleware] INFO: Enabled spider middlewares:
['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware',
 'scrapy.spidermiddlewares.offsite.OffsiteMiddleware',
 'scrapy.spidermiddlewares.referer.RefererMiddleware',
 'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware',
 'scrapy.spidermiddlewares.depth.DepthMiddleware']
2019-05-26 01:22:40 [scrapy.middleware] INFO: Enabled item pipelines:
[]
2019-05-26 01:22:40 [scrapy.core.engine] INFO: Spider opened
2019-05-26 01:22:41 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pag
es/min), scraped 0 items (at 0 items/min)
2019-05-26 01:22:41 [scrapy.extensions.telnet] INFO: Telnet console listening on
 127.0.0.1:6023
2019-05-26 01:22:41 [scrapy.core.engine] DEBUG: Crawled (404) <GET http://quotes
.toscrape.com/robots.txt> (referer: None)
2019-05-26 01:22:41 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://quotes
.toscrape.com/page/1/> (referer: None)
2019-05-26 01:22:41 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://quotes
.toscrape.com/page/2/> (referer: None)
2019-05-26 01:22:42 [quotes] DEBUG: Saved file quotes-1.html
2019-05-26 01:22:42 [quotes] DEBUG: Saved file quotes-2.html
2019-05-26 01:22:42 [scrapy.core.engine] INFO: Closing spider (finished)
2019-05-26 01:22:42 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'downloader/request_bytes': 678,
 'downloader/request_count': 3,
 'downloader/request_method_count/GET': 3,
 'downloader/response_bytes': 5976,
 'downloader/response_count': 3,
 'downloader/response_status_count/200': 2,
 'downloader/response_status_count/404': 1,
 'finish_reason': 'finished',
 'finish_time': datetime.datetime(2019, 5, 25, 23, 22, 42, 114966),
 'log_count/DEBUG': 5,
 'log_count/INFO': 9,
 'response_received_count': 3,
 'robotstxt/request_count': 1,
 'robotstxt/response_count': 1,
 'robotstxt/response_status_count/404': 1,
 'scheduler/dequeued': 2,
 'scheduler/dequeued/memory': 2,
 'scheduler/enqueued': 2,
 'scheduler/enqueued/memory': 2,
 'start_time': datetime.datetime(2019, 5, 25, 23, 22, 41, 349923)}
2019-05-26 01:22:42 [scrapy.core.engine] INFO: Spider closed (finished)
Reply
#14
How do you get along ?
Reply
#15
Good, it works.
Reply
#16
Fine.
Reply
#17
It's super easy to solve. You can install twisted manually. Here's the solution for this: Instant Solution for Scrapy failed building wheel for Twisted
Reply
#18
thanks, but I don't need it anymore :D
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Old problem back hunting me installing Blue Dog 4 3,318 Jun-02-2018, 09:49 AM
Last Post: Blue Dog
  Scrapy-cut: Advanced Cookiecutter Scrapy Templating scriptso 2 4,612 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