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

Exports list formats giving error: 12 validation errors for ParsingModel[List[str]] #311

Open
Duoquote opened this issue Sep 16, 2024 · 0 comments

Comments

@Duoquote
Copy link

My code is as follows:

from label_studio_sdk import ExportCreate
from label_studio_sdk.client import LabelStudio

LABEL_STUDIO_URL = '...'
API_KEY = '....'
PROJECT_ID = 1

ls = LabelStudio(base_url=LABEL_STUDIO_URL, api_key=API_KEY)
ls.projects.exports.list_formats(id=PROJECT_ID)

The error I get:

---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
File g:\projects\test-detect\get_data.py:1
----> 1 ls.projects.exports.list_formats(id=PROJECT_ID)

File g:\projects\test-detect\venv\lib\site-packages\label_studio_sdk\projects\exports\client.py:154, in ExportsClient.list_formats(self, id, request_options)
    152 try:
    153     if 200 <= _response.status_code < 300:
--> 154         return pydantic_v1.parse_obj_as(typing.List[str], _response.json())  # type: ignore
    155     _response_json = _response.json()
    156 except JSONDecodeError:

File g:\projects\test-detect\venv\lib\site-packages\pydantic\v1\tools.py:38, in parse_obj_as(type_, obj, type_name)
     36 def parse_obj_as(type_: Type[T], obj: Any, *, type_name: Optional[NameFactory] = None) -> T:
     37     model_type = _get_parsing_type(type_, type_name=type_name)  # type: ignore[arg-type]
---> 38     return model_type(__root__=obj).__root__

File g:\projects\test-detect\venv\lib\site-packages\pydantic\v1\main.py:341, in BaseModel.__init__(__pydantic_self__, **data)
    339 values, fields_set, validation_error = validate_model(__pydantic_self__.__class__, data)
    340 if validation_error:
--> 341     raise validation_error
    342 try:
    343     object_setattr(__pydantic_self__, '__dict__', values)

ValidationError: 12 validation errors for ParsingModel[List[str]]
__root__ -> 0
  str type expected (type=type_error.str)
__root__ -> 1
  str type expected (type=type_error.str)
__root__ -> 2
  str type expected (type=type_error.str)
__root__ -> 3
  str type expected (type=type_error.str)
__root__ -> 4
  str type expected (type=type_error.str)
__root__ -> 5
  str type expected (type=type_error.str)
__root__ -> 6
  str type expected (type=type_error.str)
__root__ -> 7
  str type expected (type=type_error.str)
__root__ -> 8
  str type expected (type=type_error.str)
__root__ -> 9
  str type expected (type=type_error.str)
__root__ -> 10
  str type expected (type=type_error.str)
__root__ -> 11
  str type expected (type=type_error.str)
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

1 participant