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

Example does not work with pydantic >1.9 #6

Open
apirogov opened this issue Aug 5, 2022 · 2 comments
Open

Example does not work with pydantic >1.9 #6

apirogov opened this issue Aug 5, 2022 · 2 comments

Comments

@apirogov
Copy link

apirogov commented Aug 5, 2022

I could not run the example in the README:

from pydantic_schemaorg.ScholarlyArticle import ScholarlyArticle
scholarly_article = ScholarlyArticle(url='https://github.com/lexiq-legal/pydantic_schemaorg',
                                        sameAs='https://github.com/lexiq-legal/pydantic_schemaorg',
                                        copyrightNotice='Free to use under the MIT license',
                                        dateCreated='15-12-2021')

raises for me

  File "pydantic/typing.py", line 551, in pydantic.typing.update_model_forward_refs
    
  File "pydantic/typing.py", line 526, in pydantic.typing.update_field_forward_refs
    return NotImplemented
  File "pydantic/typing.py", line 526, in pydantic.typing.update_field_forward_refs
    return NotImplemented
  File "pydantic/typing.py", line 526, in pydantic.typing.update_field_forward_refs
    return NotImplemented
  File "pydantic/typing.py", line 521, in pydantic.typing.update_field_forward_refs
    self.__forward_evaluated__ = True
  File "pydantic/typing.py", line 69, in pydantic.typing.evaluate_forwardref
    'Coroutine',
  File ".../python3.8/typing.py", line 518, in _evaluate
    eval(self.__forward_code__, globalns, localns),
  File "<string>", line 1, in <module>
NameError: name 'URL' is not defined
@crbaker89
Copy link
Member

@apirogov I see that it an issue on python < 3.9. Switching to python 3.9 can resolve your issue.

In the mean time i will put this issue on the backlog

@ohad-alike
Copy link

I'm having this as well. downgrading to pydantic==1.9.0 did not solve this. we are using python 3.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants