Skip to content

Exception raised if the revision date is blank #1219

@cdfarrow

Description

@cdfarrow

I created a .po file with Poedit and it left the PO-Revision-Date field blank in the header. pybabel (2.17.0) raises the following exception when updating or compiling the po file:

 File "C:\<>\Python312\Lib\site-packages\babel\messages\catalog.py", line 102, in _parse_datetime_header
    dt = datetime.datetime.strptime(match.group('datetime'), '%Y-%m-%d %H:%M')
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\<>\Python312\Lib\_strptime.py", line 554, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\<>\Python312\Lib\_strptime.py", line 333, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '' does not match format '%Y-%m-%d %H:%M'

It would be nice to ignore the blank date, or at least, to give a graceful warning/error message.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions