Commit 405454a8 authored by Boris Kocherov's avatar Boris Kocherov Committed by Romain Courteaud

x2t: use with block for open file

(cherry picked from commit e006854)
parent 3528fff1
...@@ -116,8 +116,7 @@ class Handler(object): ...@@ -116,8 +116,7 @@ class Handler(object):
os.mkdir(output_dir) os.mkdir(output_dir)
output_file_name = os.path.join(output_dir, "body.txt") output_file_name = os.path.join(output_dir, "body.txt")
config_file = open(config_file_name, "w") with open(config_file_name, "w") as config_file:
config = { config = {
# 'm_sKey': 'from', # 'm_sKey': 'from',
'm_sFileFrom': input_file_name, 'm_sFileFrom': input_file_name,
...@@ -134,7 +133,6 @@ class Handler(object): ...@@ -134,7 +133,6 @@ class Handler(object):
for key, value in config.items(): for key, value in config.items():
ElementTree.SubElement(root, key).text = value ElementTree.SubElement(root, key).text = value
ElementTree.ElementTree(root).write(config_file, encoding='utf-8', xml_declaration=True, default_namespace=None, method="xml") ElementTree.ElementTree(root).write(config_file, encoding='utf-8', xml_declaration=True, default_namespace=None, method="xml")
config_file.close()
# run convertion binary # run convertion binary
p = Popen( p = Popen(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment