diff --git a/cdisutils/storage3.py b/cdisutils/storage3.py index 73d1a7e..c52fe5f 100644 --- a/cdisutils/storage3.py +++ b/cdisutils/storage3.py @@ -18,11 +18,11 @@ import sys import time from builtins import next, object, str, zip -from io import StringIO as BIO from urllib.parse import urlparse import boto3 import urllib3 +import six from botocore.exceptions import ClientError from .log import get_logger @@ -345,7 +345,7 @@ def create_multipart_upload(self, src_url=None, dst_url=None): multipart_info["dst_info"] = self.parse_url(url=dst_url) multipart_info["src_info"] = self.parse_url(url=src_url) - multipart_info["stream_buffer"] = BIO() + multipart_info["stream_buffer"] = six.BytesIO() multipart_info["mp_chunk_size"] = self.mp_chunk_size multipart_info["download_chunk_size"] = self.chunk_size multipart_info["cur_size"] = 0 @@ -404,7 +404,7 @@ def upload_multipart_chunk(self, mp_info): else: mp_info["cur_size"] = 0 mp_info["stream_buffer"].close() - mp_info["stream_buffer"] = BIO() + mp_info["stream_buffer"] = six.BytesIO() mp_info_part = { "ETag": result["ETag"], "PartNumber": mp_info["chunk_index"], @@ -424,10 +424,10 @@ def copy_multipart_file( multipart between object stores """ - if isinstance(src_info, str): + if isinstance(src_info, six.string_types): src_url = src_info src_info = self.parse_url(url=src_url) - if isinstance(dst_info, str): + if isinstance(dst_info, six.string_types): dst_url = dst_info dst_info = self.parse_url(url=dst_url)