-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
- pywhip version: 0.3.3
- Python version: 3.7
- Operating System: Mac OS
Description
Traceback:
$ python mytest.py
mytest.py:5: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
specifications = yaml.load(whip_specs_file)
Traceback (most recent call last):
File "mytest.py", line 8, in <module>
specifications, delimiter='\t')
File "/Users/nicolas_noe/miniconda3/envs/tmp-feb28/lib/python3.7/site-packages/pywhip/pywhip.py", line 86, in whip_csv
field_names, maxentries)
File "/Users/nicolas_noe/miniconda3/envs/tmp-feb28/lib/python3.7/site-packages/pywhip/pywhip.py", line 347, in _whip
self.validation.validate(row) # apply specification rules
File "/Users/nicolas_noe/miniconda3/envs/tmp-feb28/lib/python3.7/site-packages/cerberus/validator.py", line 877, in validate
self.__validate_definitions(definitions, field)
File "/Users/nicolas_noe/miniconda3/envs/tmp-feb28/lib/python3.7/site-packages/cerberus/validator.py", line 940, in __validate_definitions
result = validate_rule(rule)
File "/Users/nicolas_noe/miniconda3/envs/tmp-feb28/lib/python3.7/site-packages/cerberus/validator.py", line 922, in validate_rule
return validator(definitions.get(rule, None), field, value)
File "/Users/nicolas_noe/miniconda3/envs/tmp-feb28/lib/python3.7/site-packages/pywhip/validators.py", line 314, in _validate_mindate
if event_date < min_date:
TypeError: can't compare offset-naive and offset-aware datetimes
What I Did
Ran:
import yaml
from pywhip import whip_csv
with open("specs.yaml") as whip_specs_file:
specifications = yaml.load(whip_specs_file)
observations_whip = whip_csv("occurrence.txt",
specifications, delimiter='\t')
with open("report_observations.html", "w") as index_page:
index_page.write(observations_whip.get_report('html'))
With:
country:
allowed: [BE, NL]
eventDate:
dateformat: '%Y-%m-%d'
mindate: 2016-01-01
maxdate: 2018-12-31
individualCount:
numberformat: x # needs to be an integer value
min: 1
max: 100
Reactions are currently unavailable