Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

No such file or directory – Boto3

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’

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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!

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading