def convert_to_pdf(uid,imagedate,f_address): import os import subprocess import stat import time file_name = uid+'/report.docx' #b_cmd = 'libreffice --convert-to pdf ' + file_name f_address = f_address.replace(" ","_") f_address = f_address.replace(",","_") file_name_pdf = uid + '/report.pdf' #subprocess.call(b_cmd) doc_name=uid+'/Farmonaut_report_'+str(imagedate)+'_'+f_address+'.pdf' os.chmod('add_pg.sh',stat.S_IRWXU) #os.chmod(file_name_pdf,stat.S_IRWXU) #os.chmod(file_name,stat.S_IRWXU) b_cmd ='/home/ankuromar296_gmail_com/add_pg.sh '+str(file_name_pdf)+' '+str(imagedate)+' '+str(f_address)+' '+str(file_name)+' '+str(uid) subprocess.Popen([b_cmd],shell=True) time.sleep(10)