I am in the process of creating a script that grabs my s3 data to my local machine. Typically the data I am receiving is that of a hive partition. I am receiving a No such file or directory
error even though the file does exist. Can someone explain what I am doing wrong and how I should approach this differently? Here is the piece of code that the error references:
bucket = conn.get_bucket(bucket_name)
for sub in bucket.list(prefix = 'some_prefix'):
matched = re.search(re.compile(read_key_pattern), sub.name)
if matched:
with open(sub.name, 'rb') as fin:
reader = csv.reader(fin, delimiter = '\x01')
contents = [line for line in reader]
with open('output.csv', 'wb') as fout:
writer = csv.writer(fout, quotechar = '', quoting = csv.QUOTE_NONE, escapechar = '\\')
writer.writerows.content
IOError: [Errno 2] No such file or directory: 'my_prefix/54c91e35-4dd0-4da6-a7b7-283dff0f4483-000000'
The file exists and that is the correct folder and file that I am trying to retrieve.