'Python Google Cloud Storage doesn't list some folders

I started using Google Cloud Storage python API, and got a weird bug.

Some folders aren't returning with the API calls, its like they don't exist.

I tried the following codes:

• List the files/folders in the parent directory:

storage_client.list_blobs(bucket_or_name=bucket, prefix=path)

My folder is not listed in the iterator

• Check if it exists:

bucket.get_blob(path + "/my_folder").exists()

Get AttributeError bacause NoneType doesn't have attribute exists() (i.e., the blob couldn't be found)

• Try to list files inside of it:

storage_client.list_blobs(bucket_or_name=bucket, prefix=path + "/my_folder")

And get zero-length iterator


The folder's path is copied from the Google Cloud Console, and it definitely exists. So why can't I see it? Am I missing something?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source