Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid argument type when trying to download specific files from S3 bucket to EC2 using subprocess

I am trying to download certain files from S3 to local machine by running the following code:

import subprocess, os
ec2_root = '/home/'
s3_root_path = "S3://bucket-name/"
s3_download_command = ["aws", "s3", "cp", os.path.join(s3_root_path, 'my_video.mp4'), os.path.join(local_root)]
p = subprocess.Popen(s3_download_command)
p.communicate()

But I get the following error: usage: aws s3 cp <LocalPath> <S3Uri> or <S3Uri> <LocalPath> or <S3Uri> <S3Uri> Error: Invalid argument type

like image 585
A_Matar Avatar asked Nov 28 '25 21:11

A_Matar


1 Answers

It turned out that I used S3:// with a capital S instead of small s.

like image 101
A_Matar Avatar answered Dec 01 '25 11:12

A_Matar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!