Forums

Converting doc to docx in abiword

I found a way, but it works poorly

import subprocess
subprocess.run(['abiword', '--to=docx', 'DOC/1.doc'])

Gives an error message:

Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
** (abiword:293001): WARNING **: clutter failed 0, get a life.
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused

At the same time, it converts, but for some reason not all files, although they have the same tables, only a different filling and creates an empty file:

введите сюда описание изображения

How do I get rid of the errors and make it work? Or how can one convert differently on pythonanywhere

Messages are due to GUI stuff that is not present on PythonAnywhere servers. Is there anything special about files that do not convert?

For example, https://cchgeu.ru/upload/iblock/5c6/AD_171o.doc - Converted https://cchgeu.ru/upload/iblock/050/ATP_181o.doc - Not converted

Does it say anything specific about the second file in its output?

No, it's empty

Maybe if you add --verbose=2 to your command it will print out more information that will help you work out why it's not converting those files properly?

Didn't write anything new :( Files with files turned out, began to write "converted"

I can't really think of anything that would help, then :-( There are plenty of Python libraries for reading/writing docx files, but I can't find any that can read doc files.

Yes .. I can't decide for a month now