# Downloading a csv file generated by a worker

**URL:** <https://community.fly.io/t/downloading-a-csv-file-generated-by-a-worker/15947>\
**Category:** Questions / Help\
**Tags:** login-only\
**Created:** [October 17, 2023, 2:47pm UTC](https://community.fly.io/t/downloading-a-csv-file-generated-by-a-worker/15947 "2023-10-17T14:47:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johncena](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/johncena/32/14984_2.png) [@johncena](https://community.fly.io/u/johncena)\
**Post date:** [October 17, 2023, 2:47pm UTC](https://community.fly.io/t/downloading-a-csv-file-generated-by-a-worker/15947/1 "2023-10-17T14:47:55Z")

</div>

I am generating a csv file with a worker using celery. The file is generated and when I ssh into the machine I can see the file.

I am then generating a route to download the file, but I cannot seem to find the right “location”?

> @app.route(‘/download\_generated\_csv/’, methods=[‘GET’])  
> def download\_generated\_csv(filename):  
> # Define the directory where the file should be saved  
> directory = “/workspace/tmp/”  
> try:  
> # Try to send the file  
> return send\_file(f"{directory}{filename}", as\_attachment=True)  
> except FileNotFoundError:  
> # File not found  
> return jsonify({“error”: “File not found”}), 404

I always get 404. The file name is correct.

I tried saving the file in /tmp and in /workspace/tmp (folder I created)

What am I Missing?

Thanks

Edit: added a volume and saved it there, still not being able to download it!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [October 24, 2023, 2:48pm UTC](https://community.fly.io/t/downloading-a-csv-file-generated-by-a-worker/15947/2 "2023-10-24T14:48:51Z")

</div>

Closed on October 24, 2023, 2:48pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
