₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,407 members, 8,421,770 topics. Date: Sunday, 07 June 2026 at 01:06 AM

Toggle theme

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

Nairaland ForumScience/TechnologyProgrammingPython Flask Help - How Can I Solve This. (762 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

Can You Solve This Google Coding Interview Problem? (pics)Django And Flask Users, Your Help Is Needed PleaseHow To Access Pulseway Restful API Using Python Flask234

Download Online Job Portal Using PHP With Source CodeCost Effective Android Application Development ServicesJava