Home > Software engineering >  No such file or directory - Boto3
No such file or directory - Boto3

Time:02-10

I am running the following with Amazon Sagemaker

s3 = boto3.client('s3', region_name='us-east-1', 
                        # Set up AWS credentials 
                        aws_access_key_id=key_id, 
                         aws_secret_access_key=secret_key)


s3.create_bucket(Bucket = 'gid-datacamp')

s3.upload_file(Filename = r'C:\Users\Filippo\Desktop\WineQT.csv' , Bucket = 'gid-datacamp', Key = 'WineQT.csv')

but despite the directory being the correct one I get the following error:

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Filippo\Desktop\WineQT.csv'

I also tried to directly import the file using pd.read_csv() and I got the same error.

Is there something I don't know about how boto3 and my local machine interact?

thanks!

CodePudding user response:

The python script should run on your local machine, not SageMaker (SM).

SM does not have access to your local computer, unless you setup some kind of connection between SM and your home/work computer. Once you have that you can access the files through server (ssh or ftp) running on your local computer.

  • Related