Python(2.7)を使用してWindows7のシステムログにデータを書き込もうとしていますlogging.handlers.NTEventLogHandler
。一部のレジストリアクセスが拒否されているようであるため、これは機能しません。ソフトウェアは特別なアクセス権なしで実行されます。これを機能させる方法はありますか?
これが私が得る例外です:
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> from logging import handlers
>>> syslog = handlers.NTEventLogHandler("Something")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python27\lib\logging\handlers.py", line 917, in __init__
self._welu.AddSourceToRegistry(appname, dllname, logtype)
File "c:\Python27\lib\site-packages\win32\lib\win32evtlogutil.py", line 35, in
AddSourceToRegistry
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\%s\\%s" % (eventLogType, app
Name))
pywintypes.error: (5, 'RegCreateKey', 'Access is denied.')