Thanks for the reply.  I have tried running the python script as admin.
When I do run as admin, I get the following error: pywintypes.com_error:
(-2146959355 <(214)%20695-9355>, 'Server execution failed', None, None).  I've
noticed, by watching Task Manager, that the application opens and closes a
couple of seconds later.  Event Viewer shows a DistributedCOM 10010 Error
for each failed attempt: The server {FDE63972-78D6-4144-B2E0-28960C67B33D}
did not register with DCOM within the required timeout.  Tried it on
another PC and it works fine and doesn't require elevation to admin.  Must
be something borked with my Windows.

Ta,
Simon


On Sun, 10 Jun 2018 at 02:52 Vernon D. Cole <vernondc...@gmail.com> wrote:

> look in github.com/salt-bevy/sudo.py
> <https://github.com/salt-bevy/salt-bevy/blob/master/configure_machine/sudo.py>
> for a module which will request elevated privileges for a Python script
> running as a normal user.
> Perhaps that can help create a solution for your use case.
>
> There is a sample call for it in bootstrap_bevy_member_here.py or you can
> just run it from the command line with the script you want to run as
> administrator as its arguments.
>
>
>
> On Fri, Jun 8, 2018 at 11:11 PM, Simon McConnell <simonmcconn...@gmail.com
> > wrote:
>
>> Hi,
>>
>> I am trying to dispatch a COM interface of a program that is set to "Run
>> as Administrator" in the Compatibility Settings of its properties.  Running
>> the script w/o elevation results in a 'requires elevation' error.  Running
>> the script with elevation results in a 'server execution failed' error,
>> which I understand to be "I can't find that thing".  Removing the "Run as
>> Administrator" from the Compatibility settings and running the script w/o
>> elevation works, but unfortunately, this program needs to be run as
>> administrator.  When opening the program manually I have to accept the UAC
>> popup and cannot turn it off thanks to Group Policy.  Any clues?
>>
>> import win32com.client
>> o = win32com.client.Dispatch("CimplicityME.Application")
>>
>>
>> gives the error:
>>
>>
>> Traceback (most recent call last):
>>   File
>> "C:\Users\smcconnell\PycharmProjects\proficy\venv\lib\site-packages\win32com\client\dynamic.py",
>> line 89, in _GetGoodDispatch
>>     IDispatch = pythoncom.connect(IDispatch)
>> pywintypes.com_error: (-2147221021 <(214)%20722-1021>, 'Operation
>> unavailable', None, None)
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File "C:\Users\smcconnell\PycharmProjects\proficy\src\proficy.py", line
>> 5, in <module>
>>     o = win32com.client.Dispatch("CimplicityME.Application")
>>   File
>> "C:\Users\smcconnell\PycharmProjects\proficy\venv\lib\site-packages\win32com\client\__init__.py",
>> line 95, in Dispatch
>>     dispatch, userName =
>> dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
>>   File
>> "C:\Users\smcconnell\PycharmProjects\proficy\venv\lib\site-packages\win32com\client\dynamic.py",
>> line 114, in _GetGoodDispatchAndUserName
>>     return (_GetGoodDispatch(IDispatch, clsctx), userName)
>>   File
>> "C:\Users\smcconnell\PycharmProjects\proficy\venv\lib\site-packages\win32com\client\dynamic.py",
>> line 91, in _GetGoodDispatch
>>     IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
>> pythoncom.IID_IDispatch)
>> pywintypes.com_error: (-2147024156 <(214)%20702-4156>, 'The requested
>> operation requires elevation.', None, None)
>>
>>
>>
>> If I run the script as administrator I get the following error:
>>
>>
>> Traceback (most recent call last):
>>   File
>> "C:\Users\smcconnell\PycharmProjects\proficy\venv\lib\site-packages\win32com\client\dynamic.py",
>> line 89, in _GetGoodDispatch
>>     IDispatch = pythoncom.connect(IDispatch)
>> pywintypes.com_error: (-2147221021 <(214)%20722-1021>, 'Operation
>> unavailable', None, None)
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File "C:\Users\smcconnell\PycharmProjects\proficy\src\proficy.py", line
>> 5, in <module>
>>     o = win32com.client.Dispatch("CimplicityME.Application")
>>   File
>> "C:\Users\smcconnell\PycharmProjects\proficy\venv\lib\site-packages\win32com\client\__init__.py",
>> line 95, in Dispatch
>>     dispatch, userName =
>> dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
>>   File
>> "C:\Users\smcconnell\PycharmProjects\proficy\venv\lib\site-packages\win32com\client\dynamic.py",
>> line 114, in _GetGoodDispatchAndUserName
>>     return (_GetGoodDispatch(IDispatch, clsctx), userName)
>>   File
>> "C:\Users\smcconnell\PycharmProjects\proficy\venv\lib\site-packages\win32com\client\dynamic.py",
>> line 91, in _GetGoodDispatch
>>     IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
>> pythoncom.IID_IDispatch)
>> pywintypes.com_error: (-2146959355 <(214)%20695-9355>, 'Server execution
>> failed', None, None)
>>
>>
>> _______________________________________________
>> python-win32 mailing list
>> python-win32@python.org
>> https://mail.python.org/mailman/listinfo/python-win32
>>
>>
>
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to