I'm writing a program that reads pdf and return an excel sheet using flask python. I keep getting File Not Found error in html web page.
from PyPDF2 import PdfReader, PdfWriter
DOWNLOAD_FOLDER = os.path.dirname(os.path.abspath(__file__)) + '/downloads/'
app.config['DOWNLOAD_FOLDER'] = DOWNLOAD_FOLDER
app.config['MAX_CONTENT_LENGTH'] = 8 * 1024 * 1024
@app.route('/uploads/<filename>')
def uploaded_file(filename):
return send_from_directory(app.config['DOWNLOAD_FOLDER'], filename, as_attachment=True)
def process_file(path, filename):
toExcel(path, filename)
def toExcel(path, filename):
input_file = PdfReader(open(path, 'rb'))
output = PdfWriter()
page_nos = len(input_file.pages)
I tried using validation of the input file, but didn't work
The correct output should return processed excel sheet.