File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 55from dataclasses import dataclass , field
66from typing import Dict , List , Optional , Union
77import boto3
8+ import botocore .exceptions
89from benchmark import DATASETS_DIR
910from dataset_reader .ann_compound_reader import AnnCompoundReader
1011from dataset_reader .ann_h5_reader import AnnH5Reader
@@ -109,10 +110,15 @@ def download(self):
109110 return
110111
111112 if self .config .link :
113+ downloaded_withboto = False
112114 if is_s3_link (self .config .link ):
113115 print ("Use boto3 to download from S3. Faster!" )
114- self ._download_from_s3 (self .config .link , target_path )
115- else :
116+ try :
117+ self ._download_from_s3 (self .config .link , target_path )
118+ downloaded_withboto = True
119+ except botocore .exceptions .NoCredentialsError :
120+ print ("Credentials not found, downloading without boto3" )
121+ if not downloaded_withboto :
116122 print (f"Downloading from URL { self .config .link } ..." )
117123 tmp_path , _ = urllib .request .urlretrieve (
118124 self .config .link , None , show_progress
You can’t perform that action at this time.
0 commit comments