IBM / ibm-cos-sdk-js

ibm-cos-sdk-js
Apache License 2.0
38 stars 19 forks source link

CLIENT ERROR: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist while running python get_item #62

Closed AnuRam123 closed 4 years ago

AnuRam123 commented 4 years ago

I am trying to use python https://cloud.ibm.com/docs/services/cloud-object-storage/libraries?topic=cloud-object-storage-python#using-python

I am able to get buckets, create buckets and even items within buckets. I am unable to create files or read contents. image

This the code def get_item(bucket_name, item_name): print("Retrieving item from bucket: {0}, key: {1}".format(bucket_name, item_name)) try: file = cos.Object(bucket_name, item_name).get() print("File Contents: {0}".format(file["Body"].read())) except ClientError as be: print("CLIENT ERROR: {0}\n".format(be)) except Exception as e: print("Unable to retrieve file contents: {0}".format(e))

kellerbr-ibm commented 4 years ago

It looks like the program is trying to download an object named /Users/.../.../dummy.txt, but I think you only wanted to download dummy.txt instead. I'd check that you're calling get_item() with the correct item_name that only has the file name and not a full path.

AnuRam123 commented 4 years ago

I tried with the name as well

image both create and get failed

AnuRam123 commented 4 years ago

never mind it was my bad , I had the wrong name closing this issue