Skip to content

Instantly share code, notes, and snippets.

@vkostyanetsky
Last active Sep 19, 2021
Embed
What would you like to do?
How to find EXCP in 1C Tech Log
import os
import glob
dirname = os.path.dirname(__file__)
dirpath = os.path.abspath(dirname)
log_pathname = os.path.join(dirpath, '*', '*.log')
log_filenames = glob.iglob(log_pathname, recursive = True)
output_filename = os.path.join(dirpath, 'result.txt')
output_file = open(output_filename, 'w', encoding = 'utf-8-sig')
for log_filename in log_filenames:
log_file = open(log_filename, 'r', encoding = 'utf-8-sig')
while True:
line = log_file.readline()
if not line:
break
if line.find(',EXCP,') != -1:
output_file.write(line)
log_file.close()
output_file.close()
@vkostyanetsky

This comment has been minimized.

Copy link
Owner Author

@vkostyanetsky vkostyanetsky commented Sep 19, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment