summaryrefslogtreecommitdiff
path: root/ishtar_common/tasks.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-08-20 15:42:38 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-10-24 18:32:21 +0200
commit1fb4e99abe52f98d34339f12940582f2ca51ecb8 (patch)
tree8d30e88c649be96dcc19e05d27b77895c2ada899 /ishtar_common/tasks.py
parentb98b3004bb1a47674c9595a5d674dc4ba83344c8 (diff)
downloadIshtar-1fb4e99abe52f98d34339f12940582f2ca51ecb8.tar.bz2
Ishtar-1fb4e99abe52f98d34339f12940582f2ca51ecb8.zip
🐛 fix unclosed file
Diffstat (limited to 'ishtar_common/tasks.py')
-rw-r--r--ishtar_common/tasks.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/ishtar_common/tasks.py b/ishtar_common/tasks.py
index 55c704ab1..24ae02dcc 100644
--- a/ishtar_common/tasks.py
+++ b/ishtar_common/tasks.py
@@ -173,13 +173,13 @@ def launch_export(export_task_id):
if not export_task.geo:
kwargs["no_geo"] = True
archive_name = full_serialization(**kwargs)
- result = open(archive_name, "rb")
- export_task.result.save(archive_name.split(os.sep)[-1], File(result))
- os.remove(archive_name)
- export_task.finished_date = datetime.datetime.now()
- export_task.state = "F"
- export_task.result_info = str(_("Export finished"))
- export_task.save()
+ with open(archive_name, "rb") as result:
+ export_task.result.save(archive_name.split(os.sep)[-1], File(result))
+ os.remove(archive_name)
+ export_task.finished_date = datetime.datetime.now()
+ export_task.state = "F"
+ export_task.result_info = str(_("Export finished"))
+ export_task.save()
def update_towns():