Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 790f10d

Browse files
author
Elizabeth Crowdus
committed
more specific exceptions import
1 parent 616dc11 commit 790f10d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

translate/cloud-client/hybrid_glossaries/hybrid_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import html
2020

2121
# Imports the Google Cloud client libraries
22-
import google.api_core.exceptions
22+
from google.api_core.exceptions import AlreadyExists
2323
from google.cloud import translate_v3beta1 as translate
2424
from google.cloud import vision
2525
from google.cloud import texttospeech
@@ -113,7 +113,7 @@ def create_glossary(languages, project_id, glossary_name, glossary_uri):
113113
operation = client.create_glossary(parent=parent, glossary=glossary)
114114
operation.result(timeout=90)
115115
print('Created glossary ' + glossary_name + '.')
116-
except google.api_core.exceptions.AlreadyExists:
116+
except AlreadyExists:
117117
print('The glossary ' + glossary_name +
118118
' already exists. No new glossary was created.')
119119
# [END translate_hybrid_create_glossary]

0 commit comments

Comments
 (0)