@ -40,11 +40,13 @@ def process_sxd(filename):
Return an Index object.
"""
data = []
index_file = None
try:
index_file = encoding.open_read(filename, 'r')
for line in index_file:
data.append(line.strip())
finally:
if index_file:
index_file.close()
i = 1
@ -177,6 +177,7 @@ class TexRenderer(object):
subvariables = {}
template_file = None
templatename = self.texenv.get_template(template).filename
template_file = encoding.open_read(templatename, 'r')
@ -200,6 +201,7 @@ class TexRenderer(object):
)
if template_file:
template_file.close()
return (subvariables, subtemplates)
@ -101,6 +101,7 @@ def main():
basename = os.path.basename(songbook_path)[:-3]
songbook_file = None
songbook_file = encoding.open_read(songbook_path)
songbook = json.load(songbook_file)
@ -109,6 +110,7 @@ def main():
LOGGER.error("Error while loading file '{}'.".format(songbook_path))
sys.exit(1)
if songbook_file:
songbook_file.close()
# Gathering datadirs