• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Error No file found while converting file present in s3 using boto3

Resolved: Error No file found while converting file present in s3 using boto3

0
By Isaac Tonny on 04/04/2023 Issue
Share
Facebook Twitter LinkedIn

In this post, we will see how to resolve Error No file found while converting file present in s3 using boto3

Question:

  • I have a csv files present in s3
  • I am able to print bucket name, key and file content
  • But while converting to json I am getting Error no file found
  • There is only one csv file which is of 1 KB

code is below

Best Answer:

When you have:
This is already downloading the file (or object) contents in memory, within the AWS Lambda function.

N.B: keep an eye on the memory (MB) consumed. Increase memory size for the Lambda function as needed.


Further, I am assuming – based on the docs – that ['Body'].read() returns a bytes object.
So if you have bytes, you can then turn it into a string with:
Then create a file-like object as csv.DictReader expects, by wrapping the above with:
Full example:
Result:

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com

amazon-s3 boto3 python
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to stop a thread that has a blocking function from easygui in python

05/04/2023

Resolved: Removing null keys from a json array of objects

05/04/2023

Resolved: How can I generate at compile-time a separate OpenAPI Swagger.json file for each Controller in my ASP.NET project?

05/04/2023

Comments are closed.

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.