From b44aabe70c6e5fa3ef1ea9ebccd2fd32fe87ddfe Mon Sep 17 00:00:00 2001 From: Yu-Han Liu Date: Thu, 30 May 2019 20:49:55 -0700 Subject: [PATCH] fix python2 print unicode issue [(#2183)](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/2183) --- videointelligence/samples/analyze/beta_snippets.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/videointelligence/samples/analyze/beta_snippets.py b/videointelligence/samples/analyze/beta_snippets.py index 356b9ec114d0..ba5bbef3e581 100644 --- a/videointelligence/samples/analyze/beta_snippets.py +++ b/videointelligence/samples/analyze/beta_snippets.py @@ -206,7 +206,8 @@ def track_objects_gcs(gcs_uri): # Get only the first annotation for demo purposes. object_annotation = object_annotations[0] - print('Entity description: {}'.format( + # description is in Unicode + print(u'Entity description: {}'.format( object_annotation.entity.description)) if object_annotation.entity.entity_id: print('Entity id: {}'.format(object_annotation.entity.entity_id)) @@ -259,7 +260,8 @@ def track_objects(path): # Get only the first annotation for demo purposes. object_annotation = object_annotations[0] - print('Entity description: {}'.format( + # description is in Unicode + print(u'Entity description: {}'.format( object_annotation.entity.description)) if object_annotation.entity.entity_id: print('Entity id: {}'.format(object_annotation.entity.entity_id)) @@ -343,7 +345,8 @@ def stream_generator(): description = annotation.entity.description # Every annotation has only one frame confidence = annotation.frames[0].confidence - print('\t{} (confidence: {})'.format(description, confidence)) + # description is in Unicode + print(u'\t{} (confidence: {})'.format(description, confidence)) # [END video_streaming_label_detection_beta] @@ -463,7 +466,8 @@ def stream_generator(): # track_id tracks the same object in the video. track_id = annotation.track_id - print('\tEntity description: {}'.format(description)) + # description is in Unicode + print(u'\tEntity description: {}'.format(description)) print('\tTrack Id: {}'.format(track_id)) if annotation.entity.entity_id: print('\tEntity id: {}'.format(annotation.entity.entity_id))