You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
assignments of dict list is not supported for repeated field #135
from google.cloud import vision_v1
import proto
import json
request = dict(image=vision_v1.Image(content=b"content"))
batch_req = vision_v1.BatchAnnotateImagesRequest()
# This works (converting the dict to AnnotateImageRequest first, then form a list)
# batch_req.requests = [vision_v1.AnnotateImageRequest(request)]
# This throws exception (assigning the list of dict directly)
batch_req.requests = [request]
The last line throws the following exceptions:
TypeError: Parameter to MergeFrom() must be instance of same class: expected google.cloud.vision.v1.Image got Image.
Activity
software-dov commentedon Apr 12, 2021
The workaround is to not assign repeated fields from lists of dicts.
The following should work:
Or to use the indirect method described in the issue text above.
Dropping priority to P3 since workarounds exist.
parthea commentedon Mar 16, 2023
I can no longer reproduce this issue. Please open a new issue if you're still experiencing the problem.