Python lowriter call getting different result than from terminal

So, I’m trying to use lowriter to convert some files from doc/docx to pdf inside my program. When I run it like a sub process I get ‘Application Error’ like below

>>rest = subprocess.getoutput('lowriter --convert-to pdf --outdir ./data/temp_convert "<FILE_PATH>/file.docx"')
'Application Error'

But when I run it directly form the terminal everything works fine:

$ lowriter --convert-to pdf --outdir ./data/temp_convert "<FILE_PATH>/file.docx"
convert <FILE_PATH>/file.docx -> ./data/temp_convert/file.pdf using filter : writer_pdf_Export

Any idea what might be causing this?

Ps. This is an old script that worked with libreoffice 6.0 but does not with 7.0