Re: win32com.client.WithEvents fails when running as a Windows service

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.windows
Message-ID <[email protected]>
On Mar 6, 2021, at 6:43 AM, Marius Cirsta <[email protected]> wrote:
> 
>  I'm trying to automate CANoe using win32com. I've written a script that works perfectly when I log in and run it as a normal user.
> ...
> When being run as a service though I get this error:
> 
> Traceback (most recent call last):
>   File "D:\Jenkins\Scripts\dispatch.py", line 203, in <module>
>     exec_test(PDConfigPath, "CommonTests", "PD_CSB")
>   File "D:\Jenkins\Scripts\dispatch.py", line 146, in exec_test
>     win32com.client.WithEvents(csbTstMod, TestModuleEvents)
>   File "C:\Program Files\Python39\lib\site-packages\win32com\client\__init__.py", line 336, in WithEvents
>     instance = result_class(disp) # This only calls the first base class __init__.
>   File "C:\WINDOWS\TEMP\gen_py\3.9\7F31DEB0-5BCC-11D3-8562-00105A3E017Bx0x1x58.py", line 19507, in __init__
>     cookie=cp.Advise(win32com.server.util.wrap(self, usePolicy=EventHandlerPolicy))
> pywintypes.com_error: (-2147024891, 'Access is denied.', None, None)

Do you have your service configured to run as your user?  The normal service user has different access permissions, so it can’t access your file shares.
— 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.