Skip to content

Upload annotated dataset via Python API raises AttributeError but upload via WebUI works fine #322

Closed
@gpadiolleau

Description

@gpadiolleau

I'm trying to upload a dataset via Python API with annotations file in JSON.

But the upload fails after one image is uploaded with an Python AttributeError:

File "/home/user/anaconda3/envs/py310_roboflow/lib/python3.10/site-packages/roboflow/core/project.py", line 451, in upload
    self.single_upload(
  File "/home/user/anaconda3/envs/py310_roboflow/lib/python3.10/site-packages/roboflow/core/project.py", line 581, in single_upload
    uploaded_annotation, annotation_time = self.save_annotation(
  File "/home/user/anaconda3/envs/py310_roboflow/lib/python3.10/site-packages/roboflow/core/project.py", line 522, in save_annotation
    annotation = rfapi.save_annotation(
  File "/home/user/anaconda3/envs/py310_roboflow/lib/python3.10/site-packages/roboflow/adapters/rfapi.py", line 169, in save_annotation
    raise _save_annotation_error(response)
  File "/home/user/anaconda3/envs/py310_roboflow/lib/python3.10/site-packages/roboflow/adapters/rfapi.py", line 239, in _save_annotation_error
    if err_msg.get("message"):
AttributeError: 'str' object has no attribute 'get'

It appears that the error message returned by API call is not handled, since the real API response is:

responsejson={'error': 'Unknown error'}
err_msg='Unknown error'

When I try to upload the annotated dataset via the WebUI, it works fine.
How can I have further information about the error ?

Edit: I followed step-by-step the tutorial (https://docs.roboflow.com/api-reference/images/upload-an-annotation) to find if I'm doing something wrong, but get the exact same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions