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

importing library fails. pydantic.errors.PydanticUserError: Field 'decimals' defined on a base class was overridden by a non-annotated attribute #57

Open
pedrodparkes opened this issue Jul 28, 2023 · 1 comment

Comments

@pedrodparkes
Copy link

pedrodparkes commented Jul 28, 2023

tested on Py 3.8, 3.9 in docker containers:
python:3.8-slim
python:3.8-bullseye
python:3.9-alpine3.17
and later py versions.

#0 1.888 Traceback (most recent call last): #0 1.888 File "/main.py", line 1, in <module> #0 1.888 from zksync_sdk import ZkSyncLibrary #0 1.888 File "/usr/local/lib/python3.8/site-packages/zksync_sdk/__init__.py", line 1, in <module> #0 1.888 from .ethereum_provider import EthereumProvider #0 1.888 File "/usr/local/lib/python3.8/site-packages/zksync_sdk/ethereum_provider.py", line 6, in <module> #0 1.888 from zksync_sdk.types import Token #0 1.888 File "/usr/local/lib/python3.8/site-packages/zksync_sdk/types/__init__.py", line 3, in <module> #0 1.888 from .responses import * #0 1.888 File "/usr/local/lib/python3.8/site-packages/zksync_sdk/types/responses.py", line 26, in <module> #0 1.888 class NFT(Token): #0 1.888 File "/usr/local/lib/python3.8/site-packages/pydantic/_internal/_model_construction.py", line 98, in __new__ #0 1.888 private_attributes = inspect_namespace( #0 1.888 File "/usr/local/lib/python3.8/site-packages/pydantic/_internal/_model_construction.py", line 337, in inspect_namespace #0 1.888 raise PydanticUserError( #0 1.888 pydantic.errors.PydanticUserError: Field 'decimals' defined on a base class was overridden by a non-annotated attribute. All field definitions, including overrides, require a type annotation. #0 1.888 #0 1.888 For further information visit https://errors.pydantic.dev/2.1.1/u/model-field-overridden

docker-compose build fails with other error.

@oldwizard1010
Copy link

oldwizard1010 commented Jul 29, 2023

zksync_sdk/types/responses.py
class NFT(Token):
    creator_id: int
    content_hash: str
    creator_address: str
    serial_id: int
    decimals: int = 0

fix it like this

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

2 participants