Flask, send_from_directory not working : solved - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Flask, send_from_directory not working : solved (/thread-32178.html) |
Flask, send_from_directory not working : solved - SpongeB0B - Jan-26-2021 Hi everyone, here my simple test code : def download(): try: return send_from_directory('C:\\original.jpg', filename='original.jpg', as_attachment=True) except FileNotFoundError: abort(404)No matter what I try I get in the Internet browser Quote:Not Found and this message is not even triggered by the except :/ Any ideas ? RE: Flask, send_from_directory not working - ndc85430 - Jan-26-2021 The clue is in the name of the function: the first argument should be the directory (see the docs). RE: Flask, send_from_directory not working - SpongeB0B - Jan-26-2021 Thank you @ndc85430 !! it's was so simple ! I'm ashamed.... I'll try to find this tutorial where I have found this bad example/mistake ! |