Return more detailed error message in scrapy check
See original GitHub issueWhen I run scrapy check myspider
, it returns an error message of
Unhandled error in Deferred:
----------------------------------------------------------------------
Ran 0 contracts in 0.000s
OK
However, if I run scrapy crawl myspider
, it returns an error message of
2019-04-02 16:37:21 [twisted] CRITICAL: Unhandled error in Deferred:
2019-04-02 16:37:21 [twisted] CRITICAL:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks
result = g.send(result)
File "/usr/local/lib/python3.6/site-packages/scrapy/crawler.py", line 82, in crawl
yield self.engine.open_spider(self.spider, start_requests)
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 61] Connection refused
In the end, it was the database connection that is causing the issue, but in scrapy check
it doesn’t return anything useful for me to debug. I think we should have more details in the error message.
If you guys think this is a good improvement, I will work on this as my first issue in this project. Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How do I catch errors with scrapy so I can do something when ...
It receives a Twisted Failure instance as first parameter. Here's some sample code (for scrapy 1.0) that you can use:
Read more >Requests and Responses — Scrapy 2.7.1 documentation
Return a Request object with the same members, except for those members given new values by whichever keyword arguments are specified. The ...
Read more >Release notes — Scrapy 2.5.0 documentation - Read the Docs
If a downloader middleware returns a Response object from process_response() or ... Removed cookie-handling code specific to Python 2 (issue 4682).
Read more >How To Solve A Scrapy 503 Service Unavailable Error
This means that the server is likely returning the 503 HTTP status code on ... to debug a Scrapy 503 Service Unavailable Error...
Read more >scrapy http status code is not handled or not allowed - You.com
Now, it could technically be possible that these sites return both content and a 404 error code at the same time, but we...
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
Not really. I believe
SPIDER_CONTRACTS
is only necessary for custom contracts, builtin contracts require only to be specified in the docstring of a callback.I’m still new to this so someone please correct me if I’m wrong but I believe, at least in this case, you aren’t ever providing any contracts to be checked.
ITEM_PIPELINES
are executed during ascrapy crawl
after an Item is yielded from the parse function. If you are wanting to execute a contract, you will need to enableSPIDER_CONTRACTS = { 'checker.contracts.SomeContract' }
in your settings and make sure you have aContract
sub-class namedSomeContract
in the./checker/contracts.py
file.