Key_Error using Black Pearl python_sdk_ds3

31 views
Skip to first unread message

Mark Suhovecky

unread,
May 7, 2021, 9:01:37 AM5/7/21
to Spectra Logic S3 SDKs, APIs, and RioBroker
I have a python script that uses the old 2.7 python_sdk_ds3 to copy local files in bulk to the black pearl. Most of the time it works fine. Sometimes, however, I get this error:

Traceback (most recent call last):
  File "./ds3cp", line 164, in <module>
    UploadInBulk(uploadList)
  File "./ds3cp", line 110, in UploadInBulk
    job=bulkResult.result['JobId']))
  File "/usr/lib/python2.7/site-packages/ds3/ds3.py", line 11319, in put_object
    return PutObjectResponse(self.net_client.get_response(request), request)
  File "/usr/lib/python2.7/site-packages/ds3/ds3network.py", line 168, in get_response
    response = self.send_request(request)
  File "/usr/lib/python2.7/site-packages/ds3/ds3network.py", line 192, in send_request
    path = self.build_path(request.path, request.query_params)
  File "/usr/lib/python2.7/site-packages/ds3/ds3network.py", line 295, in build_path
    new_path = self.normalize_string(resource) + '?'
  File "/usr/lib/python2.7/site-packages/ds3/ds3network.py", line 290, in normalize_string
    return urllib.quote(url)
  File "/usr/lib64/python2.7/urllib.py", line 1283, in quote
    return ''.join(map(quoter, s))
KeyError: u'\xa0'

My keys include file pathnames that sometimes contain unicode. I'm guessing that this problem has to do with the unicode <-> utf-8 ambiguities in python 2.
I am considering rewriting the script w/ the Python 3 SDK, but I first wanted to see if anyone else had encountered this error using the python 2.7 toolkit, and how they dealt with it.

Thanks,

Mark

jeffbr

unread,
May 7, 2021, 2:22:11 PM5/7/21
to Spectra Logic S3 SDKs, APIs, and RioBroker
Hi Mark, Spectra Logic is not aware of anyone else having this problem, but it may just be because they didn't have unicode characters. Thanks, Jeff
Reply all
Reply to author
Forward
0 new messages