Commit e0068547 authored by Boris Kocherov's avatar Boris Kocherov

x2t: use with block for open file

parent 2e8fd048
...@@ -168,8 +168,7 @@ class Handler(object): ...@@ -168,8 +168,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,
...@@ -186,7 +185,6 @@ class Handler(object): ...@@ -186,7 +185,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