[python-win32] pywintypes.error: (5, 'RegSetValueEx', 'Access denied')

Robin Kluth kontakt at kluthr.de
Thu Mar 15 04:44:30 EDT 2018


Hi :)

I use Python 2.7 on win10 and pywin32 223. I want to log messqages to 
the EventLog:

dllname = os.path.dirname(__file__)
ntl = NTEventLogHandler("Python Logging Test", dllname=dllname)
logger = logging.getLogger("")
logger.setLevel(logging.DEBUG)
logger.addHandler(ntl)

logger.error("This is a '%s' message", "Error")




But I get:

Traceback (most recent call last):
   File "fpp_user_import.py", line 44, in <module>
     ntl = NTEventLogHandler("Python Logging Test", dllname=dllname)
   File "C:\Python27\lib\logging\handlers.py", line 987, in __init__
     self._welu.AddSourceToRegistry(appname, dllname, logtype)
   File "C:\Python27\lib\site-packages\win32\lib\win32evtlogutil.py", 
line 42, in AddSourceToRegistry
     msgDLL)
pywintypes.error: (5, 'RegSetValueEx', 'Zugriff verweigert')



If I run the script with Admin privs, it is working.

How to log as "normal" user? Am I missing something?

Thanks in advance!


More information about the python-win32 mailing list