Hey,
For whatever reson, I am getting a server timed out error when trying to OCR files:
import frappe
@frappe.whitelist()
def PDF_parser(file):
import ocrmypdf
import os
file = os.getcwd() + '/site1.local' + file
try:
ocrmypdf.ocr(file, file, deskew=True, progress_bar=False)
return('file was OCRed')
except:
return('file was not OCRed')
Any ideas why this times out (even when there is an exception)?
When trying to run manually it takes no more than 15 seconds to run this function for whaterver file being tested.
I call it like this:
frappe.ui.form.on('Raw Materials', {
pdf_file(frm) {
frappe.call({
method: "path.to.PDF_parser.PDF_parser",
args: {
'file': frm.doc.pdf_file
},
freeze: true,
callback: (r) => {
alert (r.message);
}
});
}
});