From feb32166706c373b28d8a3e0d65f5c3be01ed917 Mon Sep 17 00:00:00 2001 From: Catherine Holloway Date: Tue, 16 Jan 2018 09:25:26 -0500 Subject: [PATCH] encode unicode str --- python/src/cloudstorage/storage_api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/src/cloudstorage/storage_api.py b/python/src/cloudstorage/storage_api.py index 26254fd..abfa8f9 100644 --- a/python/src/cloudstorage/storage_api.py +++ b/python/src/cloudstorage/storage_api.py @@ -759,7 +759,9 @@ def write(self, data): TypeError: if data is not of type str. """ self._check_open() - if not isinstance(data, str): + if isinstance(data, unicode): + data = data.encode('utf-8') + elif not isinstance(data, str): raise TypeError('Expected str but got %s.' % type(data)) if not data: return