Я прохожу курс IBM Python для Data Science и на одном из модулей я получаю сообщение об ошибке.Я следую инструкциям по использованию s3 и putobject для сохранения файла в корзину в облачном хранилище объектов IBM.Это дает мне ошибку NoSuchKey, но ключ определен выше
bucket_name = 'm4week5'
html_path = '/home/dsxuser/work/index.html'
f = open(html_path,'r')
# Fill up the parameters in the following function:
# resource.Bucket(name=).put_object(Key=, Body=)
resource.Bucket(name = bucket_name).put_object(Key = html_path, Body = f.read())
Сообщение об ошибке:
NoSuchKey Traceback (most recent call last)
<ipython-input-22-a728805063e5> in <module>()
1 # Fill up the parameters in the following function:
2 # resource.Bucket(name=).put_object(Key=, Body=)
----> 3 resource.Bucket(name = bucket_name).put_object(Key = html_path, Body = f.read())
/opt/conda/envs/DSX-Python35/lib/python3.5/site-packages/boto3/resources/factory.py in do_action(self, *args, **kwargs)
518 # instance via ``self``.
519 def do_action(self, *args, **kwargs):
--> 520 response = action(self, *args, **kwargs)
521
522 if hasattr(self, 'load'):
/opt/conda/envs/DSX-Python35/lib/python3.5/site-packages/boto3/resources/action.py in __call__(self, parent, *args, **kwargs)
81 operation_name, params)
82
---> 83 response = getattr(parent.meta.client, operation_name)(**params)
84
85 logger.debug('Response: %r', response)
/opt/conda/envs/DSX-Python35/lib/python3.5/site-packages/botocore/client.py in _api_call(self, *args, **kwargs)
310 "%s() only accepts keyword arguments." % py_operation_name)
311 # The "self" in this scope is referring to the BaseClient.
--> 312 return self._make_api_call(operation_name, kwargs)
313
314 _api_call.__name__ = str(py_operation_name)
/opt/conda/envs/DSX-Python35/lib/python3.5/site-packages/botocore/client.py in _make_api_call(self, operation_name, api_params)
599 error_code = parsed_response.get("Error", {}).get("Code")
600 error_class = self.exceptions.from_code(error_code)
--> 601 raise error_class(parsed_response, operation_name)
602 else:
603 return parsed_response
NoSuchKey: An error occurred (NoSuchKey) when calling the PutObject operation: The specified key does not exist.