diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-19 16:37:00 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-19 16:37:00 +0200 |
commit | f162ae0de0f71391c56957389cc3c8babc8022e1 (patch) | |
tree | c85c8117da6e20fe49f91c933d8c7e57eb808cb8 /pyload/manager/thread | |
parent | Merge pull request #8 from ardi69/0.4.10 (diff) | |
download | pyload-f162ae0de0f71391c56957389cc3c8babc8022e1.tar.xz |
Use with statement
Diffstat (limited to 'pyload/manager/thread')
-rw-r--r-- | pyload/manager/thread/Plugin.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pyload/manager/thread/Plugin.py b/pyload/manager/thread/Plugin.py index 08a2664da..348f005a5 100644 --- a/pyload/manager/thread/Plugin.py +++ b/pyload/manager/thread/Plugin.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- # @author: RaNaN +from __future__ import with_statement + from Queue import Queue from threading import Thread from os import listdir, stat @@ -64,9 +66,8 @@ class PluginThread(Thread): self.m.log.debug("Error creating zip file: %s" % e) dump_name = dump_name.replace(".zip", ".txt") - f = open(dump_name, "wb") - f.write(dump) - f.close() + with open(dump_name, "wb") as f: + f.write(dump) self.m.core.log.info("Debug Report written to %s" % dump_name) |