def convert_to_html(uid,imagedate,f_address, lang): import os import subprocess import stat import time import pdftotree import mammoth file_name = uid+'/report.docx' #b_cmd = 'libreffice --convert-to pdf ' + file_name f_address = f_address.replace(" ","_") f_address = f_address.replace(",","_") doc_name=uid+'/report.html' if os.path.exists(doc_name): os.remove(doc_name) template_html = '''