I ran a Python program and I am getting the following error as below:
File :...,line ...,in <module>
results = parse_file(text, ['stderr'], ['ERROR', 'WARN'])
Fie :....,line ...,in parse_file
all_containers=re.split('^Container:container_',text,flags=re.MULTILINE)
TypeError: split() got an unexpected keyword argument 'flags'
Below is my code:
def parse_file(text,filter_log_types=None,filter_content_types=None):
full_text_lines=text.split('\n')
results=[]
all_containers=re.split('^Container:container_',text,flags=re.MULTILINE)
for item in all_containers[1:]:
data=parse_container(item, full_text_lines, filter_log_types, filter_content_types)
results.append(data)
return results
if __name__ == '__main__':
text = open("lg.txt").read()
results = parse_file(text, ['stderr'], ['ERROR', 'WARN'])
I am using Python 2.6.6. Please help me to sort out this error. Thanks a lot!