R
R
RealNeo2016-10-06 14:05:11
Python
RealNeo, 2016-10-06 14:05:11

How to connect to word from python?

Here is the code

import win32com.client as client
import pythoncom, os

pythoncom.CoInitialize()
word = client.Dispatch('Word.Application')
doc = word.Documents.Open(os.path.abspath(document_word))
doc.SaveAs(os.path.abspath(document_pdf), FileFormat=17)
doc.Close()
word.Quit()
pythoncom.CoUninitialize()

does not work on win 2012 to which I connect via remote desktop. Locally on my computer it works in two cases if I run it with the built-in djangi server, or under apache but on condition that I do as it says here http://stackoverflow .com/questions/26991609/python... in general, this advice locally heals everything, but on the server where everyone is under their own domain, even specifying themselves in DCOM and running APACHE also under their data, the problem is not solved, I would like to note that word it starts but I can't access it as far as I understand it's about permissions. This tip stackoverflow.com/questions/4803850/win32com-excel... doesn't work

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question