₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,783 members, 8,513,661 topics. Date: Thursday, 05 November 2026 at 10:46 AM

Toggle theme

Python Flask Help - How Can I Solve This. - Programming - Nairaland

Nairaland Forum › Science/Technology › Programming › Python Flask Help - How Can I Solve This. (810 Views)

1 Reply (Go Down)

Python Flask Help - How Can I Solve This. by fnep2smooth(op):
I have this YouTube channel am managing and I am creating a web app with flask to automatic download the audio of the video in my channel.

In my code I use moviepy to extract the video and also convert it to audio.

Now my challenge is after the download and moving it to the specific folder, I return a download.html template to show a download link button but I can be able to create get the link.

I also try to out put the download to my browser as an attachment through send_file but it's not working. The attachment will download but only on the terminal I want to push it to the browser , please any help

UPDATE
The first image was the reason i created this thread, before then i was having issue with existing file after coveting and trying to move it to the specific folder i want. this require me to delete the file existing attachment before running the code, so i used shutil.move to overwrite the existing file which you can see in the second image....

but still can download the attachment

Code below.

Re: Python Flask Help - How Can I Solve This. by Karleb(m): 7:15pm On Jan 18, 2021
Have you been able to solve this?


From what I'm seeing, you are only rendering the view you are not sending any data to it.

I don't write flask but I think the return should be like.

return render_template('promote. html').with('attachment.file')
Re: Python Flask Help - How Can I Solve This. by kensmoney(m): 11:09am On Jan 19, 2021
Put the attachment in ur return statement, then in ur front end, use "jinja2 template engine" to render the attachment
Re: Python Flask Help - How Can I Solve This. by fnep2smooth(op): 5:19pm On Jan 24, 2021
Karleb:
Have you been able to solve this?


From what I'm seeing, you are only rendering the view you are not sending any data to it.

I don't write flask but I think the return should be like.

return render_template('promote. html').with('attachment.file')
An just seeing your message now... Let me update the new error
Re: Python Flask Help - How Can I Solve This. by fnep2smooth(op): 7:39pm On Jan 24, 2021
UPDATE
The first image was the reason i created this thread, before then i was having issue with existing file after coveting and trying to move it to the specific folder i want. this require me to delete the file existing attachment before running the code, so i used shutil.move to overwrite the existing file which you can see in the second image....
1 Reply

Building A Python Flask Application With Database Modelling And Design • Can You Solve This Google Coding Interview Problem? (pics) • How To Access Pulseway Restful API Using Python Flask • 2 • 3 • 4

DAEROBOTICS- We Are Hiring !!! • Wema Bank Oo • Please Check Out My Portfolio