I am trying to read contents of files like .txt,.docx,.pdf and so on with textract and flask microframework. I am using POST method to get input file and send it to textract.
@app.route('/upload', methods=['POST']) def upload(): request_file = request.files['file'] r = request_file.read() text = textract.process(r) return (text)
when i uploaded a docx file,
File "/usr/lib/python2.7/genericpath.py", line 26, in exists os.stat(path) TypeError: stat() argument 1 must be encoded string without null bytes, not str 10.0.2.2 -- [17/Apr/2018 03:56:58] "POST /upload HTTP/1.1" 500 -
I don't want to save the file. All i need is to send the file into textract and process the file. Any help is much apprecaited.
[edit by admin: formatting]