question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Return more detailed error message in scrapy check

See original GitHub issue

When 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:open
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Gallaeciocommented, Mar 4, 2021

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.

0reactions
herodionemcommented, Mar 4, 2021

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 a scrapy crawl after an Item is yielded from the parse function. If you are wanting to execute a contract, you will need to enable SPIDER_CONTRACTS = { 'checker.contracts.SomeContract' } in your settings and make sure you have a Contract sub-class named SomeContract in the ./checker/contracts.py file.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found