`schematics` required but not installed by default
See original GitHub issueI installed with pip install spidermon
, got 1.9.0.
So I rechecked the installation docs just in case, but trying to use jsonschema validation I get:
2019-04-05 19:51:42 [twisted] CRITICAL:
Traceback (most recent call last):
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/scrapy/crawler.py", line 80, in crawl
self.engine = self._create_engine()
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/scrapy/crawler.py", line 105, in _create_engine
return ExecutionEngine(self, lambda _: self.stop())
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/scrapy/core/engine.py", line 70, in __init__
self.scraper = Scraper(crawler)
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/scrapy/core/scraper.py", line 71, in __init__
self.itemproc = itemproc_cls.from_crawler(crawler)
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/scrapy/middleware.py", line 53, in from_crawler
return cls.from_settings(crawler.settings, crawler)
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/scrapy/middleware.py", line 34, in from_settings
mwcls = load_object(clspath)
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/scrapy/utils/misc.py", line 44, in load_object
mod = import_module(module)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/spidermon/contrib/scrapy/pipelines.py", line 13, in <module>
from spidermon.contrib.validation import SchematicsValidator, JSONSchemaValidator
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/spidermon/contrib/validation/__init__.py", line 1, in <module>
from .schematics.validator import SchematicsValidator
File "/home/andrew/scraping/temp/30/env/lib/python3.6/site-packages/spidermon/contrib/validation/schematics/validator.py", line 4, in <module>
import schematics
ModuleNotFoundError: No module named 'schematics'
Installing schematics
fixed the issue.
It’s possible I have my project misconfigured (#139). My settings look like this:
SPIDERMON_ENABLED = True
EXTENSIONS = {
'spidermon.contrib.scrapy.extensions.Spidermon': 500,
}
ITEM_PIPELINES = {
'spidermon.contrib.scrapy.pipelines.ItemValidationPipeline': 800,
}
SPIDERMON_VALIDATION_ADD_ERRORS_TO_ITEMS = True
SPIDERMON_VALIDATION_SCHEMAS = [
'schema.json',
]
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Types — Schematics 2.1.0 documentation - Read the Docs
required – Invalidate field when value is None or is not supplied. Default: False. default – When no data is provided default to...
Read more >Init my Angular 6 project fails : schematics does not works
Installed packages for tooling via npm. Your project is not using the default configuration for build and test.
Read more >Angular Schematics from 0 to publishing your own library (III)
name and content are argument vectors, in position 0 and 1, as defaults. They're also required. The third value is the extension and...
Read more >Quick Guide to Angular Schematics: How I Built My First ...
Schematics Requirements. Install Angular's official schematics package to use in your terminal: @angular-devkit/schematics-cli ...
Read more >Making an Addable Angular Package Using Schematics
But that's not all, our library will install the necessary dependencies, including polyfills, and will inject the exported module into the ...
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
I agree with all the points here - I think what I’d like to highlight is:
In my case I do not plan to use it, and it’s not documented that
schematics
is required if you want to use jsonschema.This sounds like the proper solution, but https://spidermon.readthedocs.io/en/latest/item-validation.html doesn’t mention
spidermon[validation]
- I would assert that people who decide to add validation later are unlikely to go and re-read the installation docs. And in my case I’m not sure I’ve ever read that page, I actually read these installation instructions which don’t mention validation.–
Since #88 and #89 came up again, I would add my vote for batteries included - this is the only package I’ve ever used that uses the package[opt] notation. Perhaps it would be less confusing though if the validation stuff were broken off, along with dependencies, into a separate spidermon-validation package? Then it would be clear that a separate package is required because you’d get an error doing
import spidermon_validation.whatever
rather than a less instructional error about schematics later.There is a plan to refactor ItemValidationPipeline to remove this requirement. After that you will only be asked to install schematics if your are using it (the same for JSON Schema). For now, you really need to install it to be able to use spidermon.