<commit_before>from django import template

register = template.Library()

@register.simple_tag
def inline_file(path):
  if path[0] == '/':
    path = path[1:]

  content = ''
  with open(path, 'r') as f:
    content = f.read()
  return content<commit_msg>Error logging for when inline_file cant find static file<commit_after>import logging

from django import template

register = template.Library()

@register.simple_tag
def inline_file(path):
  if path[0] == '/':
    path = path[1:]

  content = ''
  try:
    with open(path, 'r') as f:
      content = f.read()
  except IOError, e:
    logging.error('inline_file cannot read file - ' + str(e))
  return content
{'fraction_non_alphanumeric': 0.1293233082706767, 'fraction_numerical': 0.006015037593984963, 'mean_word_length': 3.6901408450704225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2633995', 'n_tokens_mistral': 218, 'n_tokens_neox': 213, 'n_words': 65}