当使用spellpy对日志文件进行解析时,出现如下错误:
执行的代码为:
for log_name in ['openstack_abnormal.log', 'openstack_normal2.log', 'openstack_normal1.log']:
parser.parse(log_name)
错误信息为:
Traceback (most recent call last):
File "preprocess.py", line 62, in <module>
parser.parse(log_name)
File "D:\Anaconda\lib\site-packages\spellpy\spell.py", line 188, in parse
self.load_data()
File "D:\Anaconda\lib\site-packages\spellpy\spell.py", line 300, in load_data
self.df_log = self.log_to_dataframe(os.path.join(self.path, self.logname), regex, headers, self.logformat)
File "D:\Anaconda\lib\site-packages\spellpy\spell.py", line 316, in log_to_dataframe
signal.signal(signal.SIGALRM, self._log_to_dataframe_handler)
AttributeError: module 'signal' has no attribute 'SIGALRM'
spell调用了signal模块,该模块可以在linux下正常使用,但在windows下却有一些限制:
“On Windows, signal() can only be called with SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, or SIGTERM. A ValueError will be raised in any other case.”
在Windows环境下只有这个几个信号类型允许被使用: