Skip to content

Commit

Permalink
delete file in temp bucket after doing OCR
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkeller committed Feb 3, 2018
1 parent ccad42f commit 6b4370e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ocr-lambda.zip
__pycache__
pdfrw*
tessdata/deu.traineddata
1 change: 1 addition & 0 deletions ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ def ocr(src_bucketname, src_filename, dest_bucketname, dest_filename, empty_page
output.addpage(p)
output.write('{}/output.pdf'.format(TMP_DIR))
s3.upload_file("{}/output.pdf".format(TMP_DIR), dest_bucketname, dest_filename)
s3.delete_object(Bucket=src_bucketname, Key=src_filename)
for f in ['partial.pdf', 'output.pdf', DOWNLOAD_FILE] + tar.getnames():
os.remove("{}/{}".format(TMP_DIR, f))

0 comments on commit 6b4370e

Please sign in to comment.