From 04b2a71bce8a0673f578e066d64835c0a528933f Mon Sep 17 00:00:00 2001 From: Koncopd Date: Fri, 3 Jan 2025 16:14:01 +0100 Subject: [PATCH] No exception when default aws creds fail --- lamindb_setup/core/_aws_credentials.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lamindb_setup/core/_aws_credentials.py b/lamindb_setup/core/_aws_credentials.py index e6db98b5..50b4f865 100644 --- a/lamindb_setup/core/_aws_credentials.py +++ b/lamindb_setup/core/_aws_credentials.py @@ -3,6 +3,7 @@ import os import time +from lamin_utils import logger from upath.implementations.cloud import S3Path HOSTED_REGIONS = [ @@ -40,8 +41,15 @@ def __init__(self): # this is cached so will be resued with the connection initialized fs = S3FileSystem(cache_regions=True) - fs.connect() - self.anon: bool = fs.session._credentials is None + try: + fs.connect() + self.anon: bool = fs.session._credentials is None + except Exception as e: + logger.warning( + f"There is a problem with your default AWS Credentials: {e}\n" + "`anon` mode will be used for all non-managed buckets." + ) + self.anon = True self.anon_public: bool | None = None if not self.anon: try: