nighbert

REST service cannot access MicroSoft Word via Python

Discussion created by nighbert on May 29, 2012
Latest reply on May 30, 2012 by ryankelley001
(I posted the original post on the REST API forum as well on Friday: http://forums.arcgis.com/threads/58532-REST-service-cannot-access-MicroSoft-Word-via-Python)

Surely someone out there is creating a report in MicroSoft Word in python executed from a REST service!?!?

My script calls this line to access Microsoft Word (win32com.client.Dispatch("Word.Application")) - but fails.
I can run the script (as myself or the arcgissoc user) on the same server ArcGIS server is using, which tells me Word is on the server. But, when I run the script from the REST endpoint, I get a permissions problem related to the COM. Write permissions are set properly for the arcgissoc user to access the win32com libraries.  There must be some setting in the COM administrator related to Word that the arcgissoc user needs write access too. Maybe?

error message:
line 241, in wordapp = win32com.client.Dispatch("Word.Application") File "C:\Python26\ArcGIS10.0\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Python26\ArcGIS10.0\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python26\ArcGIS10.0\lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147024891, 'Access is denied.', None, None) (-2147024891, 'Access is denied.', None, None)

Thanks,
ryan

Outcomes