I am trying to convert .doc documents to .docx documents using python. Getting inspiration from this post, I have tried the following code :
import subprocess
import glob
import os
root = "//xxx/"
data_path = root + '/data2/'
os.chdir(data_path)
for doc in glob.iglob("*.doc"):
print(doc)
subprocess.call(['soffice', '--headless', '--convert-to', 'docx', doc], shell = True)
But unfortunately litterally nothing happens, i.e. I get no error message, the code is running, the docs are detected (which I check thanks to print) but I don't get any result. Any idea how I may troubleshoot this ?
EDITS :
- I am running on Windows, hence
shell = True - I have tried double quotes :
'" - I have tried without spaces in the names
- When I execute the
subprocesscommand on one file alone, I get1as output, which I don't knowhow to interpret...