Skip to content

Vision raises TypeError: b'...' is not JSON serializable on Python 3 #2525

@theacodes

Description

@theacodes

Simple reproducible case:

import io
import os

from google.cloud import vision

vision_client = vision.Client()

file_name = os.path.join(
    os.path.dirname(__file__),
    'resources/wakeupcat.jpg')

with io.open(file_name, 'rb') as image_file:
    image = vision_client.image(
        content=image_file.read())

labels = image.detect_labels()

print('Labels:')
for label in labels:
    print(label.description)

works fine on Python 2, fails on Python 3.

Metadata

Metadata

Assignees

Labels

api: visionIssues related to the Cloud Vision API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions