When i run my flask app locally or using uwsgi, it works perfectly. However, when trying to run using Gunicorn, i get a SIGSEV error. I’ve located the exact piece of code which is causing the error. I have no idea what it could be, i’ve tried using other versions of gunicorn and google API, but I still get it. Here is the code:
def get_top_level_folders(bucket_name):
try:
# Initialize a storage client
client = storage.Client()
bucket = client.bucket(bucket_name)
# Get the list of blobs
blobs = client.list_blobs(bucket)
# Extract the top-level folder names
top_level_folders = set()
for blob in blobs: # This loop causes SIGSEV error
folder = blob.name.split('/')[0]
top_level_folders.add(folder)
return list(top_level_folders)
except Exception as e:
print(f"An error occurred: {e}")
return []
The error doesn’t get caught either. When I take away the for loop, it returns an empty list(which is also wrong) but i at least don’t get the SIGSEV error. Any help would be greatly appreicated!