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

[Bug]: ValidationError 6 validation errors for MoleculeSummaryDoc builder_meta.build_date #922

Open
1 of 3 tasks
funihang opened this issue Jul 12, 2024 · 2 comments
Open
1 of 3 tasks
Labels
bug Something isn't working

Comments

@funihang
Copy link

Code snippet

from mp_api.client import MPRester

with MPRester(api_key) as mpr:
    docs = mpr.molecules.summary.search()

What happened?

I am attempting to get molecules from API using the attached code. It can work at first, but when the progress bar reaches 155361/221598, an error will be reported. Could you please check it?

Version

mp-api 0.41.2

Which OS?

  • MacOS
  • Windows
  • Linux

Log output

ValidationError: 6 validation errors for MoleculeSummaryDoc
builder_meta.build_date
  Value error, Invalid isoformat string: '2023-11-07T22:35:04.718Z' [type=value_error, input_value={'$date': '2023-11-07T22:35:04.718Z'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/value_error
last_updated
  Input should be a valid datetime [type=datetime_type, input_value={'$date': '2023-11-07T22:35:04.718Z'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/datetime_type
origins.0.last_updated
  Value error, Invalid isoformat string: '2020-11-11T12:51:27.833Z' [type=value_error, input_value={'$date': '2020-11-11T12:51:27.833Z'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/value_error
origins.1.last_updated
  Value error, Invalid isoformat string: '2023-08-03T18:52:51.206Z' [type=value_error, input_value={'$date': '2023-08-03T18:52:51.206Z'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/value_error
origins.2.last_updated
  Value error, Invalid isoformat string: '2020-11-11T12:51:27.833Z' [type=value_error, input_value={'$date': '2020-11-11T12:51:27.833Z'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/value_error
has_props
  Input should be a valid list [type=list_type, input_value={'materials': True, 'ther...lse, 'substrates': True}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/list_type
@funihang funihang added the bug Something isn't working label Jul 12, 2024
@munrojm
Copy link
Member

munrojm commented Jul 18, 2024

I will investigate this. For now, you can pass use_document_model=False to MPRester to fix the issue. Note the data will. be returned as dictionaries instead of MPDataDoc objects.

@funihang
Copy link
Author

I will investigate this. For now, you can pass use_document_model=False to MPRester to fix the issue. Note the data will. be returned as dictionaries instead of MPDataDoc objects.

Thanks for your reply. I reinstalled my conda env and downgraded python version to 3.8. It works now, although I'm unsure which step resolved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants