Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'format_set' object has no attribute 'format_str' #37

Open
NiklasRosenstein opened this issue Feb 24, 2023 · 0 comments
Assignees

Comments

@NiklasRosenstein
Copy link
Owner

While trying to deserialize a datetime formatted as 2023-02-20 18:00:00.000.

File ~/jupyterlab/env/lib/python3.10/site-packages/databind/core/converter.py:80, in Module.convert(self, ctx)
     78 for converter in self.get_converters(ctx):
     79     try:
---> 80         return converter.convert(ctx)
     81     except NotImplementedError:
     82         pass

File ~/jupyterlab/env/lib/python3.10/site-packages/databind/json/converters.py:167, in DatetimeConverter.convert(self, ctx)
    165 elif isinstance(ctx.value, str):
    166     try:
--> 167         dt: t.Any = datefmt.parse(date_type, ctx.value)
    168     except ValueError as exc:
    169         raise ConversionError(self, ctx, str(exc))

File ~/jupyterlab/env/lib/python3.10/site-packages/databind/core/settings.py:587, in DateFormat.parse(self, type_, value)
    585     except ValueError:
    586         pass
--> 587 raise self._formulate_parse_error(list(self.__iter_formats(format_t)), value)

File ~/jupyterlab/env/lib/python3.10/site-packages/databind/core/settings.py:619, in DateFormat._formulate_parse_error(formats, s)
    616 @staticmethod
    617 def _formulate_parse_error(formats: t.Sequence[t.Any], s: t.Any) -> ValueError:
    618     return ValueError(
--> 619         f'"{s}" does not match date formats ({len(formats)}):' + "".join(f"\n  | {x.format_str}" for x in formats)
    620     )

File ~/jupyterlab/env/lib/python3.10/site-packages/databind/core/settings.py:619, in <genexpr>(.0)
    616 @staticmethod
    617 def _formulate_parse_error(formats: t.Sequence[t.Any], s: t.Any) -> ValueError:
    618     return ValueError(
--> 619         f'"{s}" does not match date formats ({len(formats)}):' + "".join(f"\n  | {x.format_str}" for x in formats)
    620     )

AttributeError: 'format_set' object has no attribute 'format_str'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant