Skip to content

Commit 38ba307

Browse files
andrewferlitschAlex Hong
authored and
Alex Hong
committed
* fix decode problem * fix decode * fix decode
1 parent 9aa23e6 commit 38ba307

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

samples/snippets/snippets.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
def sentiment_text():
2929
# [START language_sentiment_text]
30-
import six
3130
from google.cloud import language
3231
from google.cloud.language import enums
3332
from google.cloud.language import types
@@ -36,8 +35,10 @@ def sentiment_text():
3635

3736
client = language.LanguageServiceClient()
3837

39-
if isinstance(text, six.binary_type):
38+
try:
4039
text = text.decode('utf-8')
40+
except AttributeError:
41+
pass
4142

4243
# Instantiates a plain text document.
4344
# [START language_python_migration_sentiment_text]

0 commit comments

Comments
 (0)