on-internet
← Community

multiple .doc to .docx file conversion using python

Stack Overflow ·

I want to convert all the .doc files from a particular folder to .docx file. I tried using the following code, import subprocess import os for filename in os.listdir(os.getcwd()): if filename.endswith('.doc'): print filename subprocess.call(['soffice', '--headless', '--convert-to', 'docx', filename]) But it gives me an error: OSError: [Errno 2] No such file or directory

Comments

Sign in or sign up to comment and upvote.

No comments yet.