Skip to content

ValueError: year 0 is out of range #191

@bnewbold

Description

@bnewbold
  File "/home/bnewbold/scratch/ingests/scielo/.venv/lib/python3.7/site-packages/xylose/scielodocument.py", line 917, in first_year
    return str(datetime.datetime.strptime(year, '%Y').year)
  File "/usr/lib/python3.7/_strptime.py", line 577, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/lib/python3.7/_strptime.py", line 544, in _strptime
    datetime_date(year, 1, 1).toordinal() + 1
ValueError: year 0 is out of range

Python version: Python 3.7
xylose version: 1.35.4

I think that around here: https://github.com/scieloorg/xylose/blob/master/xylose/scielodocument.py#L954

There should be a check if year == 0 and return None if so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions