Skip to content

Instantly share code, notes, and snippets.

@vkostyanetsky
Last active September 19, 2021 10:25
Show Gist options
  • Save vkostyanetsky/f95b30e2f09edd64d9e7a39575bb289a to your computer and use it in GitHub Desktop.
Save vkostyanetsky/f95b30e2f09edd64d9e7a39575bb289a to your computer and use it in GitHub Desktop.
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
Copy link
Author

vkostyanetsky commented Sep 19, 2021

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